rail-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
rail-mcp
An MCP server for European trains: plan journeys, read live departure boards and follow a train's run, with delays, cancellations and platform changes where operators publish them. It works with Claude (as a custom connector or in Claude Code) and any other MCP client.
All data comes from Transitous, a free, open, community-run journey planner built on operators' open data. Coverage includes all of Germany (DB and regional trains), the Netherlands (NS), Switzerland (SBB), France (SNCF, TGV, Eurostar), Italy (Trenitalia) and most of the rest of Europe, cross-border journeys included.
Fares and network-wide disruptions come from operators' own APIs where you have a key: so far NS (the Netherlands), see Operator extras. Otherwise there are no fares or bookings: European rail ticketing isn't open data. Results name the operator, so you can book on its own site.
Tools
Tool | What it does |
| Journeys from A to B: times, changes, trains, platforms, live delays and cancellations. Departure or arrival time, a via station, max changes, bikes, trains only or all modes, paging to later or earlier journeys. |
| A station's departure or arrival board, with live delays, platform changes, cancellations and service alerts. Optionally long-distance trains only. |
| Every stop of one train run (from a |
| Stations matching a name, with ids for the other tools. |
| With an NS key: NS ticket prices within the Netherlands, per adult, single and return, first and second class, with the 20% and 40% subscription discounts, and the children's Railrunner fare. |
| With an NS key: NS's current disruptions, major incidents and engineering works, for the whole network or one station. |
Places are station names (local spellings work best: Köln Hbf, Amsterdam Centraal, Zürich HB,
Paris Gare de Lyon, Milano Centrale), station ids from find_stations, or latitude,longitude.
Times are each station's local time with its UTC offset. A time sent without an offset is read as the
station's local time.
Some things the answers handle that raw timetable data doesn't:
Big stations are often split across feeds (Paris Gare de Lyon is one stop for RER and metro, another for TGVs), so boards take in every stop within 150 m. A train that two feeds both list is shown once, even when each gives its own end of the line (NS's ICE 143 to Hengelo, DB's to Hannover Hbf): the other is kept in
to_also_given_as.A cross-border train that two operators both list (EC Zürich–Milano: SBB to Chiasso, Trenitalia after) comes back from the planner as two legs. The second is marked
same_train_as_previous_leg, so the traveller isn't told to change trains.A delay is given only when there's live data (
live: true). Without it, times are the timetable's.
Related MCP server: irail-mcp
Using Transitous fairly
Transitous is run by volunteers, free for open-source, non-commercial use. This server follows its usage policy:
Every request sends
User-Agent: rail-mcp/<version> (+<contact>). SetRAIL_MCP_CONTACTto your own URL or e-mail address when you run your own copy.Journey searches are capped at 300 a day by default (
RAIL_MCP_PLANS_PER_DAY, at most 700). Transitous asks to hear from clients above 720 a day.Station look-ups are cached for six hours.
Every answer carries Transitous's attribution, and the instructions ask the model to credit it.
Data: Transitous and its sources; map data © OpenStreetMap contributors. If you use it a lot, consider donating to Transitous.
Operator extras
Each needs your own key and is off without it: its tools aren't even listed.
NS (the Netherlands) adds fares and disruptions. The key is free:
Make an account at the NS API portal (choose Externe bezoeker).
Subscribe to the Ns-App product.
Copy the subscription's primary key from your profile into
NS_API_KEY.
How it uses NS's API:
Fares come from NS's journey planner, whose trips carry their whole fare table. NS's price endpoint answered
500to every request in November 2026, so the planner is used instead.The children's Railrunner fare comes from NS's older price list.
Disruptions come in English where NS has a translation. Some advice texts are Dutch only.
Data: NS (Nederlandse Spoorwegen).
Requests to operators' own APIs carry an ordinary desktop browser's headers (identity.py); Transitous
is the exception, as its policy asks.
Running it
Python 3.12 or newer.
In Claude Code (stdio)
claude mcp add trains -e RAIL_MCP_CONTACT=https://example.com/you -- uvx --from git+https://github.com/dalarso/rail-mcp rail-mcp --stdioAs a remote connector (HTTP)
rail-mcp serves POST /mcp (Streamable HTTP with plain JSON answers, no sessions, both the 2026-07-28
and 2025-era protocol) and GET /health.
Without authentication it listens on loopback only. To publish it, put it behind a Cloudflare Access
application with Managed OAuth (so claude.ai can sign in) and set the three ACCESS_* variables. The server then checks Access's signed JWT
(Cf-Access-Jwt-Assertion) on every request: signature against the team's keys, the app's AUD, the
issuer, the time and the allowed e-mail. It also refuses any request carrying an Origin header, and
with RAIL_MCP_HOST set it answers that host name only.
Configuration
Variable | Default | Meaning |
| this repository's URL | Contact in the User-Agent sent to Transitous: your URL or e-mail. |
|
| Journey searches allowed in any 24 hours (1 to 700). |
|
| Preferred language for alerts and names, where feeds have translations. |
|
| Where the HTTP server listens. Not loopback requires Access. |
| none | The public host name. When set, |
| none | Cloudflare Access team ( |
|
| The MOTIS 2 API to use (a self-hosted MOTIS works too). |
| none | Your NS API portal key (Ns-App product). Turns on |
Development
PYTHONPATH=src python -m unittest discover -s testsThe tests need only aiohttp, cryptography and tzdata, and never call Transitous.
License
MIT. The data belongs to its publishers. See Transitous's sources for each feed's licence.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Plan journeys by train, bus, tram, metro and ferry across 42 European countries.
Stations, connections and departures of Swiss public transport, with real-time delays.
Journeys, departures, line courses, disruptions in Germany; nearby sharing as currently reported.
Cached UK train departures and qualified platforms, powered by National Rail Enquiries.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides real-time Dutch Railways (NS) data for journey planning, live departures, disruptions, and station search.3-
- AlicenseAqualityCmaintenanceProvides Belgian railway travel information via the iRail API, including station search, live departures/arrivals, route planning, and network disturbances.5MIT
- FlicenseNot gradedqualityDmaintenanceEnables querying Swiss public transport (trains, buses, trams, boats) for stations, connections, and station boards via the opendata.ch API.-

mcp-db-railofficial
AlicenseNot gradedqualityBmaintenanceEnables keyless access to German and European rail and public transport data, including station search, live departures and arrivals, and multi-leg journey planning with real-time updates.56 npmMIT