Skip to main content
Glama
jorekai

DB Timetable MCP Server

by jorekai

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

  1. Clone repository:

    git clone <repository-url>
    cd db-mcp
  2. Install dependencies:

    npm install
  3. Compile 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=info

Configuration 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 ( stdio or sse , 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 start

In SSE mode (for web clients):

TRANSPORT_TYPE=sse npm start

Test with Inspect mode

The server can be tested with the FastMCP Inspector:

npx fastmcp inspect path/to/index.js

MCP tools

The server provides the following tools:

  1. getCurrentTimetable : Retrieves current timetable data for a station

    • Parameter: evaNo - EVA number of the station (e.g. 8000105 for Frankfurt Hbf)

  2. getRecentChanges : Retrieves recent changes for a station

    • Parameter: evaNo - EVA number of the station (e.g. 8000105 for Frankfurt Hbf)

  3. 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.)

  4. 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:

  1. Current timetable data : db-api:timetable/current/{evaNo}

  2. Current timetable changes : db-api:timetable/changes/{evaNo}

  3. Planned timetable data : db-api:timetable/planned/{evaNo}/{date}/{hour}

  4. 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.md

NPM scripts

  • npm run build : Compiles the TypeScript code

  • npm start : Starts the server

  • npm run dev : Starts the server in development mode with automatic reloading

  • npm test : Runs tests

Extensibility

Potential extensions

  1. 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

  2. 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

A
license - permissive license
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    An 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.
    6
    MIT

View all related MCP servers

Related MCP Connectors

  • BGG MCP provides access to the BoardGameGeek API through the Model Context Protocol, enabling retr…

  • Swiss Transport MCP — wraps Transport Open Data API (free, no auth)

  • iRail MCP — Belgian rail (SNCB/NMBS) real-time via the community iRail API

View all MCP Connectors

Latest Blog Posts

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/jorekai/db-timetable-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server