DB Timetables MCP

This page is a real MCP client running in your browser.

It speaks raw JSON-RPC over Streamable HTTP to a Cloudflare Worker that runs the db-timetable-mcp server. There is no REST wrapper in between. Open the protocol log to read the exact bytes.

The worker is stateless: every call stands on its own, there is no session id, and GET and DELETE are answered with 405.

Live board

Search a station, then watch the departures the worker merges from the planned timetable and the realtime changes.

Try

Protocol log

Every JSON-RPC message this page exchanged with the worker, in order. Open one to read its bytes and what it does. Oversized timetable payloads are shortened for the browser and marked as truncated.

0 message(s) recorded
No data yet

Tools advertised by the server

Run a search to fetch `tools/list`.

What is MCP?

MCP, the Model Context Protocol, is a way for one program to call the tools of another without either side knowing how the other is built. This page is one program. The worker is the other.

Here the browser calls five tools by name and receives structured JSON. It sees Deutsche Bahn's timetable data. It never sees anything the server keeps to itself.

That is the point of the pattern. The client asks for a result; the server holds everything else.

Three versions of the same moment

Every arrival and departure carries up to three versions of the same time. This is the part most displays throw away.

planned
The original timetable. What the operator intended to run.
changed
Only the deviations that were reported later. Fields that did not change are simply absent.
effective
The value to display: the change where there is one, otherwise the plan. When a train is on time, changed is missing and effective equals planned. That absence is the message, not a gap.

Why one board does not cost one call

A single board needs up to two upstream requests. Ten visitors within thirty seconds still need two. The worker caches the upstream responses, so everyone after the first reads the cache.

The windows are 30 seconds for live data, one hour for the planned timetable, and 24 hours for station data.

When the DB quota is exhausted or the API fails, the worker returns the last snapshot for up to six hours and marks it stale. An old board is better than an error page, as long as it says so.

The five tools

For a station board, always use getStationBoard. It merges the plan and the realtime changes in one call.

  • getStationBoard: the merged board for one station and one hour. Use effective for times and platforms.
  • getPlannedTimetable: the static plan for a station, day, and hour. No realtime changes.
  • getCurrentTimetable: the full set of known changes. This is change data, not a finished board.
  • getRecentChanges: only the changes reported in the last two minutes. A delta for frequent updates, not a board on its own.
  • findStations: search stations by name, EVA number, or DS100 code.

Alongside the tools the server exposes four resource templates: db-api:timetable/current/{evaNo}, db-api:timetable/changes/{evaNo}, db-api:timetable/planned/{evaNo}/{date}/{hour}, and db-api:station/{pattern}.

Limits

The operator's DB API quota is personal and small. The cache and the circuit breaker are what keep a popular page from burning it.

ResourceLimitEffect
Live data cache30 sOne upstream call per station board per window, regardless of visitors.
Planned timetable cache1 hTimetables for a station, day, and hour are static within the hour.
Station data cache24 hStation records effectively never change.
Stale window6 hIf the quota is exhausted, the last snapshot is served and marked stale.
Rate limit per visitor20 / min, 200 / hHTTP 429 with Retry-After. Best effort, in worker memory only.
Circuit breaker30 sAfter an upstream 429, no further upstream calls are attempted for 30 s.

Data source and attribution

Timetable data is provided by Deutsche Bahn via the DB API Marketplace and is licensed under the Creative Commons Attribution 4.0 International licence (CC BY 4.0).

Contains timetable data of Deutsche Bahn AG, licensed under CC BY 4.0. Source: DB API Marketplace, Timetables API.

Attribution is a condition of the licence, not a courtesy. This page is not affiliated with or endorsed by Deutsche Bahn AG.

Privacy

  • No cookies, no analytics, no tracking pixels, no third-party requests. All assets come from this origin.
  • Your station searches are not stored. The worker answers and forgets.
  • The worker uses your IP address in memory only, to count requests against the rate limit. Counters are never written to storage or logs.
  • The worker logs the upstream path it fetched, for example /plan/8000105/260910/16, so the cache can be verified. It does not log your IP or the content of your requests.
  • Cloudflare and Vercel process requests as hosting providers and may keep operational logs.