transit-mcp
Provides Japanese public transit journey planning and station information tools that can be used inside ChatGPT through the Model Context Protocol Apps SDK.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@transit-mcpPlan a route from Shinjuku to Tokyo Station"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
transit-mcp
MCP server for Japanese public transit transfer / journey planning, with a map-based iframe UI rendered inside Claude and ChatGPT through the Model Context Protocol Apps SDK.
Built on Cloudflare Workers (Hono) + @modelcontextprotocol/sdk (Streamable
HTTP transport) + @modelcontextprotocol/ext-apps + React + MapLibre GL. It
wraps the public Transit API (api.transit.ls8h.com) behind the Cloudflare
Cache and exposes four tools to MCP clients.
Features
Four tools are exposed over MCP:
search_places— fuzzy place / station search by free-text query.plan_journey— point-to-point journey planning from free-textfrom/to. Returns a map-based iframe HTML resource with the route drawn over a MapLibre map.station_departures— upcoming departures for a station at a given time.station_detail— full detail of a single station (lines served, exits, etc.).
Only plan_journey returns an MCP UI resource (_meta.ui.resourceUri); the
other three return JSON only.
Related MCP server: norikae-mcp
Quick start (clients)
The server speaks the Streamable HTTP MCP transport. Once deployed it is
reachable at https://transit-mcp.tori-dev.com/mcp.
Claude Desktop
Edit your claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add a transit-mcp entry under mcpServers:
{
"mcpServers": {
"transit-mcp": {
"type": "http",
"url": "https://transit-mcp.tori-dev.com/mcp"
}
}
}Restart Claude Desktop. The four tools appear in the tool picker. Try:
「渋谷から東京駅までの経路を教えて」 →
plan_journeyruns and an interactive map iframe is embedded directly in the chat.「新宿駅の次の発車は?」 →
station_departuresreturns the next trains."Plan a route from Shibuya to Tokyo Station" → English summary, same map.
"What's the next train from Shinjuku?" →
station_departures.
If you self-host you can point at http://localhost:8787/mcp for local
development.
ChatGPT (Apps SDK)
The MCP Apps SDK in ChatGPT discovers servers by URL exactly like Claude Desktop:
Open ChatGPT settings → Apps & Connectors → Add MCP Server.
Enter the server URL:
https://transit-mcp.tori-dev.com/mcp.Choose transport: Streamable HTTP.
Approve the four tools when prompted.
The iframe HTML resource is served from /ui/plan on the same Worker and is
rendered inline in ChatGPT just like in Claude Desktop.
Custom GPT (Actions) fallback
If you need to register transit-mcp inside a Custom GPT before Apps SDK is available in your tier, wrap the tools as OpenAI Actions:
Create a Custom GPT in the ChatGPT builder.
Under Actions → Create new action, import an OpenAPI 3.1 schema that POSTs to
/mcpwith the standard MCP envelope. (A minimal example schema lives inexamples/openai-actions/— TODO for v0.2.)Note: Custom GPT Actions cannot render the
_meta.ui.resourceUriiframe; only the textual summary will be displayed.
For the richest experience, prefer the Apps SDK path.
Local development
pnpm install
pnpm dev # Wrangler dev server on http://localhost:8787
pnpm inspect # MCP Inspector against the local serverUseful scripts:
pnpm test/pnpm test:watch— Vitest (65 tests at time of writing)pnpm typecheck—tsc --noEmitpnpm lint/pnpm format— Biomepnpm build:ui— bundle the iframe UI with esbuildpnpm generate:types— regenerate Transit API types from its OpenAPI
To exercise tools locally with the MCP Inspector:
pnpm dev # terminal 1
pnpm inspect # terminal 2 → http://localhost:6274
# In the Inspector, click `connect`, then `tools/call`:
# { "name": "plan_journey", "arguments": { "from": "渋谷", "to": "東京" } }
# Copy the returned _meta.ui.resourceUri into a browser tab — the iframe HTML
# will render the route on a MapLibre map.Deployment
pnpm build:ui
pnpm dlx wrangler@latest deployPre-flight: the KV namespace UI_CACHE must exist before deploy.
pnpm dlx wrangler@latest kv namespace create UI_CACHE
# Copy the returned id into wrangler.toml under [[kv_namespaces]].A dry-run is also wired into CI for every PR:
pnpm dlx wrangler@latest deploy --dry-runConfiguration
Var | Where | Default |
|
|
|
|
| OpenFreeMap public style URL |
|
|
|
| KV binding | created per env ( |
| GitHub Actions secret | required by |
| GitHub Actions secret | required by |
Attribution
Required attribution is surfaced in the iframe footer:
Transit data: per-feed credits returned by
/api/v1/feedsand/api/v1/operators(cached in KV for 1 hour).Map tiles: © OpenStreetMap contributors, served via © OpenFreeMap.
Override MAP_STYLE_URL if you self-host MapTiler / Protomaps and want their
attribution shown instead — the iframe reads it from the worker env at render
time.
License
MIT.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for Japan geodata: cadastral lot numbers (chiban) and reverse geocoding, for AI agents.
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
MCP server for Travel & Transportation
Geo-based flight search MCP server. Find more flights between any two places on earth
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server that enables AI assistants to interact with the Netherlands Railways (NS) API for route planning, pricing, and real-time departure information. It provides tools for searching stations, planning trips with connections, and viewing real-time departure boards.31MIT
- AlicenseAqualityDmaintenanceMCP server for searching Japanese train routes using Yahoo! Transit data, enabling station-to-station route planning with optional via stations, time specifications, and fare options.117 npm29MIT
- AlicenseAqualityDmaintenanceA zero-authentication MCP server for Swiss public transport, enabling users to query train connections, disruptions, station facilities, and plan journeys using natural language.12MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for real-time German public transport data (HAFAS/VBN network). Enables querying departures, arrivals, journeys, and nearby stops using natural language.-