MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

L
Langgraph Multi MCP Server
作者 @upxill

langgraph-mcp-multi-client

创建于 2/25/2026
更新于 about 4 hours ago
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)

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:

  1. Connect to both MCP servers
  2. Load all available tools (math and weather)
  3. Execute sample queries using the agentic workflow
  4. 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

  1. Tool Loading: The client connects to both servers and aggregates their tools
  2. Model Binding: Claude is bound with all available tools
  3. Graph Construction: A LangGraph state machine is created with:
    • call_model: Invokes Claude with tools
    • ToolNode: Executes selected tools
    • Conditional edges: Routes between model and tool execution
  4. Agent Execution: User messages are processed through the graph, with Claude selecting appropriate tools

Dependencies

  • langchain-mcp-adapters: Bridge for MCP integration
  • langgraph: Agent framework
  • langchain-anthropic: Claude model integration
  • mcp: 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" ] } } }