MCPInstall
vLLM-with-MCP logo

vLLM-with-MCP

by juna-99 1 stars juna-99/vLLM-with-MCP

AI-powered vLLM Multi-Agent system with a connection hub (MCP style!)

READMEmain

🧠 MCP Server (Model Context Protocol)

The MCP Server is a lightweight microservice that connects real-world information (like web search results) to language models (LLMs) to improve prompt understanding and response generation. This pattern enables you to dynamically provide context to LLMs before asking them a question.

📌 What is MCP?

MCP (Model Context Protocol) is a design pattern, not a library. It describes how to build applications that:

  1. Receive a user prompt
  2. Enrich the prompt with context (from web search, databases, documents, etc.)
  3. Send the enriched prompt to an LLM (like OpenAI, Claude, or vLLM)
  4. Return the LLM's response

This project implements MCP as a FastAPI server.


⚙️ What This MCP Server Does

This particular server:

  • Accepts prompts at a REST endpoint (/generate)
  • Uses LinkUp to do web search and fetch real-time information
  • Sends enriched prompt + context to a local vLLM model server
  • Returns the model’s generated response

🗂️ Folder Structure

.
├── mcp_server.py     # Main MCP server implementation
├── test_client.py    # (Optional) Simple test client to interact with your MCP server
├── requirements.txt  # Python dependencies
├── .env              # API keys and secrets

🥪 Example Usage

Send a POST request to your MCP server:

curl -X POST http://localhost:8091/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "What is the future of quantum computing?"}'

Response:

{
  "response": "Quantum computing is expected to..."
}

📥 Prerequisites

Make sure your environment has:

  • Python 3.10+
  • Access to vLLM (running on localhost:8000)
  • A working LinkUp API key

🔧 Installation & Setup

1. Clone This Repo

git clone https://github.com/your-org/mcp-server.git
cd mcp-server

2. Install Requirements

pip install -r requirements.txt

3. Set Up .env File

Create a .env file with your LinkUp API key:

LINKUP_API_KEY=your-linkup-api-key-here

🚀 Run the MCP Server

python mcp_server.py

Should show something like:

INFO:     Uvicorn running on http://0.0.0.0:8091

🧠 How the Code Works

# 1. Accept prompt
@app.post("/generate")
def generate_response(request: PromptRequest):
    prompt = request.prompt

    # 2. Get real-time web context from LinkUp
    search_results = perform_web_search(prompt)

    # 3. Combine context with user prompt
    full_prompt = f"{search_results}\n\nUser Prompt: {prompt}"

    # 4. Call vLLM for response
    model_output = call_vllm(full_prompt)

    return {"response": model_output}

👤 Streamlit UI (Optional)

Run this for a simple web interface:

streamlit run app.py --server.address 0.0.0.0

If you're on a cloud container (like AI Stack), forward the port to view in a browser:

kubectl port-forward pod/<your-pod-name> 8501:8501

🧩 What's Next?

You can customize this server to:

  • Use other context sources (e.g., PDF, vector DB)
  • Switch models (OpenAI, Claude, Gemini)
  • Handle multi-turn conversations

📚 Credits


🧠 Summary

This MCP server gives your LLM the eyes and ears it needs by pulling in real-world info — making your AI smarter, more accurate, and more up-to-date.

More AI Chatbot MCP servers

Similar servers from the same category.

Jentic

jentic

Enables AI assistants to discover and execute external APIs and workflows through a Python SDK that leverages the Open Agentic Knowledge repository for standardized API access and execution.

AI Chatbot

Provides a bridge to the Flyworks AI lipsync service, enabling creation of digital avatar videos synchronized with audio inputs through a simple API.

git

Official JavaScript implementation that integrates with MiniMax's multimodal capabilities for image generation, video creation, text-to-speech, and voice cloning across multiple transport modes.

APIVideo+7

Provides a bridge to Mureka.ai's music generation capabilities, enabling on-demand creation of lyrics, complete songs, and instrumental tracks without requiring specialized music production knowledge.

AI Chatbot