使用说明
sbbmcp
一 主控程序 服务器 瑞士公共交通API.通过任何兼容MCP的客户端查询车站、连接和实时出发板。
部署在Vercel上:
https://sbbmcp.vercel.app/mcp
特性
- 车站搜索 --按名称或GPS坐标查找车站、地址和兴趣点
- 连接搜索 --使用日期、时间、运输类型和途经站点的过滤器查找两个地点之间的路线
- 站牌 --获取实时出发和到达板上的延误信息
- LLM优化输出 --结构化、可读的文本,而不是原始JSON
连接到远程服务器
克劳德代码
claude mcp add --transport http swiss-transport https://sbbmcp.vercel.app/mcp
添加 --scope user 对于所有项目:
claude mcp add --transport http --scope user swiss-transport https://sbbmcp.vercel.app/mcp
克劳德桌面
增添 claude_desktop_config.json:
{
"mcpServers": {
"swiss-transport": {
"url": "https://sbbmcp.vercel.app/mcp"
}
}
}
Claude.ai
- 首选 设置>集成
- 点击 添加集成>MCP服务器
- 输入URL:
https://sbbmcp.vercel.app/mcp
光标
增添 .cursor/mcp.json:
{
"mcpServers": {
"swiss-transport": {
"url": "https://sbbmcp.vercel.app/mcp"
}
}
}
其他客户
任何客户支持 可流式HTTP传输 可以连接到 https://sbbmcp.vercel.app/mcp.
本地运行(stdio)
对于无需远程服务器的Claude Desktop或Claude Code本地使用:
git clone https://github.com/xadcv/sbbmcp.git
cd sbbmcp
npm install
npm run build
然后通过stdio注册:
claude mcp add swiss-transport node /absolute/path/to/sbbmcp/dist/index.js
或者用于没有建筑的开发:
npm run dev
工具
三个工具包裹 交通.万达.ch API端点。
search_locations
查找瑞士公共交通车站、地址和景点。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
query |
string |
否* | 地点名称 |
x |
number |
无* | 纬度(WGS84) |
y |
number |
无* | 经度(WGS84) |
type |
string |
没有 | all, station, poi, address (默认值: all) |
*要么 query 或两者 x 和 y 必须提供。
search_connections
找出两个位置之间的联系。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
from |
string |
是 | 出发站名称或ID |
to |
string |
是 | 到达站名称或ID |
via |
string[] |
否 | 最多5个中间站 |
date |
string |
否 | 旅行日期(YYYY-MM-DD) |
time |
string |
否 | 旅行时间(HH:mm) |
isArrivalTime |
boolean |
否 | 将时间视为到达(默认值: false) |
transportations |
string[] |
没有 | train, tram, ship, bus, cableway |
limit |
number |
否 | 结果1-6(默认值:4) |
page |
number |
否 | 分页0-10(默认值:0) |
get_stationboard
获取车站的出发或到达信息。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
station |
string |
否* | 车站名称 |
id |
string |
否* | 站点ID(优先) |
limit |
number |
否 | 最大条目数1-420(默认值:20) |
transportations |
string[] |
没有 | train, tram, ship, bus, cableway |
datetime |
string |
否 | 日期和时间(YYYY-MM-DD HH:mm) |
type |
string |
没有 | departure 或 arrival (默认值: departure) |
*要么 station 或 id 必须提供。
项目结构
sbbmcp/
├── api/
│ └── mcp.ts # Vercel serverless function (Streamable HTTP)
├── src/
│ ├── index.ts # Local stdio entry point
│ ├── tools.ts # Shared tool registration and formatters
│ ├── api.ts # HTTP client for transport.opendata.ch
│ └── types.ts # TypeScript interfaces for API responses
├── vercel.json # Vercel routing and function config
├── tsconfig.json
└── package.json
部署
推送到GitHub并在 Vercel仪表板The api/mcp.ts 无服务器功能会自动启动。
为了获得最佳性能,启用 流体计算 在Vercel项目设置中。
API注释
- 费率限制: 3个请求/秒/IP在transport.opendata.ch上
- 不需要API密钥 -上游API是免费开放的
- 新闻报道: SBB/CFF/FFS、邮政巴士、当地交通、船只和索道
许可证
国际学生委员会
