Multi-Agent MCP Server

Multi-Agent MCP Server

Provides 7 tools for weather (geocoding, current conditions) and country data (capital, currency, population, dial code, flag) via Open-Meteo and CountriesNow APIs, designed for multi-agent AI systems.

Category
访问服务器

README

Multi-Agent MCP Demo

A working demonstration of one MCP server exposing many tools, with multiple LangGraph agents each bound to a filtered subset of those tools, and a supervisor that routes each user question to the right agent, all deployed to the cloud with a browser chat UI.

The core idea: a single MCP server hands over its entire tool catalog to any client. Filtering, deciding which agent sees which tools, happens on the client side, in one line:

agent_tools = [t for t in all_tools if t.name.startswith(prefix)]

🔗 Live URLs

Service URL
💬 Chat UI (agents) https://multi-agent-mcp-agents.onrender.com
🛠️ MCP server https://multi-agent-mcp.onrender.com/mcp
❤️ MCP health check https://multi-agent-mcp.onrender.com/health
📦 Source https://github.com/jamalla/multi-agent-mcp

⏳ Cold start: both services run on Render's free tier and sleep after ~15 min idle. The first request after a nap can take 30 to 50s to wake the container, then the second is fast. The chat UI shows a "may take ~40s" hint while waiting.

Architecture

                        Browser (chat UI)
                                │
                                ▼
        ┌───────────────────────────────────────────────┐
        │   FastAPI agent service  (Render service #2)    │
        │   ┌─────────────────────────────────────────┐  │
        │   │           LangGraph Supervisor          │  │
        │   │  (LLM router → picks the right agent)    │  │
        │   └──────────┬──────────┬──────────┬────────┘  │
        │       ┌──────▼─────┐ ┌──▼───────┐ ┌▼─────────┐ │
        │       │  Agent 1    │ │ Agent 2   │ │ Agent 3  │ │
        │       │ weather_*   │ │ country_* │ │worldcup_*│ │
        │       │ (2 tools)   │ │ (5 tools) │ │(5 tools) │ │
        │       └──────┬─────┘ └──┬───────┘ └┬─────────┘ │
        └──────────────┼──────────┼──────────┼───────────┘
                       └──────────┼──────────┘
                     filtered subsets of one catalog
                                  │  (streamable-HTTP / MCP)
                     ┌────────────▼────────────┐
                     │      MCP Server         │  (Render service #1)
                     │   12 tools, unfiltered  │
                     └────┬──────────┬─────────┬┘
                          │          │         │
                 ┌────────▼─┐ ┌──────▼────┐ ┌──▼──────────────┐
                 │Open-Meteo│ │CountriesNow│ │football-data.org│
                 │(weather) │ │ (country)  │ │  (World Cup)    │
                 └──────────┘ └────────────┘ └─────────────────┘

Two clean separations:

  • The supervisor decides who handles a query (routing).
  • The prefix filter decides what each agent can do (tool scoping).

The tools (12 total)

The naming convention (weather_ / country_ / worldcup_ prefixes) is what makes per-agent filtering a one-liner.

Prefix Tool Source API
weather_ weather_geocode Open-Meteo (geocoding)
weather_ weather_current Open-Meteo (forecast)
country_ country_capital CountriesNow
country_ country_currency CountriesNow
country_ country_population CountriesNow
country_ country_dial_code CountriesNow
country_ country_flag CountriesNow
worldcup_ worldcup_matches_upcoming football-data.org
worldcup_ worldcup_match_results football-data.org
worldcup_ worldcup_group_standings football-data.org
worldcup_ worldcup_teams football-data.org
worldcup_ worldcup_team_form football-data.org

Open-Meteo and CountriesNow are free and need no key. football-data.org needs a free API key (FOOTBALL_API_KEY). "Predictions" are the World Cup agent reasoning over standings and recent form it fetches with these tools, not a separate prediction API.

Observability: see the route & tool steps

Every answer returns a structured trace, rendered under each message in the UI (expandable):

🌤️ routed to Agent 1 (weather)   ▸ Show reasoning (4 steps)
   🔧 weather_geocode({"city":"Tokyo"})
   📥 weather_geocode → {"name":"Tokyo","country":"Japan","latitude":35.6895,...}
   🔧 weather_current({"latitude":35.6895,"longitude":139.69171})
   📥 weather_current → {"temperature_2m":27.0,"wind_speed_10m":4.5,...}

The /ask endpoint returns:

{
  "answer": "…",
  "route":  { "destination": "weather", "agent": "Agent 1 (weather)" },
  "steps":  [ { "kind": "tool_call", "tool": "...", "args": {...} },
              { "kind": "tool_result", "tool": "...", "output": "..." } ]
}

For deeper tracing (timings, tokens, nested spans), set LANGCHAIN_TRACING_V2=true and LANGCHAIN_API_KEY to enable LangSmith, no code changes required.

Tech stack

  • MCP server: FastMCP over streamable-HTTP
  • Agents / routing: LangGraph (create_react_agent) + LangChain
  • MCP ↔ LangGraph bridge: langchain-mcp-adapters
  • LLM: OpenAI gpt-4o-mini (routing + agents)
  • API / UI: FastAPI (serves both /ask and the chat page)
  • Hosting: Render (two Docker web services, free tier)

Project structure

multi-agent-mcp/
├── mcp_server/
│   └── server.py          # FastMCP server: 7 tools + /health, reads $PORT
├── agents/
│   ├── agent_config.py    # MCP client + prefix map (reads MCP_URL from env)
│   ├── graph.py           # build_agents(): filter tools → create_react_agent
│   ├── supervisor.py      # LLM router + trace extraction
│   └── api.py             # FastAPI: /ask + chat UI
├── Dockerfile.server      # image for the MCP server
├── Dockerfile.agents      # image for the FastAPI agent service
├── docker-compose.yml     # local parity for the MCP server
├── render.yaml            # Render blueprint (MCP server)
├── requirements.txt
└── .env                   # OPENAI_API_KEY (gitignored, never committed)

Run locally

# 1. Install
python -m venv .venv
.venv\Scripts\activate          # Windows  (macOS/Linux: source .venv/bin/activate)
pip install -r requirements.txt fastapi uvicorn

# 2. Configure
#   .env → OPENAI_API_KEY=sk-...

# 3a. Start the MCP server (terminal 1)
python -m mcp_server.server                     # serves http://localhost:8000/mcp

# 3b. Start the agent API + chat UI (terminal 2)
#   defaults MCP_URL to http://localhost:8000/mcp
uvicorn agents.api:app --reload --port 8080     # open http://localhost:8080

Point the agents at a remote MCP server without any code change:

export MCP_URL="https://multi-agent-mcp.onrender.com/mcp"
uvicorn agents.api:app --port 8080

Deploy (Render)

Two Docker web services from this repo.

Service 1: MCP server

  • Dockerfile: Dockerfile.server
  • Health check path: /health
  • Env vars:
    • FOOTBALL_API_KEY = your football-data.org key (needed by the World Cup tools)

Service 2: Agent API + UI

  • Dockerfile: Dockerfile.agents
  • Env vars:
    • OPENAI_API_KEY = your OpenAI key
    • MCP_URL = https://multi-agent-mcp.onrender.com/mcp

Both read $PORT (injected by Render) and bind 0.0.0.0, so no port config is needed. render.yaml describes the MCP server as a blueprint.

Author

Jamalla Zawia - jamala.zawia@gmail.com

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选