Multi-Agent Research Assistant MCP Server
多智能体研究助手与 MCP 服务器
本项目分两个小部分实现该任务:
一个 LangGraph 多智能体工作流,包含一个 Supervisor(主管)和两个专家 worker(工作智能体)。
一个 FastMCP 服务器,包含两个工具,以及一个调用这些工具的客户端。
语言模型使用 Ollama,因此无需 OpenAI API 密钥。
1. 项目演示内容
Supervisor 接收问题并选择合适的 worker:
User question
|
v
Supervisor Agent
|------------------------------|
v v
Research Agent Analysis Agent
| |
v v
Knowledge-base tool Comparison tool对于需要两个 worker 协作的问题,Supervisor 会先让 Research Agent(研究智能体)提供证据,再将证据交给 Analysis Agent(分析智能体)。
MCP 部分与 LangGraph 部分相互独立:
MCP Client ---> FastMCP Server
|------ get_weather(city)
|------ get_news(topic)Related MCP server: AIE8-MCP Server
2. 前置条件
Windows PowerShell
Python 3.10 或更高版本
Ollama
一个 Ollama 模型,例如
llama3.2
仓库中已包含所需的虚拟环境,位于 multivenv。
3. 安装
在项目目录中打开 PowerShell:
cd D:\LLMEngg_8-Multi-Agent-Research-Assistant-MCP-Server
.\multivenv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
Copy-Item .env.example .env如果 PowerShell 不允许激活虚拟环境,请直接对每条命令使用虚拟环境:
.\multivenv\Scripts\python.exe -m pip install -r requirements.txt不要使用其他系统 Python,否则可能会缺少 langchain_core 等导入模块。
4. 配置 Ollama
在单独的终端中启动 Ollama。如果 Ollama 已作为桌面应用在运行,可跳过 ollama serve。
ollama serve
ollama pull llama3.2.env 中的默认配置为:
OLLAMA_MODEL=llama3.2
OLLAMA_BASE_URL=http://localhost:11434您可以使用其他模型,但该模型必须足够好地支持聊天和工具调用,以满足 LangGraph 的需求。例如:
OLLAMA_MODEL=qwen2.5:7b5. 运行多智能体助手
运行一个仅涉及研究的提问:
python main.py "What does MCP do?"这应路由到 Research Agent,它会搜索 data/knowledge_base.txt。
运行一个仅涉及分析的提问:
python main.py "Compare these two ideas: solar power uses sunlight; wind power uses moving air."这应路由到 Analysis Agent,它会使用 compare_texts。
运行一个需要协作的提问:
python main.py "Research solar and wind power, then compare their main trade-offs."该问题需要两个 worker 协作。预期工作流程为:
Supervisor 调用
ask_research_agent。Research Agent 调用
search_knowledge_base。Supervisor 将证据发送给
ask_analysis_agent。Analysis Agent 调用
compare_texts。Supervisor 返回一个最终答案。
也可以不带参数直接运行默认问题:
python main.py6. 运行 MCP 演示
客户端会调用两个 FastMCP 工具:
python -m mcp_client.client预期输出类似于:
Weather: Cloudy, 15 C
News: Mock headline: New developments in artificial intelligence are being monitored by the research team.客户端使用 FastMCP 的进程内客户端传输方式,因此该演示可靠且易于在本地运行。它仍然使用真实的 MCP 客户端/服务器协议。也可以为兼容 MCP 的主机启动独立服务器:
python mcp_server/server.py该独立服务器使用 MCP stdio 传输方式。
7. 运行测试
python -m pytest -q测试覆盖确定性工具,无需 Ollama 或模型下载。也可以在不发起模型请求的情况下检查 LangGraph 的构建:
$env:OLLAMA_MODEL = "llama3.2"
python -c "from agents.supervisor import build_supervisor; build_supervisor(); print('Supervisor created')"8. 文件结构
agents/
model.py Shared ChatOllama configuration
research_agent.py Research worker created with create_react_agent
analysis_agent.py Analysis worker created with create_react_agent
supervisor.py Supervisor and wrapped worker tools
tools/
research_tool.py Local knowledge-base lookup tool
analysis_tool.py Structured two-text comparison tool
data/
knowledge_base.txt Local evidence used by the Research Agent
mcp_server/
server.py FastMCP server and its two tools
mcp_client/
client.py Client demonstration calling both MCP tools
main.py Command-line entry point for the Supervisor
tests/ Deterministic tool tests
requirements.txt Python dependencies
.env.example Ollama configuration template9. 任务目标对照表
任务目标 | 实现方式 |
构建 Supervisor 智能体 |
|
使用 |
|
使用 |
|
为 Research Agent 提供信息检索工具 |
|
为 Analysis Agent 提供两段文本比较工具 |
|
将 worker 包装为 Supervisor 的工具 |
|
添加角色专属系统提示 | 每个智能体模块定义自己的提示 |
构建包含至少两个工具的 MCP 服务器 |
|
演示 MCP 客户端调用工具 |
|
测试研究、分析和协作场景 | 第 5 节中的命令 |
10. 故障排查
No module named langchain_core
当前使用的是系统 Python。请激活 multivenv,或直接使用虚拟环境的解释器路径:
.\multivenv\Scripts\python.exe main.py "What does MCP do?"Ollama 返回 connection refused
请启动 Ollama 并确认模型存在:
ollama serve
ollama list
ollama pull llama3.2模型未调用工具
请使用支持工具调用的聊天模型,保持问题表述明确,并尝试第 5 节中的协作示例。小型或较旧的模型可能会直接作答而不使用工具。
知识库未返回答案
Research Agent 仅搜索本地文件。请向 data/knowledge_base.txt 中添加更多段落,然后重新运行问题。
11. 重要范围说明
这是一个简单的教学实现。知识库是模拟的本地数据源,天气和新闻是模拟的 MCP 结果,LLM 路由通过 Ollama 手动测试。确定性工具由自动化测试覆盖。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBqualityDmaintenanceA FastMCP server providing real-time weather, news retrieval, and local note management tools for autonomous CrewAI agents. It enables context-aware multi-agent workflows with observability and high-speed inference integration.4
- FlicenseBqualityDmaintenanceAn MCP server that provides web search capabilities through the Tavily API and weather data retrieval tools. It demonstrates how to integrate external APIs into AI applications and build agentic workflows with LangGraph.3
- Flicense-qualityDmaintenanceAn MCP server that provides weather and web search tools, orchestrated by a LangGraph agent with OpenAI for natural language interaction.8
- Flicense-qualityCmaintenanceAn MCP server with six tools including web search, URL fetching, math calculation, and note management. Designed for a live-coding demo integrating FastMCP with LangGraph ReAct agents.8
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ANINDASAU/LLMEngg_8-Multi-Agent-Research-Assistant-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server