Skip to content
Justintunsday edited this page Sep 14, 2026 · 1 revision

MCP 服务

除了 HTTP API,本仓库仍内置原 MCP(stdio)服务,可在 Claude Code、Claude Desktop、 Cursor 等支持 MCP 的客户端中使用。

启动

npm install && npm run build
npm run start:mcp     # 等价于 node dist/index.js

在 Claude Code 中注册:

claude mcp add chelaile -- node /path/to/chelaile-api-server/dist/index.js

或编辑 ~/.claude/mcp_servers.json(项目级为 .mcp.json):

{
  "mcpServers": {
    "chelaile": {
      "command": "node",
      "args": ["/path/to/chelaile-api-server/dist/index.js"]
    }
  }
}

工具列表(15 个)

MCP 工具 对应 HTTP 端点
bus_list_cities GET /v1/cities
bus_get_city_config GET /v1/cities/config
bus_get_my_location GET /v1/my-location
bus_reverse_geocode GET /v1/reverse-geocode
bus_search GET /v1/search
bus_search_more GET /v1/search/more
bus_get_nearby_stops GET /v1/stops/nearby
bus_get_stop_detail GET /v1/stops/detail
bus_get_line_detail GET /v1/lines/detail
bus_get_line_route GET /v1/lines/route
bus_get_line_realtime GET /v1/lines/realtime
bus_list_line_buses GET /v1/lines/buses
bus_get_timetable GET /v1/lines/timetable
bus_refresh_lines GET /v1/lines/refresh
bus_plan_transit GET /v1/transit/plan

每个工具都支持 response_format: "markdown" | "json"(默认 markdown)。

提示:如果只是想在程序里调用数据,建议直接用 HTTP API(API-Reference), 比 MCP 更简单;MCP 适合接入大模型客户端。

Clone this wiki locally