DB Timetable MCP Server
Summary: This MCP server gives a model access to Deutsche Bahn station timetable data (planned schedules, real-time changes, and station lookup) for German railway stations.
getPlannedTimetable– Fetch the scheduled timetable (arrivals/departures, tracks, planned times) for a station (EVA number), a given date (YYMMDD) and hour (HH), for forward planning.getCurrentTimetable– Retrieve current, real-time timetable data for a station for the operating day, including delays, platform occupancy, and live information.getRecentChanges– Get the latest short-term changes for a station: delays, platform changes, cancellations, and other real-time adjustments.findStations– Search the station directory by name or EVA number to resolve the station IDs the other tools need.
Note: the schema reflects the earlier version 2 toolset; the current README (v3) replaces these with getDepartures, getArrivals, getStationBoard, and findStations.
Handles content licensed under Creative Commons Attribution 4.0 International License (CC BY 4.0), ensuring proper attribution for Deutsche Bahn timetable data.
Provides access to Deutsche Bahn timetable data, including current schedules, planned timetables, schedule changes, and station search functionality through the Deutsche Bahn API.
Supports configuration through .env files for storing API credentials and server settings.
Supports source code management through Git, enabling cloning of the repository.
Runs on Node.js platform (version 18 or higher) for server-side execution.
Uses npm for package management and running server scripts.
Utilizes TypeScript for type-safe development of the MCP server components.
Handles XML data from the Deutsche Bahn API, converting it to more accessible formats.
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., "@DB Timetable MCP Server show me current departures from Berlin Hauptbahnhof"
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.
DB Timetable MCP Server
A Model Context Protocol (MCP) server for the Deutsche Bahn Timetable API. The server provides MCP tools and resources for accessing timetable data, station information, and train changes.
Obligation to name:
This project provides Deutsche Bahn timetable data, which is publicly available under the Creative Commons Attribution 4.0 International License (CC BY 4.0) .
Further information about the API and license terms can be found at developers.deutschebahn.com . API requests are subject to the license terms.
Functions
Current timetables : Retrieve current timetable data for a station
Timetable changes : Tracking the latest changes
Planned timetables : Access to planned timetable data for a specific time
Station search : Search for train stations by name or code
Related MCP server: db-mcp
Requirements
Node.js 18 or higher
API credentials for the DB Timetable API (client ID and client secret)
installation
Clone repository:
git clone <repository-url> cd db-mcpInstall dependencies:
npm installCompile TypeScript code:
npm run build
configuration
Create an .env file in the root directory of the project with the following environment variables:
DB_TIMETABLE_CLIENT_ID=deine-client-id
DB_TIMETABLE_CLIENT_SECRET=dein-client-secret
TRANSPORT_TYPE=stdio
PORT=8080
SSE_ENDPOINT=/sse
LOG_LEVEL=infoConfiguration options
DB_TIMETABLE_CLIENT_ID: Client ID for the DB API (required)DB_TIMETABLE_CLIENT_SECRET: Client secret for the DB API (required)TRANSPORT_TYPE: Transport type for the MCP server (stdioorsse, default:stdio)PORT: Port for the SSE server (default:8080)SSE_ENDPOINT: Endpoint for SSE connections (default:/sse)LOG_LEVEL: Logging level (debug,info,warn,error, default:info)
use
Start server
In stdio mode (for CLI testing and debugging):
npm startIn SSE mode (for web clients):
TRANSPORT_TYPE=sse npm startTest with Inspect mode
The server can be tested with the FastMCP Inspector:
npx fastmcp inspect path/to/index.jsMCP tools
The server provides the following tools:
getCurrentTimetable : Retrieves current timetable data for a station
Parameter:
evaNo- EVA number of the station (e.g. 8000105 for Frankfurt Hbf)
getRecentChanges : Retrieves recent changes for a station
Parameter:
evaNo- EVA number of the station (e.g. 8000105 for Frankfurt Hbf)
getPlannedTimetable : Retrieves planned timetable data for a station
Parameter:
evaNo- EVA number of the station (e.g. 8000105 for Frankfurt Hbf)date- Date in YYMMDD format (e.g. 230401 for 01.04.2023)hour- hour in HH format (e.g. 14 for 2 p.m.)
findStations : Searches for stations using a search pattern
Parameter:
pattern- search pattern (e.g. "Frankfurt" or "BLS")
MCP resources
The server provides the following resources:
Current timetable data :
db-api:timetable/current/{evaNo}Current timetable changes :
db-api:timetable/changes/{evaNo}Planned timetable data :
db-api:timetable/planned/{evaNo}/{date}/{hour}Station search :
db-api:station/{pattern}
Development
Project structure
db-mcp/
├── src/
│ ├── api/ # API-Client und Typen
│ ├── tools/ # MCP-Tools
│ ├── resources/ # MCP-Ressourcen
│ ├── utils/ # Hilfsfunktionen
│ ├── config.ts # Konfiguration
│ └── index.ts # Haupteinstiegspunkt
├── dist/ # Kompilierte Dateien
├── .env # Umgebungsvariablen
├── package.json
├── tsconfig.json
└── README.mdNPM scripts
npm run build: Compiles the TypeScript codenpm start: Starts the servernpm run dev: Starts the server in development mode with automatic reloadingnpm test: Runs tests
Extensibility
Potential extensions
Data processing and enrichment
Semantic timetable data processing: XML to structured JSON with semantic enrichment
Historical data analysis for delays and disruptions
Integration of multimodal transport connections
Advanced MCP tools
Route planning between stations
AI-based delay and capacity forecasts
Travel disruption analysis
Accessibility check for stations and connections
License
MCP Server: MIT License
DB Timetable API: Creative Commons Attribution 4.0 International License
Available Tools
4 toolsfindStationsB
Durchsucht das Verzeichnis der Bahnhofsstationen anhand eines gegebenen Suchmusters. Dies kann der Name der Station oder die EVA-Nummer sein. Das Tool liefert eine Liste von Stationen, die dem Suchmuster entsprechen.
Inputs: pattern (required).
getCurrentTimetableA
Ruft die aktuellen Fahrplandaten einer bestimmten Bahnhofsstation ab. Dies beinhaltet Informationen zu Ankunfts- und Abfahrtszeiten, Gleisbelegungen, Verspätungen und weitere Echtzeitinformationen für den aktuellen Betriebstag.
Inputs: evaNo (required).
getPlannedTimetableB
Holt die geplanten Fahrplandaten für eine angegebene Bahnhofsstation zu einem bestimmten Datum und einer bestimmten Stunde ein. Diese Funktion ist nützlich, um Fahrpläne im Voraus zu planen und Informationen über zukünftige Zugverbindungen zu erhalten.
Inputs: evaNo (required), date (required), hour (required).
getRecentChangesB
Ermittelt die neuesten Fahrplanänderungen für eine spezifische Bahnhofsstation. Dazu gehören Verspätungen, Gleisänderungen, Ausfälle und andere kurzfristige Anpassungen im Betriebsablauf, die in Echtzeit aktualisiert werden.
Inputs: evaNo (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: findStations searches for stations, getCurrentTimetable retrieves real-time data, getPlannedTimetable fetches future schedules, and getRecentChanges tracks recent changes. There is no overlap in functionality, making tool selection straightforward for an agent.
The naming follows a consistent verb_noun pattern with three tools starting with 'get' and one with 'find', all using camelCase. The minor deviation is 'findStations' versus 'getX', but it remains readable and predictable.
With 4 tools, the server is well-scoped for its purpose of accessing railway timetable data. Each tool serves a specific and necessary function, providing a focused set without being too sparse or overwhelming.
The tool set covers core operations for timetable data: searching stations, retrieving current and planned schedules, and tracking changes. A minor gap is the lack of tools for modifying or managing data (e.g., CRUD operations), but this may be intentional for a read-only server, and agents can work around this limitation.
Maintenance
Related MCP Connectors
DB Rail MCP — German + European rail and public transport, keyless.
Journeys, departures, line courses, disruptions in Germany; nearby sharing as currently reported.
BGG MCP provides access to the BoardGameGeek API through the Model Context Protocol, enabling retr…
Belgian trains for AI agents: live journeys, departures, delays, disruptions. Free, no key.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides unified access to Deutsche Bahn APIs for real-time railway data, station information, timetables, disruptions, parking, and accessibility services.26-
- AlicenseAqualityDmaintenanceAn MCP server that exposes the Deutsche Bahn public transport API to any MCP-compatible client (Claude Desktop, Cursor, Cline, Continue, etc.). Five tools cover station search, departures, journey planning, trip details, and nearby stations.62MIT
- AlicenseAqualityCmaintenanceProvides access to Deutsche Bahn's timetable data through MCP, enabling real-time train schedules, station search, and change tracking for German railway stations.4MIT
- AlicenseAqualityDmaintenanceAn (unofficial) MCP server for the Deutsche Bahn Timetables API — station search, planned departures, and real-time changes (delays, platform changes, cancellations) as tools for Claude and other MCP clients.42MIT