DB Timetable MCP Server
Provides access to Deutsche Bahn's timetable data, enabling real-time train schedules, station search, planned timetable queries, and change tracking for German railway stations.
Click on "Install 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 Serverget current timetable for Frankfurt Hbf"
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 standardized Model Context Protocol (MCP) server that provides seamless access to Deutsche Bahn's timetable data through MCP tools and resources. This server enables AI assistants and applications to query real-time train schedules, station information, and timetable changes for German railway stations.
Overview
This MCP server bridges the gap between AI applications and Deutsche Bahn's timetable API, offering:
Real-time timetable access - Get current train schedules and platform information
Change tracking - Monitor real-time updates, delays, and platform changes
Station search - Find stations by name or EVA number
Planned schedules - Access future timetable data for trip planning
Built with the standard @modelcontextprotocol/sdk, this server supports both stdio and SSE (Server-Sent Events) transport modes, making it compatible with various MCP clients including Cursor IDE.
Related MCP server: Deutsche Bahn MCP Server
Data Source & License
This project provides timetable data from Deutsche Bahn, which is publicly available under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
For more information about the API and license terms, visit developers.deutschebahn.com. All API requests are subject to the license terms.
Key Features
Real-time Timetables - Get current train schedules with platform assignments, delays, and real-time updates
Change Tracking - Monitor live timetable changes including delays, cancellations, and platform modifications
Planned Schedules - Access future timetable data for specific dates and times
Station Discovery - Search and find German railway stations by name, code, or pattern matching
Dual Transport Modes - Support for both stdio (CLI) and SSE (HTTP) transport protocols
Cursor IDE Integration - Ready-to-use configuration for seamless Cursor IDE integration
Prerequisites
Node.js 18 or higher
API credentials for the DB Timetable API (Client ID and Client Secret)
Installation
Clone the repository:
git clone <repository-url> cd db-timetable-mcpInstall dependencies:
npm installCompile TypeScript code:
npm run build
Configuration
Create a .env file in the project root directory with the following environment variables:
DB_TIMETABLE_CLIENT_ID=your-client-id
DB_TIMETABLE_CLIENT_SECRET=your-client-secret
TRANSPORT_TYPE=sse
PORT=3000
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:3000)SSE_ENDPOINT: Endpoint for SSE connections (default:/sse)LOG_LEVEL: Logging level (debug,info,warn,error, default:info)
Usage
Starting the Server
In stdio mode (for CLI tests and debugging):
npm startIn SSE mode (for web clients):
TRANSPORT_TYPE=sse npm startOr use the dev script:
npm run dev:sseMCP Tools
The server provides the following tools:
getCurrentTimetable: Retrieves current timetable data for a station
Parameters:
evaNo- EVA number of the station (e.g., 8000105 for Frankfurt Hbf)
getRecentChanges: Retrieves recent changes for a station
Parameters:
evaNo- EVA number of the station (e.g., 8000105 for Frankfurt Hbf)
getPlannedTimetable: Retrieves planned timetable data for a station
Parameters:
evaNo- EVA number of the station (e.g., 8000105 for Frankfurt Hbf)date- Date in YYMMDD format (e.g., 230401 for April 1, 2023)hour- Hour in HH format (e.g., 14 for 2 PM)
findStations: Searches for stations by pattern
Parameters:
pattern- Search pattern (e.g., "Frankfurt" or "BLS")
MCP Resources
The server provides the following resources:
Current Timetable:
db-api:timetable/current/{evaNo}Recent Changes:
db-api:timetable/changes/{evaNo}Planned Timetable:
db-api:timetable/planned/{evaNo}/{date}/{hour}Station Search:
db-api:station/{pattern}
Development
Project Structure
db-timetable-mcp/
├── src/
│ ├── api/ # API client and types
│ ├── tools/ # MCP tools
│ ├── resources/ # MCP resources
│ ├── utils/ # Utility functions
│ ├── config.ts # Configuration
│ └── index.ts # Main entry point
├── dist/ # Compiled files
├── .env # Environment variables
├── package.json
├── tsconfig.json
└── README.mdNPM Scripts
npm run build: Compiles TypeScript codenpm start: Starts the servernpm run dev: Starts the server in development modenpm run dev:sse: Starts the server in SSE mode (development)npm test: Runs testsnpm run check-env: Checks environment variable configuration
Cursor Integration
This server can be integrated with Cursor IDE. See CURSOR_CONFIG.md for detailed configuration instructions.
Quick Setup
Start the server in SSE mode:
npm run dev:sseAdd to Cursor's MCP configuration:
{ "mcpServers": { "db-timetable": { "url": "http://localhost:3000/sse", "transport": "sse" } } }
REST API Endpoints
The server also provides REST API endpoints for testing:
GET /health- Health checkGET /tools- List all toolsGET /resources- List all resourcesPOST /tools/call- Call a tool (REST API)GET /sse- SSE connection endpointPOST /sse- Send MCP messages via SSE (JSON-RPC 2.0)
Extensibility
Potential extensions:
Data Processing and Enrichment
Semantic timetable data processing: XML to structured JSON with semantic enrichment
Historical data analysis for delays and operational 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 toolsfindStationsA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Suchmuster für Stationen (z.B. Frankfurt oder 8000105) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description must disclose behavioral traits. It only states it returns a list of matching stations without detailing behavior like case sensitivity, matching logic, or limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two clear sentences with no superfluous information. Efficiently conveys the core functionality.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity, the description covers basic purpose and parameter. However, it omits return format and error handling, leaving some gaps for a complete understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% for the single parameter, and the description adds little beyond what the schema already provides (both mention pattern can be name or EVA number). Minimal added value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches the station directory by pattern (name or EVA number). This purpose is distinct from sibling tools which are timetable-related.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description specifies the input can be station name or EVA number but provides no guidance on when to use this tool versus alternatives. Usage context is implied by the tool's purpose, but not explicitly stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getCurrentTimetableB
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.
| Name | Required | Description | Default |
|---|---|---|---|
| evaNo | Yes | EVA-Nummer der Station (z.B. 8000105 für Frankfurt Hbf) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It discloses that results include real-time info like delays, but omits behavioral traits such as data freshness, rate limits, or error handling (e.g., missing station). Minimal added context beyond tool name.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with action and resource, no unnecessary words. Every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with one parameter and no output schema, the description covers the basic functionality and output contents. However, it lacks usage guidance and behavioral details that would help an agent decide when to invoke it, especially given sibling tools.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with a well-described parameter (evaNo). The description does not add meaning beyond the schema's example and format. Baseline 3 is appropriate as the schema handles the documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action 'Ruft ab' (retrieves) and the resource 'aktuellen Fahrplandaten einer bestimmten Bahnhofsstation' (current timetable data of a specific station). It differentiates from siblings by implying real-time vs planned timetable, but does not explicitly name alternatives.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives. The description does not mention when not to use it or provide any context for selection among siblings like getPlannedTimetable or getRecentChanges.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getPlannedTimetableA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Datum im Format YYMMDD (z.B. 230401 für 01.04.2023) | |
| hour | Yes | Stunde im Format HH (z.B. 14 für 14 Uhr) | |
| evaNo | Yes | EVA-Nummer der Station (z.B. 8000105 für Frankfurt Hbf) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It only states the purpose without disclosing behavioral traits such as side effects, authentication needs, error conditions, or performance characteristics. The agent cannot assess safety or cost of invocation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences in German, front-loaded with the primary purpose, and includes a secondary sentence on usage context. Every sentence contributes value without redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simplicity of the tool (3 required parameters, no output schema, no annotations), the description provides the core information: what data is fetched and for what purpose. Minor gaps include lack of output format hints and comparison with siblings, but it is largely sufficient for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with clear descriptions and examples for each parameter (date, hour, evaNo). The description adds no extra meaning beyond what the schema already provides, so a baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Holt die geplanten Fahrplandaten') and the resource (planned timetable data for a station, date, and hour). It differentiates from siblings by highlighting 'planned' nature, contrasting with 'current' or 'recent changes'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states it is useful for planning ahead and getting future train info, providing clear usage context. However, it does not explicitly exclude use when real-time data is needed or name alternatives like 'getCurrentTimetable'.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getRecentChangesA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| evaNo | Yes | EVA-Nummer der Station (z.B. 8000105 für Frankfurt Hbf) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Since no annotations are provided, the description carries the full burden. It mentions that the tool retrieves real-time updates and lists types of changes, but does not disclose permissions, rate limits, or side effects. The read-only nature is implied but not explicit.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences long, front-loaded with the main action and resource. Every sentence adds value, and there is no unnecessary text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simple tool with one parameter and no output schema or annotations, the description adequately covers the tool's purpose and data type. However, it does not describe the return format or pagination, which could be helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, and the description adds no extra information about the evaNo parameter beyond what the schema already includes. The schema already provides an example, so baseline score applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'ermittelt' (retrieves) and the resource 'neuesten Fahrplanänderungen' (latest schedule changes) for a specific station. It also lists examples like delays, platform changes, and cancellations. This distinguishes it from siblings like getCurrentTimetable and getPlannedTimetable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when real-time changes are needed, but does not explicitly state when to use it versus alternatives. No 'when not to use' or comparison to siblings is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v1.0.0- First observed
findStations - First observed
getCurrentTimetable - First observed
getPlannedTimetable - First observed
getRecentChanges
TDQS
Each tool targets a distinct function: station search, real-time timetable, planned timetable, and recent changes. There is no overlap in purpose, making selection unambiguous.
All tool names follow a consistent verb_noun camelCase pattern (findStations, getCurrentTimetable, etc.), which is uniform and predictable.
Four tools cover the core functionalities of a timetable server (search, current, planned, changes) without redundancy or shortage.
The set covers essential station and timetable operations. Minor gaps like a generic station list or multi-station queries are absent but not critical for the stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Swiss Transport MCP — wraps Transport Open Data API (free, no auth)
iRail MCP — Belgian rail (SNCB/NMBS) real-time via the community iRail API
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
21GovData.de MCP — Germany's national open-data portal (CKAN API).
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides access to Deutsche Bahn train timetables, station information, and schedule changes through Model Context Protocol tools and resources.48317MIT
- FlicenseNot gradedqualityCmaintenanceProvides unified access to Deutsche Bahn APIs for real-time railway data, station information, timetables, disruptions, parking, and accessibility services.18-
- FlicenseAqualityDmaintenanceMCP server for querying German public transport information, including station search, live departures/arrivals, and journey planning.51-
- FlicenseNot gradedqualityDmaintenanceMCP server for querying Belgian railway data (SNCB/NMBS) via the iRail API, enabling station search, liveboard, and journey planning.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zzuisa/db-support'
If you have feedback or need assistance with the MCP directory API, please join our Discord server