旅行规划器 MCP 服务端
通过与Google Maps和旅行规划服务交互,使大型语言模型能够执行与旅行相关的任务,包括地点搜索、地点详情和旅行时间计算。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"travel-planner": {
"args": [
"path/to/dist/index.js"
],
"command": "node",
"env": {
"GOOGLE_MAPS_API_KEY": "your_google_maps_api_key"
}
}
}
}
该服务需要配置环境变量:GOOGLE_MAPS_API_KEY
可用工具 (5 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
create_itinerary 6 个参数 需填 4 项
Creates a personalized travel itinerary based on user preferences
必填参数:origin、destination、startDate、endDate
optimize_itinerary 2 个参数 需填 2 项
Optimizes an existing itinerary based on specified criteria
必填参数:itineraryId、optimizationCriteria
search_attractions 3 个参数 需填 1 项
Searches for attractions and points of interest in a specified location
必填参数:location
get_transport_options 3 个参数 需填 3 项
Retrieves available transportation options between two points
必填参数:origin、destination、date
get_accommodations 4 个参数 需填 3 项
Searches for accommodation options in a specified location
必填参数:location、checkIn、checkOut
服务介绍
旅行规划 MCP 服务器 (@gongrzhe/server-travelplanner-mcp)
这是一个用于与 Google 地图和旅行规划服务交互的旅行规划模型上下文协议 (MCP) 服务器实现。该服务器使 LLM 能够执行与旅行相关的任务,如地点搜索、地点详情查询和旅行时间计算。
安装与使用
通过 Smithery 安装
要通过 Smithery 自动为 Claude Desktop 安装旅行规划器:
npx -y @smithery/cli install @GongRzhe/TRAVEL-PLANNER-MCP-Server --client claude
手动安装
# Using npx (recommended)
npx @gongrzhe/server-travelplanner-mcp
# With environment variable for Google Maps API
GOOGLE_MAPS_API_KEY=your_api_key npx @gongrzhe/server-travelplanner-mcp
或者全局安装:
# Install globally
npm install -g @gongrzhe/server-travelplanner-mcp
# Run after global installation
GOOGLE_MAPS_API_KEY=your_api_key @gongrzhe/server-travelplanner-mcp
组件
工具
-
searchPlaces
- 使用 Google Places API 搜索地点
- 输入:
query(字符串): 地点搜索查询location(可选): 用于偏置结果的纬度和经度radius(可选): 搜索半径(米)
-
getPlaceDetails
- 获取特定地点的详细信息
- 输入:
placeId(字符串): 用于检索详情的 Google Place ID
-
calculateRoute
- 计算两个地点之间的路线
- 输入:
origin(字符串): 出发地destination(字符串): 目的地mode(可选): 旅行模式(驾车、步行、骑自行车、公共交通)
-
getTimeZone
- 获取地点的时区信息
- 输入:
location: 纬度和经度坐标timestamp(可选): 用于时区计算的时间戳
配置
与 Claude Desktop 一起使用
要将此服务器与 Claude Desktop 应用程序一起使用,请在您的 claude_desktop_config.json 文件的 "mcpServers" 部分添加以下配置:
{
"mcpServers": {
"travel-planner": {
"command": "npx",
"args": ["@gongrzhe/server-travelplanner-mcp"],
"env": {
"GOOGLE_MAPS_API_KEY": "your_google_maps_api_key"
}
}
}
}
或者,如果您已安装了包,可以直接使用节点命令:
{
"mcpServers": {
"travel-planner": {
"command": "node",
"args": ["path/to/dist/index.js"],
"env": {
"GOOGLE_MAPS_API_KEY": "your_google_maps_api_key"
}
}
}
}
开发
从源代码构建
- 克隆仓库
- 安装依赖项:
npm install - 构建项目:
npm run build
环境变量
GOOGLE_MAPS_API_KEY(必需): 您的 Google 地图 API 密钥,并启用以下 API:- Places API
- Directions API
- Geocoding API
- Time Zone API
许可证
此 MCP 服务器采用 MIT 许可证。有关更多详细信息,请参阅项目存储库中的 LICENSE 文件。