Get the FREE Ultimate OpenClaw Setup Guide →

MCP-MultiServer-Interoperable-Agent2Agent-LangGraph-AI-System

This project demonstrates a decoupled real-time agent architecture that connects LangGraph agents to remote tools served by custom MCP (Modular Command Protocol) servers. The architecture enables a flexible and scalable multi-agent system where each tool can be hosted independently (via SSE or STDIO), offering modularity and cloud-deployable execut

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio junfanz1-mcp-multiserver-interoperable-agent2agent-langgraph-ai-system python math_server.py \
  --env PORT="N/A" \
  --env TRANSPORT="stdio"

How to use

This MCP-based setup demonstrates a real-time, decoupled agent system where LangGraph (a ReAct-style agent framework) coordinates tool execution across remote MCP servers. Tools such as a math calculator and a weather tool are exposed as independent MCP servers, using different transports (STDIO for direct process I/O and SSE for streaming server events). A LangGraph agent can concurrently invoke these tools via a MultiServerMCPClient, receiving asynchronous results that feed back into the agent’s reasoning loop. Users can extend this pattern by adding more tool servers and binding them 1:1 to the agent, enabling scalable, language-agnostic tool integration with real-time responsiveness. The included multiserver_client.py demonstrates how to register multiple tool endpoints (e.g., math and weather) and invoke them in parallel, while stdio_client.py shows a low-level STDIO-based workflow for a single server.

How to install

Prerequisites:

  • Python 3.8+ (or a compatible Python environment)
  • Git
  • Optional: virtual environment tool (venv/conda)
  1. Clone the repository: git clone https://github.com/your-org/junfanz1-mcp-multiserver-interoperable-agent2agent-langgraph-ai-system.git cd junfanz1-mcp-multiserver-interoperable-agent2agent-langgraph-ai-system

  2. Set up a Python environment: python -m venv venv source venv/bin/activate # on Unix/macOS .\venv\Scripts\activate # on Windows

  3. Install dependencies (example; adapt if a requirements file exists): pip install -r requirements.txt

  4. Start the tool servers (in separate terminals or as background processes):

    STDIO-based math server

    python servers/math_server.py

    SSE-based weather server (if it uses a separate process/port, ensure it is running and accessible)

    python servers/weather_server.py

  5. Run the client that talks to multiple servers:

    From project root

    python client/multiserver_client.py

Notes:

  • If you modify transports or add new servers, update the mcp_config accordingly.
  • Ensure network access and proper ports/firewall settings for SSE-based servers.

Additional notes

Tips and caveats:

  • Transport handling: Some servers use STDIO (direct process I/O) while others use SSE (streaming over HTTP). Ensure the corresponding client side configuration matches the server transport.
  • Handshake and tool discovery: The ClientSession and tool-loading utilities rely on MCP handshake conventions. If you add new tools, ensure they are discoverable by the client and expose the expected tool signatures.
  • Async orchestration: All tool calls are designed to be non-blocking. For best performance, run multiple tool invocations concurrently and handle partial results gracefully.
  • Environment management: Use virtual environments to isolate dependencies. Pin package versions to avoid breaking changes across updates.
  • Deployment: In production, consider containerizing each tool server (e.g., Docker) and orchestrating them with Docker Compose or Kubernetes for resilience and scalability.

Related MCP Servers

Sponsor this space

Reach thousands of developers