OJP 2.0 journey planning, SIRI-SX disruptions, occupancy, fares, train formation
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
π¨π Part of the Swiss Public Data MCP Portfolio
MCP server connecting AI models to the Swiss public transport system β journey planning, real-time departures, disruptions, occupancy, ticket prices, train formations and open data from opentransportdata.swiss.
swiss-transport-mcp gives AI assistants like Claude a complete Swiss travel information system β not just timetables, but also real-time disruption alerts, occupancy forecasts, ticket prices, and a full train formation view. All accessible through a single, standardised MCP interface.
The various APIs at opentransportdata.swiss speak different protocols β OJP 2.0 (XML/SOAP), SIRI-SX (XML), REST/JSON. This server translates everything into clean JSON for the AI model, acting as a multilingual protocol interpreter.
Anchor demo query: "Plan a school trip for 25 students from Zurich to the Technorama in Winterthur β check for disruptions and find the best departure." β More use cases by audience β
Or with uvx (no permanent installation):
Try it immediately in Claude Desktop:
"What are the next departures from Zurich Stadelhofen?" "How do I get from WΓ€denswil to Bern by train?"
| Variable | API | Required |
|---|---|---|
TRANSPORT_API_KEY | Unified key for OJP + CKAN | β (or individual keys) |
TRANSPORT_OJP_API_KEY | OJP 2.0 Journey Planner | Optional (override) |
TRANSPORT_CKAN_API_KEY | CKAN data catalogue | Optional (separate subscription) |
SIRI_SX_API_KEY | Disruption alerts (SIRI-SX) | Optional |
OCCUPANCY_API_KEY | Occupancy forecast | Optional |
FORMATION_API_KEY | Train formation | Optional |
OJP_FARE_API_KEY | Ticket prices (OJP Fare) | Optional |
APIs without a key are silently disabled β the server starts fine with just the 6 core tools.
Operational / security variables:
| Variable | Effect | Default |
|---|---|---|
MCP_ENV / ENV | Process environment. Must be dev/development/local/test to allow disabling TLS verification. | (unset β production) |
TRANSPORT_SSL_VERIFY | Set to false to disable TLS certificate verification. Honoured only when MCP_ENV marks a dev environment β otherwise the request is ignored and verification stays on. | true |
TRANSPORT_CKAN_URL | Override the CKAN base URL. Must stay on the egress allow-list (*.opentransportdata.swiss); off-site overrides are refused. | https://api.opentransportdata.swiss/ckan-api |
MCP_CORS_ORIGINS | Comma-separated list of browser origins allowed to call the HTTP transport. Use * to allow any origin (not recommended). The Mcp-Session-Id header is exposed to these origins. | https://claude.ai |
LOG_FORMAT | json for structured logs (RFC 5424 severity); anything else for human-readable text. Always written to stderr. | text |
OTEL_TRACES_ENABLED | 1 to enable OpenTelemetry tracing (requires the otel extra: pip install 'swiss-transport-mcp[otel]'). No-op otherwise. | (off) |
MCP_STATELESS | 1 to run the Streamable HTTP transport statelessly β no server-side session state, so instances need no sticky load balancing. Recommended for horizontal scale-out. | (off β stateful) |
MCP_ALLOWED_HOSTS | Comma-separated list of the names this server is reachable under, port included where it matters (e.g. fahrplan.example.ch:8080). Requests arriving under any other Host are rejected with 421; loopback stays allowed so container health checks keep working. Unset on a non-loopback bind, the check is off and a warning is logged. | (unset β off) |
π Egress allow-list: all outbound requests are restricted to
https://onopentransportdata.swisshosts. Any other host is refused before a request is sent (SSRF / egress hardening).
Minimal (core tools only):
Full (all 11 tools):
Config file locations:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonFor use via claude.ai in the browser (e.g. on managed workstations without local software). The cloud transport is Streamable HTTP (MCP_TRANSPORT=streamable-http, endpoint /mcp). SSE (/sse) is still supported but deprecated.
MCP_TRANSPORT | Use | Endpoint |
|---|---|---|
stdio (default) | Local Claude Desktop subprocess | β |
streamable-http (or http) | Cloud / container (recommended) | /mcp |
sse | Legacy browser transport (deprecated) | /sse |
Docker (recommended):
The image is a multi-stage build running as a non-root user; docker-compose.yml adds read_only, no-new-privileges and memory/CPU/PID limits.
Render.com:
MCP_TRANSPORT=streamable-http and MCP_HOST=0.0.0.0https://your-app.onrender.com/mcpπ‘ "stdio for the developer laptop, Streamable HTTP for the cloud."
Scaling horizontally: run with MCP_STATELESS=1. In stateless mode the
server keeps no per-session state, so any instance can serve any request and a
plain round-robin load balancer suffices β no sticky sessions / Mcp-Session-Id
affinity required. If you need stateful streaming instead, route by
Mcp-Session-Id at the edge LB (e.g. HAProxy stick-tables) so each session
stays pinned to one instance.
β οΈ Binding: In a network transport the server binds to
127.0.0.1by default so a locally started server is not exposed to your whole network (e.g. public Wi-Fi). SetMCP_HOST=0.0.0.0only in a container/cloud environment where binding to all interfaces is intended (the Docker image does this for you).
| Tool | Description | Data Source |
|---|---|---|
transport_search_stop | Search stops/stations by name | OJP 2.0 |
transport_nearby_stops | Find nearby stops by coordinates | OJP 2.0 |
transport_departures | Real-time departure board with delays & platforms | OJP 2.0 |
transport_trip_plan | Plan journey A β B with transfers, duration, mode | OJP 2.0 |
transport_search_datasets | Search open data catalogue (~90 datasets) | CKANΒΉ |
transport_get_dataset | Get full details of a specific dataset | CKANΒΉ |
ΒΉ CKAN tools require a separate subscription in the API Manager.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/swiss-transport-mcp)<a href="https://allmcps.com/mcp/swiss-transport-mcp"><img src="https://allmcps.com/api/badge/swiss-transport-mcp?style=directory" alt="Swiss Transport MCP on AllMCPs" /></a>