BVG MCP服务器
模型上下文协议(MCP)服务器,用于与BVG(柏林公共交通)API交互。该服务器提供搜索位置、计划行程、获取实时出发/到达等工具。
特性
此MCP服务器提供以下工具:
位置搜索
- bvg_locations_search:搜索站点、地址和兴趣点
- bvg_位置_附近:按坐标查找附近的站点和POI
停止信息
- bvg_stop_details:获取特定站点的详细信息
- bvg_stop_departs:在停靠站获取即将出发的航班
- bvg_stop_arrivals:在某个站点接收即将到来的航班
行程规划
- bvg_journey_plan:计划乘坐公共交通工具从A到B的行程
行程和车辆信息
- bvg_trip_details:获取特定旅行的详细信息
- bvg_radar:查找具有移动数据的地理区域中的车辆
安装
- 克隆存储库:
git clone
cd mcp-bvg- 安装依赖项:
npm install- 构建项目:
npm run build用法
作为MCP服务器
服务器通过stdio通信,可以与任何兼容MCP的客户端一起使用。
npm startClaude桌面配置
将此添加到您的Claude Desktop配置文件中(~/Library/Application Support/Claude/claude_desktop_config.json 在 macOS 上:
{
"mcpServers": {
"bvg-transport": {
"command": "node",
"args": ["/absolute/path/to/mcp-bvg/build/index.js"]
}
}
}VS代码配置
此项目包括VS代码配置文件 .vscode 目录:
- 任务:构建、监视、启动服务器和测试示例
- 启动配置:调试MCP服务器和示例
- 设置:TypeScript和编辑器首选项
- MCP配置:已准备好使用MCP服务器配置
要与VS代码一起使用:
- 在VS Code中打开项目文件夹
- 使用
Cmd+Shift+P→ “任务:运行任务”以访问构建任务 - 使用
F5调试MCP服务器 - MCP配置可在
.vscode/mcp-config.json
查询示例
以下是您可以进行的一些示例查询:
搜索地点
Search for "Alexanderplatz" in Berlin查找附近的站点
Find stops near coordinates 52.5200,13.4050 (Brandenburg Gate)获取出发信息
Get the next departures from Alexanderplatz station计划一次旅行
Plan a journey from Alexanderplatz to Potsdamer Platzapi参考
服务器使用BVG REST API v6:https://v6.bvg.transport.rest/api.html
发展
脚本
npm run build:将TypeScript编译为JavaScriptnpm run dev:观看模式用于开发npm start:启动MCP服务器npm test:运行示例测试npm run clean:清理生成目录
项目结构
src/
├── index.ts # Main MCP server
├── types/
│ └── bvg.ts # TypeScript types for BVG API
├── utils/
│ └── api.ts # HTTP client and utilities
└── tools/ # MCP tool implementations
├── locations.ts
├── nearby.ts
├── stops.ts
├── journeys.ts
└── additional.ts许可证
MIT许可证
MIT许可证
