L
Langgraph Multi MCP Server
作者 @upxill
langgraph-mcp-multi-client
创建于 2/25/2026
更新于 about 4 hours ago
README
Repository documentation and setup instructions
Multi-MCP Client
A sophisticated MCP (Model Context Protocol) client that connects to multiple MCP servers simultaneously and uses LangGraph with Claude to create an agentic workflow capable of using tools from all connected servers.
Overview
This client application demonstrates:
- Multiple Server Connections: Connects to both a math server (port 8000) and a weather server (port 8081)
- Unified Tool Access: Loads and aggregates tools from all connected MCP servers
- Agentic Workflow: Uses LangGraph to create a stateful agent that can intelligently choose which tools to use
- Claude Integration: Powered by Claude Sonnet 4.5 for language understanding and tool selection
Architecture
The application uses:
- LangChain MCP Adapters: Bridge between LangChain and MCP servers
- LangGraph: Agent framework with message state management and conditional routing
- Claude Sonnet 4.5: Language model for understanding user queries and selecting tools
- Streamable-HTTP: Transport protocol for MCP server communication
Prerequisites
- Python 3.13+
- Three MCP servers running:
- Math Server on
http://localhost:8000/mcp(provides: add, sub, mul, div) - Weather Server on
http://localhost:8081/mcp(provides: get_weather)
- Math Server on
Installation
uv sync
Running the Servers
Start each server in separate terminals:
Math Server
cd ../mcp-server
uv run main.py
Weather Server
cd ../mcp-weather
uv run main.py
Running the Client
uv run main.py
The client will:
- Connect to both MCP servers
- Load all available tools (math and weather)
- Execute sample queries using the agentic workflow
- Print responses from the agent
Sample Queries
The client runs two example queries:
- Math Query: "what's (3 + 5) x 12?" - Uses math tools to calculate
- Weather Query: "How is weather in Raleigh NC" - Uses weather tools to lookup weather
How It Works
- Tool Loading: The client connects to both servers and aggregates their tools
- Model Binding: Claude is bound with all available tools
- Graph Construction: A LangGraph state machine is created with:
call_model: Invokes Claude with toolsToolNode: Executes selected tools- Conditional edges: Routes between model and tool execution
- Agent Execution: User messages are processed through the graph, with Claude selecting appropriate tools
Dependencies
langchain-mcp-adapters: Bridge for MCP integrationlanggraph: Agent frameworklangchain-anthropic: Claude model integrationmcp: Model Context Protocol library
File Structure
multi-mcp/
├── main.py # Client application
├── pyproject.toml # Project configuration
└── README.md # This file
快速设置
此服务器的安装指南
安装包 (如果需要)
uvx langgraph-multi-mcp-server
Cursor 配置 (mcp.json)
{
"mcpServers": {
"upxill-langgraph-multi-mcp-server": {
"command": "uvx",
"args": [
"langgraph-multi-mcp-server"
]
}
}
}
作者服务器
其他服务器由 upxill