DB Timetable MCP Server
Provides access to Deutsche Bahn train timetables, station information, and schedule changes through Model Context Protocol tools and resources.
jorekai
README
DB Timetable MCP Server
Ein Model Context Protocol (MCP) Server für die Deutsche Bahn Timetable API. Der Server bietet MCP-Tools und -Ressourcen, um auf Fahrplandaten, Stationsinformationen und Zugänderungen zuzugreifen.
Pflicht zur Namensnennung:
Dieses Projekt stellt die Fahrplandaten der Deutschen Bahn bereit, die unter der Creative Commons Attribution 4.0 International Lizenz (CC BY 4.0) öffentlich einsehbar sind.
Weitere Infos zur API und Lizenzbedingungen findest du unter developers.deutschebahn.com. API Requests unterliegen den Bedingungen der Lizenz.
Funktionen
- Aktuelle Fahrplände: Abrufen aktueller Fahrplandaten für eine Station
- Fahrplanänderungen: Tracking der neuesten Änderungen
- Geplante Fahrpläne: Zugriff auf geplante Fahrplandaten für einen bestimmten Zeitpunkt
- Stationssuche: Suche nach Bahnhofsstationen anhand von Namen oder Codes
Voraussetzungen
- Node.js 18 oder höher
- API-Zugangsdaten für die DB Timetable API (Client-ID und Client-Secret)
Installation
-
Repository klonen:
git clone <repository-url> cd db-mcp
-
Abhängigkeiten installieren:
npm install
-
TypeScript-Code kompilieren:
npm run build
Konfiguration
Erstelle eine .env
-Datei im Root-Verzeichnis des Projekts mit folgenden Umgebungsvariablen:
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
Konfigurationsoptionen
DB_TIMETABLE_CLIENT_ID
: Client-ID für die DB API (erforderlich)DB_TIMETABLE_CLIENT_SECRET
: Client-Secret für die DB API (erforderlich)TRANSPORT_TYPE
: Transporttyp für den MCP-Server (stdio
odersse
, Standard:stdio
)PORT
: Port für den SSE-Server (Standard:8080
)SSE_ENDPOINT
: Endpunkt für SSE-Verbindungen (Standard:/sse
)LOG_LEVEL
: Logging-Level (debug
,info
,warn
,error
, Standard:info
)
Verwendung
Server starten
Im stdio-Modus (für CLI-Tests und Debugging):
npm start
Im SSE-Modus (für Webclients):
TRANSPORT_TYPE=sse npm start
Mit Inspect-Modus testen
Der Server kann mit dem FastMCP Inspector getestet werden:
npx fastmcp inspect path/to/index.js
MCP-Tools
Der Server stellt folgende Tools bereit:
-
getCurrentTimetable: Ruft aktuelle Fahrplandaten für eine Station ab
- Parameter:
evaNo
- EVA-Nummer der Station (z.B. 8000105 für Frankfurt Hbf)
- Parameter:
-
getRecentChanges: Ruft aktuelle Änderungen für eine Station ab
- Parameter:
evaNo
- EVA-Nummer der Station (z.B. 8000105 für Frankfurt Hbf)
- Parameter:
-
getPlannedTimetable: Ruft geplante Fahrplandaten für eine Station ab
- Parameter:
evaNo
- EVA-Nummer der Station (z.B. 8000105 für Frankfurt Hbf)date
- Datum im Format YYMMDD (z.B. 230401 für 01.04.2023)hour
- Stunde im Format HH (z.B. 14 für 14 Uhr)
- Parameter:
-
findStations: Sucht nach Stationen anhand eines Suchmusters
- Parameter:
pattern
- Suchmuster (z.B. "Frankfurt" oder "BLS")
- Parameter:
MCP-Ressourcen
Der Server stellt folgende Ressourcen bereit:
- Aktuelle Fahrplandaten:
db-api:timetable/current/{evaNo}
- Aktuelle Fahrplanänderungen:
db-api:timetable/changes/{evaNo}
- Geplante Fahrplandaten:
db-api:timetable/planned/{evaNo}/{date}/{hour}
- Stationssuche:
db-api:station/{pattern}
Entwicklung
Projekt-Struktur
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-Skripte
npm run build
: Kompiliert den TypeScript-Codenpm start
: Startet den Servernpm run dev
: Startet den Server im Entwicklungsmodus mit automatischem Neuladennpm test
: Führt Tests aus
Erweiterbarkeit
Potenzielle Erweiterungen
- Datenverarbeitung und -anreicherung
- Semantische Fahrplandatenverarbeitung: XML zu strukturiertem JSON mit semantischer Anreicherung
- Historische Datenanalyse für Verspätungen und Betriebsstörungen
- Integration multimodaler Verkehrsverbindungen
- Erweiterte MCP-Tools
- Routenplanung zwischen Stationen
- KI-basierte Verspätungs- und Auslastungsprognosen
- Reisestörungsanalyse
- Barrierefreiheitscheck für Stationen und Verbindungen
Lizenz
MCP Server: MIT Lizenz
DB Timetable API: Creative Commons Namensnennung 4.0 International Lizenz
Recommended Servers
Crypto Price & Market Analysis MCP Server
A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Nefino MCP Server
Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.
Vectorize
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
Mathematica Documentation MCP server
A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.
kb-mcp-server
An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded
Research MCP Server
The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.