旅游规划智能体 MCP Server
这是一个基于 MCP (Model Context Protocol) 的旅游规划智能体,提供旅游相关的工具和资源。
🎯 功能特性
工具 (Tools)
- calculate_trip_budget - 计算旅行预算
- suggest_attractions - 推荐景点
- create_itinerary - 生成旅行行程
- check_weather_suggestion - 查询最佳旅行时间
- pack_checklist - 生成打包清单
资源 (Resources)
- destination://{city} - 获取目的地信息
- travel-tips://{category} - 获取旅行小贴士
提示 (Prompts)
- plan_trip_prompt - 生成旅行规划提示词
- emergency_help_prompt - 紧急情况帮助
📦 安装方式
方式 1: 从本地安装(开发测试)
# 在项目目录下
uv pip install -e .
方式 2: 发布到 PyPI 后安装
# 构建包
uv build
# 发布到 PyPI (需要 PyPI 账号)
uv publish
# 其他人可以通过 uvx 直接使用
uvx travel-planning-mcp
🚀 使用方式
1. 在 Langflow 中使用
在 Langflow 的 MCP 配置文件中添加:
{
"mcpServers": {
"travel-planning": {
"command": "uvx",
"args": ["travel-planning-mcp"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
或者如果是本地开发版本:
{
"mcpServers": {
"travel-planning": {
"command": "python",
"args": ["-m", "travel_planning_mcp.server"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
2. 在 Kiro 中使用
在 .kiro/settings/mcp.json 中添加相同配置。
3. 命令行测试
# 直接运行
python -m travel_planning_mcp.server
# 或使用 uvx (如果已发布)
uvx travel-planning-mcp
4. Web 界面使用
# 启动 Web 界面(直接调用版)
python web_direct.py
# 访问 http://127.0.0.1:5000
🧪 测试
# 测试工具函数
python simple_test.py
# 测试 MCP 连接
python test_server.py
📝 工具使用示例
计算旅行预算
{
"destination": "北京",
"days": 5,
"accommodation_level": "中档",
"include_flights": true
}
推荐景点
{
"city": "成都",
"interests": "美食",
"days": 3
}
生成行程
{
"destination": "上海",
"start_date": "2026-02-01",
"days": 3,
"pace": "轻松"
}
🔧 开发
项目结构
mcp_Server/
├── travel_planning_mcp/ # MCP Server 包
│ ├── __init__.py
│ └── server.py # 主服务器代码
├── templates/ # Web 界面模板
├── web_direct.py # Web 服务(直接调用)
├── web_client.py # Web 服务(MCP 协议)
├── simple_test.py # 简单测试
├── test_server.py # MCP 连接测试
├── pyproject.toml # 项目配置
└── README.md
添加新工具
在 travel_planning_mcp/server.py 中:
@mcp.tool()
def your_new_tool(param1: str, param2: int) -> str:
"""工具描述"""
# 实现逻辑
return result
📄 许可证
MIT License
🤝 贡献
欢迎提交 Issue 和 Pull Request!
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
travel_planning_mcp-0.1.0.tar.gz
(65.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file travel_planning_mcp-0.1.0.tar.gz.
File metadata
- Download URL: travel_planning_mcp-0.1.0.tar.gz
- Upload date:
- Size: 65.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4aa6e4431d5f839c065605c77815e851516d352d254e8c930d16448691095c8
|
|
| MD5 |
2dff321fcf7d9d1dfe3c65cebe6e71c8
|
|
| BLAKE2b-256 |
0490b2e02f9b96492fba0738f409fef076ab79445c3d6268f560e66f81889a51
|
File details
Details for the file travel_planning_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: travel_planning_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e1a4aacdaa7754e142594cb36279ff4c46c605a9a036b1a1ad78ae697d7ed96
|
|
| MD5 |
517ee254673448040e3954224ae0bd2c
|
|
| BLAKE2b-256 |
84dd3117128e0a91d160f727ab52ec7c246cce873852fc41f521c76357558f99
|