swiss-rail-mcp
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., "@swiss-rail-mcp When's the next train from Bern to Zürich HB?"
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.
swiss-rail-mcp
A zero-auth MCP server for Swiss public transport. Wraps
transport.opendata.ch and
data.sbb.ch into a single MCP server with
12 tools, 3 resources, and 4 prompts.
What it does
Lets an MCP client (Claude Desktop, Claude Code, …) answer real Swiss transport questions without an API key:
"When's the next train from Regensdorf to Zürich HB?"
"What's the last realistic train home from Bern tonight?"
"Any disruptions on the Gotthard line?"
"Does Lugano have step-free access and WiFi?"
Communication is stdio only. No keys, no accounts, no rate-limited proxy — just two public, unauthenticated upstream APIs.
Related MCP server: swiss-public-transport-mcp
Install
Run on demand without installing globally:
uvx swiss-rail-mcpOr install it as a persistent uv tool:
uv tool install swiss-rail-mcpBoth options pull from PyPI and expose the swiss-rail-mcp console
script. Requires Python 3.11+.
Use with Claude Desktop
Add the server to your claude_desktop_config.json:
{
"mcpServers": {
"swiss-rail": {
"command": "uvx",
"args": ["swiss-rail-mcp"]
}
}
}Restart Claude Desktop. The tools, resources, and /swiss-rail:*
slash-commands should appear in the picker.
Use with Claude Code
claude mcp add swiss-rail -- uvx swiss-rail-mcpTools
Core (timetable, via transport.opendata.ch)
Tool | Purpose |
| Resolve a place name to canonical stations. |
| Connections between two stations. |
| Next departures from a station. |
SBB open data (via data.sbb.ch)
Tool | Purpose |
| Active rail-traffic disruptions, optionally filtered. |
| Elevator, WiFi, step-free access, waiting room. |
| Most recent average daily passenger count. |
Conversational (compose the above)
Tool | Purpose |
| Latest realistic train tonight. |
| Outbound options plus latest safe return. |
| Next connections + disruption verdict for a daily commute. |
| Two-leg journey with a deliberate stop. |
| Connections annotated with endpoint accessibility. |
| Connections annotated with a per-leg bike-allowed heuristic. |
All datetimes returned by the tools are ISO 8601 with a Europe/Zurich offset.
Resources
Read-only URIs the client can fetch. Useful for letting the LLM pull formatted markdown views of live data without a tool call.
URI | Returns |
| Markdown list of all active disruptions. |
| Markdown table of the next departures. |
| Markdown summary of facilities + frequency. |
Prompts
Slash-commands in Claude Desktop (/swiss-rail:<name>) and
callable prompts in other MCP clients.
Prompt | Use case |
| Day-trip planner with disruption check. |
| Quick sanity-check before leaving the house. |
| "What's the last train home?" from where you are. |
| Plan a night out with a safe return. |
Example sessions
Real responses from Claude with this MCP server wired up, captured via
claude -p --mcp-config … against the live upstream APIs. Reproduce with
the snippet at the bottom of this section.
Q: When's the next train from Bern to Zürich HB?
A: Next IR from Bern at 03:00, arriving Zürich HB at 04:11 (direct, 71 min, platform 5).
Q: When's the last realistic train home from Bern to Regensdorf tonight?
A: Your last realistic option is the IC at 23:02 from Bern (platform 6) → Zürich HB 00:16 → SN to Regensdorf-Watt, arriving 00:49. After that you're into Nachtnetz SN trains (last one departs Bern 01:06, arrives 02:49) which usually carry a night surcharge.
Q: Are there any active disruptions on the Swiss rail network right now? Give me just the headline count and the most severe one.
A: 10 active events on the feed. The most severe is a critical interruption on the Basel Bad Bf–Freiburg line between Haltingen and Efringen-Kirchen (accident involving a person), affecting ICE, ECE, EC, NJ, RE 7 and RB 27 — service has since resumed but residual delays/cancellations are possible through 05:00.
Q: Does Zürich HB have step-free access and WiFi?
A: Yes — Zürich HB has both step-free access and WiFi (elevators are also available).
Q: How busy is Lugano station compared to Bern?
A: Bern is much busier, averaging ~177,000 daily passengers in 2025 versus ~32,300 at Lugano — roughly 5.5× the foot traffic.
Q: I'm in Bern and want to grab a coffee in Olten for 30 minutes on my way to Basel SBB. Plan the journey.
A: Take the IR from Bern at 03:00 (platform 5), arriving Olten 03:27. Note: the next onward train to Basel SBB isn't until 04:48 (platform 10AB, arriving 05:26), so your "30 min" coffee stretches to about 81 minutes at this hour — if you're traveling later in the day, ask again with a specific time and I'll find a tighter 30-min layover.
Reproduce
cat > /tmp/swiss-mcp.json <<'EOF'
{ "mcpServers": { "swiss-rail": {
"command": "uvx", "args": ["swiss-rail-mcp"]
}}}
EOF
claude -p \
--mcp-config /tmp/swiss-mcp.json \
"When's the next train from Bern to Zürich HB?"Times and disruption counts will differ on each run — these were captured live.
Data sources
Two zero-auth sources. Both are unaffiliated with this project.
transport.opendata.ch— proxies SBB's HAFAS timetable endpoints. Community-funded; be considerate with request volume.data.sbb.ch— SBB's public Opendatasoft Explore API. Disruptions, station facilities, passenger frequency.
For SBB data that requires an API key (real-time delays, occupancy, fares, train compositions, OJP, SIRI), see malkreide/swiss-transport-mcp. This server stays zero-auth on purpose; see LIMITATIONS.md for the full list of what that excludes and the heuristics used in its place.
Development
uv sync
uv run pytest # all tests (hits live APIs)
uv run pytest -m "not integration" # offline only
uv run ruff check
uv run ruff format --checkEnable verbose HTTP logging with SWISS_TRANSPORT_DEBUG=1.
License
MIT — see LICENSE.
Available Tools
12 toolsaccessible_routeA
Find connections and annotate them with station-level accessibility info.
Note: transport.opendata.ch does not expose vehicle- or
wagon-level accessibility. Annotation is based on station-level data
from SBB's PRM (Persons with Reduced Mobility) dataset for the
endpoint stations only. For wagon-level accessibility, use SBB's
official "Reisende mit Handicap" service.
Inputs: to_station (required), from_station (required), limit. Returns: object
bike_friendly_routeA
Find connections and annotate each leg with a bike-allowed heuristic.
Heuristic only: S/RE/IR/R lines typically allow bikes without reservation, IC/EC/ICE require reservations (and on some routes do not allow bikes at all), buses and trams generally do not allow bikes. Always verify on sbb.ch/velo for the actual journey.
Inputs: to_station (required), from_station (required), limit. Returns: object
commuter_summaryA
Daily commute snapshot: next connections home → work plus any active disruptions.
Use this tool for a quick morning sanity-check ("how's my commute looking?"). Combines opendata.ch connections with SBB rail-traffic-information.
Inputs: home_station (required), work_station (required). Returns: object
find_stationA
Search for Swiss public transport stations by name or partial name.
Use this tool to resolve a place name to one or more canonical station
records before calling get_connections or get_stationboard, or to
disambiguate between stations with similar names (e.g. "Bahnhof").
Inputs: query (required). Returns: result
get_connectionsA
Find upcoming train, tram, bus, or boat connections between two stations.
Use this tool when the user asks for travel options between two named places in Switzerland (e.g. "next train from Bern to Zürich" or "how do I get from Lugano to Lausanne tomorrow at 8?"). Station names are resolved by the upstream API, so common spellings work directly.
Inputs: to_station (required), from_station (required), date, time, +1 more. Returns: result
get_disruptionsA
Return currently active rail-traffic disruptions on the Swiss network.
Use this tool when the user asks "are there any disruptions today?", "is the line to X working?", or wants context on whether to expect delays on a route. Source: SBB rail-traffic-information feed.
Inputs: limit, scope. Returns: result
get_passenger_frequencyA
Return how busy a Swiss station typically is (average daily passengers).
Use this tool when the user asks "how busy is X?", "is it a major station?", or wants context for travel-time/connection planning.
Inputs: station (required). Returns: result
get_stationboardA
Show the next departures from a Swiss public transport station.
Use this tool when the user asks "what's leaving from ?" or wants the live departure board for a specific stop, without a target destination in mind.
Inputs: station (required), limit. Returns: result
get_station_facilitiesA
Report fixed facilities at a Swiss station: elevator, WiFi, step-free access, waiting room.
Use this tool when the user asks about accessibility, amenities, or what to expect at a station (e.g. "does Bern have step-free access?", "is there WiFi at Zürich HB?").
Inputs: station (required). Returns: Aggregated facility flags for a single station. Fields are ``None`` when the un…
journey_with_layoverA
Chain two connections with a deliberate layover at a chosen station.
Use this tool when the user wants to break a journey on purpose — to
grab food at a hub, meet someone for an hour at a midway station, or
sightsee briefly. Books the first leg ending at the layover, then the
next leg starting at layover_minutes after arrival.
Inputs: to_station (required), from_station (required), layover_minutes (required), layover_station (required). Returns: object
last_train_homeA
Find the latest realistic train back to home_station tonight.
Use this tool when the user asks "when's the last train home from
?" or wants reassurance about staying out late. Looks at connections
departing around 22:00 (or after_time if given) and returns the
latest one, plus a human-readable summary.
Inputs: home_station (required), current_station (required), after_time. Returns: object
plan_evening_outA
Plan an evening out: outbound options now plus the latest viable return.
Use this tool when the user is thinking about going somewhere for the evening and wants to know both how to get there and the safest last train back home.
Inputs: to_station (required), from_station (required), latest_return_time (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Several tools are specialized variants of get_connections (plan_evening_out, last_train_home, commuter_summary, journey_with_layover, accessible_route, bike_friendly_route), creating overlap in purpose. However, descriptions specify distinct user intents, so agents can generally choose correctly.
The set mixes get_* verbs (get_connections, get_stationboard, etc.) with descriptive phrases (last_train_home, commuter_summary, journey_with_layover) and adjective-noun compounds (accessible_route, bike_friendly_route). This is not a consistent verb_noun pattern.
12 tools is within the typical range for a domain-specific server, but about half are variants of the same journey-planning function, making the set feel somewhat inflated. Still, it is not excessive.
Covers core Swiss rail tasks: station search, connections, departures, disruptions, station facilities, and passenger frequency. It also adds accessibility and bike heuristics. Minor gaps exist (e.g., no generic 'last connection' tool, ticket info), but the domain is well covered.
Maintenance
Related MCP Connectors
Swiss Transport MCP — wraps Transport Open Data API (free, no auth)
Canonical SwissTrip MCP — independent SBB/CFF/FFS schedules, prices, and ticket links by SwissTrip.
Swiss trains and public transport: live connections and departures. Official data, free, no key.
DB Rail MCP — German + European rail and public transport, keyless.
Related MCP Servers
- AlicenseBqualityBmaintenanceSwiss open data MCP server — transport, weather, geodata, companies, etc,. Zero API keys.94431 npm28MIT
- AlicenseAqualityDmaintenanceMCP server for Swiss public transport — connections, stationboards, real-time delays, and direct booking links for SBB.418 PyPI1MIT
- AlicenseAqualityBmaintenanceAn MCP server for Swiss Federal Railways (SBB) open data, enabling AI models to query real-time disruptions, passenger frequencies, station details, and more without an API key.926 PyPI2MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for real-time German public transport data (HAFAS/VBN network). Enables querying departures, arrivals, journeys, and nearby stops using natural language.ISC