参考文章:使用 Cooragent 构建多智能体旅游规划服务-CSDN博客https://blog.csdn.net/decipher_wang/article/details/148058602
1、AMAP(高德导航)
创建api_key即可
2、excel(Excel 文件操作)
在cmd中使用下面命令安装,可全局使用
python
npx -y @smithery/cli install @negokaz/excel-mcp-server --client claude
3、filesystem(文件系统操作)
**(1)**装MCP文件系统服务器
MCP文件系统服务器是官方提供的Node.js服务器,可以通过npm自动安装。不需要手动安装,只需要在配置文件中指定即可。
(2)修改MCP配置文件
我需要修改您项目中的 config/mcp.json 文件,添加filesystem服务器配置:
python
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"C:/Users/Administrator/Desktop/yiqihecheng/gitagent/cooragent-main/generated_projects"
]
}
(3)配置说明
新增的filesystem服务器配置解释:
- "filesystem": 服务器名称,您可以自定义
- "command": "npx": 使用npx命令来运行服务器
- "args": 参数数组
- "-y": 自动确认安装
- "@modelcontextprotocol/server-filesystem": 官方文件系统服务器包
- "/Users/a1/work/cooragent/generated_projects": 您指定的允许写入的目录
4、word(Word 文档操作)
(1)克隆仓库
python
cd cooragent/src/tools
git clone git@github.com:MeterLong/MCP-Doc.git
注意:这里使用的是SSH克隆方式,如果您没有配置SSH密钥,可以使用HTTPS方式:
cd cooragent/src/tools
git clone https://github.com/MeterLong/MCP-Doc.git
(2)安装Python依赖
进入克隆的项目目录并安装依赖:
python
cd MCP-Doc
pip install -r requirements.txt
(3)配置MCP服务
在您的 config/mcp.json 文件中添加word服务器配置。根据文章示例,需要在 args 中填入 server.py 的完整路径:
python
"word": {
"command": "python",
"args": ["C:/Users/Administrator/Desktop/yiqihecheng/gitagent/cooragent-main/src/tools/MCP-Doc/server.py"]
}
(4)完整的安装命令序列
基于您的工作目录,完整的安装步骤应该是:
python
# 进入tools目录
cd C:/Users/Administrator/Desktop/yiqihecheng/gitagent/cooragent-main/src/tools
# 克隆MCP-Doc项目
git clone https://github.com/MeterLong/MCP-Doc.git
# 进入项目目录
cd MCP-Doc
# 安装Python依赖(如果有requirements.txt的话)
pip install -r requirements.txt
# 或者安装常见的Word处理依赖
pip install python-docx fastapi uvicorn
(5)验证安装
可以通过以下方式验证安装是否成功:
python
# 测试server.py是否可以正常运行
python C:/Users/Administrator/Desktop/yiqihecheng/gitagent/cooragent-main/src/tools/MCP-Doc/server.py --help
完成这些步骤后,Word文档操作功能就应该可以在您的Cooragent系统中正常使用了。
5、Image Downloader MCP服务器安装步骤
(1)克隆项目
根据文章中的说明,首先需要克隆mcp-image-downloader项目:
python
cd cooragent/src/tools
git clone https://github.com/qpd-v/mcp-image-downloader.git
cd mcp-image-downloader
npm install
npm run build
(2)配置MCP服务
python
"image-downloader": {
"command": "node",
"args": ["C:/Users/Administrator/Desktop/yiqihecheng/gitagent/cooragent-main/src/tools/mcp-image-downloader/build/index.js"]
}
(3)验证安装
检查安装是否成功:
python
# 检查构建结果
ls "C:/Users/Administrator/Desktop/yiqihecheng/gitagent/cooragent-main/src/tools/mcp-image-downloader/build/" | Format-List
# 测试是否可以运行
node C:/Users/Administrator/Desktop/yiqihecheng/gitagent/cooragent-main/src/tools/mcp-image-downloader/build/index.js --help
6、构建旅游智能体
全部完成后,运行cli.py文件
python
python cli.py
然后:通过 cli 构建四个专用智能体,每个智能体均采用 agent_workflow
任务类型。
(1)交通规划智能体
python
run-l --debug --user-id test --task-type agent_workflow --message "创建交通规划智能体:根据行程或其他智能体输出,安排出发/到达时间、路线、票价等,输出详尽交通计划。"
(2)行程设计智能体
python
run-l --debug --user-id test --task-type agent_workflow --message "创建行程设计智能体:根据目的地和用户偏好,推荐景点、给出理由及照片 URL,并设计详细日程。"
(3)费用计算智能体
python
run-l --debug --user-id test --task-type agent_workflow --message "创建费用计算智能体:统计交通、住宿、门票、餐饮等所有花销,输出预算明细与总花费。"
(4)结果整合智能体
python
run-l --debug --user-id test --task-type agent_workflow --message "创建报告整合智能体:汇总上述三个智能体结果,生成含文字、表格、景点图片的 Word 文档,并保存本地。"
7、多智能体协同规划
python
run-l --debug --user-id test --task-type agent_workflow --message "我计划于 2025-05-22 至 2025-05-26,从上海出发前往北京游玩五天。请生成包含往返低价航班、食宿、景点推荐与预算等的详细旅游规划,最终以 Word 文档形式保存至桌面。"