Connecting a LangGraph Agent to Two FastMCP Servers
In the author’s implementation, one LangGraph Agent was connected through LangChain’s MCPAdapter to two independent FastMCP services. The yun120 service exposed 15 tools for local MySQL queries, statistics and charts, while demo1 provided flip_coin and make_decision. In multi-server stdio mode, MCPAdapter prefixed each tool with its server name, making tool names hard-coded in the system prompt unavailable. The author removed the default_ prefix from the yun120 tools, retained demo1 prefixes to avoid collisions and reported that the agent successfully called demo1_flip_coin. The planned production setup using multiple persistently hosted HTTP servers was not completed.
The report documents a practical multi-server stdio integration and a tool-name compatibility issue developers may encounter when combining tools from multiple MCP servers.
一、背景:为什么要接多个 MCP?
我的 LangGraph Agent 已经跑通了一个 FastMCP 服务(叫 yun120),专门查本地 MySQL,提供 15 个工具:站点访问量统计、柱状图/折线图渲染、音乐/简历/文章/RBAC 查询等。
现在我又新建了一个独立的 FastMCP 项目(叫 demo1),里面只有两个搞笑工具:flip_coin(抛硬币)和 make_decision(从多个选项里随机挑一个,治疗选择困难症)。
这两个项目是完全独立的:
yun120: Python 3.14,和 LangGraph Agent 共用同一个 venv
demo1: Python 3.12,自己独立的 venv