
Store and retrieve entities, relations and observations in a persistent local knowledge graph.

An example project demonstrating MCP architecture with a math MCP server and a weather MCP server, and single-server and multi-server LangGraph clients.
LangGraph MCP Integration with Math and Weather Servers is cataloged as an MCP server attributed to commitbyrajat. An example project demonstrating MCP architecture with a math MCP server and a weather MCP server, and single-server and multi-server LangGraph clients. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for LangGraph MCP Integration with Math and Weather Servers are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
The Math server uses stdio transport, while the Weather server uses SSE transport.
It exposes add(a, b) and multiply(a, b) as available tools.
It connects to both the Math and Weather MCP servers and invokes tools from both in a single execution.
README.md · 45678b7e2ac2 · 采集于 2026-11-13 12:22:34 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
Modern AI-driven applications require efficient and scalable architectures to interact with multiple external services. The Multi-Client Protocol (MCP) provides a robust framework to communicate with various tool servers, enabling seamless interaction between AI models and external computations. In this blog, we'll explore the advantages of MCP architecture by comparing single-server and multi-server clients.
math_server.py)The Math Server acts as an MCP tool server that provides basic mathematical operations like addition and multiplication. It listens for incoming requests, processes tool invocations, and responds with results.
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Math")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
@mcp.tool()
def multiply(a: int, b: int) -> int:
"""Multiply two numbers"""
return a * b
if __name__ == "__main__":
mcp.run(transport="stdio")
add(a, b) and multiply(a, b) as available tools.A single-server client connects to one MCP server, which exposes a set of tools to be used in computations. Let's analyze the single_server_client.py script, which interacts with math_server.py to perform mathematical operations.
math_server.py runs as an MCP server exposing two tools: add(a, b) and multiply(a, b).add, multiply) from the server.GPT-4o, uses LangGraph’s ReAct (Reasoning + Acting) agent to decide how to solve the given mathematical expression.add(3,5) first, then multiply(8,12), and finally returns the computed answer.server_params = StdioServerParameters(
command="python",
args=["server/math_server.py"],
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await load_mcp_tools(session)
agent = create_react_agent(model, tools)
events = await agent.ainvoke({"messages": "what's (3 + 5) x 12?"})
The output prints:
----------------------------------------------------------------------------
The result is 96
sequenceDiagram
participant Client as Client Script
participant LangGraph as LangGraph React Agent
participant ClientSession as MCP ClientSession
participant stdio as stdio Transport Layer
participant MathServer as Math Server Process
participant Tools as Math Tools (add/multiply)
participant LLM as GPT-4o Model
Note over Client: Starts execution with asyncio.run()
Client->>MathServer: Launch as subprocess with stdio parameters
Client->>stdio: Create stdio client connection
stdio-->>Client: Return read/write streams
Client->>ClientSession: Initialize session
ClientSession->>stdio: Send initialize message
stdio->>MathServer: Forward initialize request
MathServer-->>stdio: Return server capabilities
stdio-->>ClientSession: Return initialization response
ClientSession-->>Client: Session initialized
Client->>ClientSession: load_mcp_tools()
ClientSession->>stdio: Request available tools
stdio->>MathServer: Forward tools request
MathServer->>Tools: Discover registered tools (add, multiply)
Tools-->>MathServer: Return tool descriptions
MathServer-->>stdio: Return tool descriptions
stdio-->>ClientSession: Return tool descriptions
ClientSession-->>Client: Return langchain-compatible tools
Client->>LangGraph: Create React agent with model and tools
LangGraph-->>Client: Return agent instance
Client->>LangGraph: agent.ainvoke("what's (3 + 5) x 12?")
LangGraph->>LLM: Generate reasoning and tool calls
Note over LLM: Decides to use add(3, 5) first
LLM-->>LangGraph: Return reasoning and add(3, 5) tool call
LangGraph->>ClientSession: Call add(3, 5)
ClientSession->>stdio: Send tool execution request
stdio->>MathServer: Forward tool execution request
MathServer->>Tools: Execute add(3, 5)
Tools-->>MathServer: Return result (8)
MathServer-->>stdio: Return tool execution result
stdio-->>ClientSession: Return tool execution result
ClientSession-->>LangGraph: Return add result (8)
LangGraph->>LLM: Generate next reasoning step with add result
Note over LLM: Decides to use multiply(8, 12) next
LLM-->>LangGraph: Return reasoning and multiply(8, 12) tool call
LangGraph->>ClientSession: Call multiply(8, 12)
ClientSession->>stdio: Send tool execution request
stdio->>MathServer: Forward tool execution request
MathServer->>Tools: Execute multiply(8, 12)
Tools-->>MathServer: Return result (96)
MathServer-->>stdio: Return tool execution result
stdio-->>ClientSession: Return tool execution result
ClientSession-->>LangGraph: Return multiply result (96)
LangGraph->>LLM: Generate final answer with all results
LLM-->>LangGraph: Return final answer "The result is 96"
LangGraph-->>Client: Return complete event trace and answer
Client->>Client: Print final answer
weather_server.py)The Weather Server is another MCP tool server that provides real-time weather information. It listens for incoming weather queries and responds with the latest weather data.
Command to start the server:
python server/weather_server.py
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Weather")
@mcp.tool()
async def get_weather(location: str) -> str:
"""Get weather for location."""
return "It's always sunny in New York"
if __name__ == "__main__":
mcp.run(transport="sse")
get_weather(location) as an available tool.A multi-server client can interact with multiple MCP servers simultaneously. The multi_server_client.py script demonstrates this by communicating with both math_server.py and weather_server.py.
stdio and the Weather server via SSE (Server-Sent Events).async with MultiServerMCPClient(
{
"math": {
"command": "python",
"args": ["server/math_server.py"],
"transport": "stdio",
},
"weather": {
"url": "http://localhost:8000/sse",
"transport": "sse",
},
}
) as client:
agent = create_react_agent(model, client.get_tools())
math_response = await agent.ainvoke({"messages": "what's (3 + 5) x 12?"})
weather_response = await agent.ainvoke({"messages": "what is the weather in nyc?"})
The output from the multi-server client looks like this:
{
"math_response": "The result of (3 + 5) x 12 is 96.",
"weather_response": "The weather in NYC is currently sunny."
}
stdio, sse, etc.).To clone and execute the code, follow these steps:
git clone https://github.com/commitbyrajat/langgraph-mcp-integration.git
cd langgraph-mcp-integration
rye sync # Sync dependencies
rye run python server/weather_server.py &
rye run python client/single_server_client.py
rye run python client/multi_server_client.py
MCP architecture enables developers to build powerful AI-driven applications that interact with multiple services efficiently. 🚀
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for LangGraph MCP Integration with Math and Weather Servers from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/langgraph-mcp-integration)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

Organize problem solving into revisable, branching thought steps through an MCP tool.

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.