DB Timetable MCP Server logo

DB Timetable MCP Server

Community
jorekai

Ein Model Context Protocol (MCP) Server für die Deutsche Bahn Timetable API

Publisherjorekai
Repositorydb-timetable-mcp
LanguageTypeScript
Forks
7
Stars
17
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    DB Timetable MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    17 stars and 7 forks from the linked repository.

English | Deutsch

DB Timetable MCP Server

CI Smithery

A Model Context Protocol server for the official Deutsche Bahn Timetables API. It converts the compact DB XML into semantic JSON and merges the planned schedule with live changes into one station board.

What it guarantees

  • Correct platforms and times. effective holds the value to display. planned and changed explain the deviation.
  • Output built for models. Tools return structuredContent, descriptive JSON schemas, and a data model available as an MCP resource.
  • MCP conformance. Official TypeScript SDK, stdio for local clients, stateless Streamable HTTP for remote operation.
  • Safe defaults. No logs on stdout, loopback binding unless you change it, host allowlist, timeouts, non-root container, reproducible lockfile.
  • Verifiable behaviour. Unit, contract, and transport tests, coverage thresholds, CI, dependency and secret checks.

Quick start

Requirements: Node.js 22 or 24 LTS, and a subscribed Timetables product in the DB API Marketplace.

bash
git clone https://github.com/jorekai/db-timetable-mcp.git
cd db-timetable-mcp
npm ci
cp .env.example .env

Fill in .env:

dotenv
DB_TIMETABLE_CLIENT_ID=deine-client-id
DB_TIMETABLE_CLIENT_SECRET=dein-api-key

Then build and start:

bash
npm run build
npm start

In stdio mode the process waits for an MCP client. Status messages go to stderr only. stdout stays reserved for JSON-RPC.

Claude Desktop

Run npm ci && npm run build first, then point the configuration at an absolute path in claude_desktop_config.json.

macOS/Linux:

json
{
  "mcpServers": {
    "db-timetable": {
      "command": "node",
      "args": ["/absolute/path/db-timetable-mcp/dist/index.js"]
    }
  }
}

Windows:

json
{
  "mcpServers": {
    "db-timetable": {
      "command": "node",
      "args": ["C:\\absolute\\path\\db-timetable-mcp\\dist\\index.js"]
    }
  }
}

The .env file is looked up in the current working directory and next to the project directory, which covers the case where Claude Desktop starts the compiled server from somewhere else. You can also set the two credentials in the env object of the MCP entry instead.

After a configuration change, quit Claude Desktop completely and start it again. More in Troubleshooting.

Tools

ToolPurpose
getStationBoardRecommended. Joins the planned schedule and the full change set into a live station board
getPlannedTimetableStatic planned timetable for an EVA number, date, and hour
getCurrentTimetableThe complete change set (fchg), named this way for compatibility
getRecentChangesChanges from the last two minutes (rchg) for incremental updates
findStationsStation search by name, EVA number, or DS100 code

Every tool takes an optional includeRawXml: true. The full reference with examples is in docs/api.md.

Data model

An arrival or departure event, abbreviated:

json
{
  "planned": { "time": { "local": "2026-07-17T10:20" }, "platform": "8" },
  "changed": { "time": { "local": "2026-07-17T10:27" }, "platform": "10" },
  "effective": { "time": { "local": "2026-07-17T10:27" }, "platform": "10" },
  "delayMinutes": 7,
  "platformChanged": true,
  "isCancelled": false
}

Use effective for anything a traveller sees. The model can retrieve the same explanation through the db-timetable://docs/data-model resource. Details in docs/data-model.md.

Streamable HTTP and Docker

Start it locally:

bash
MCP_TRANSPORT=http npm start
  • MCP endpoint: http://127.0.0.1:3000/mcp
  • Health check: http://127.0.0.1:3000/health

With Docker Compose:

bash
docker compose up --build -d
docker compose ps
curl http://127.0.0.1:3000/health

Compose binds the port to loopback on purpose, runs as an unprivileged user, and uses a read-only filesystem. A public endpoint additionally needs TLS and authentication behind a reverse proxy. ALLOWED_HOSTS must list every allowed hostname.

Configuration

VariableDefaultDescription
DB_TIMETABLE_CLIENT_ID–DB client ID, required for API calls
DB_TIMETABLE_CLIENT_SECRET–DB API key, required for API calls
DB_TIMETABLE_BASE_URLofficial v1 URLAlternative base URL, mainly for tests
DB_TIMETABLE_TIMEOUT_MS15000Request timeout between 1000 and 120000 ms
MCP_TRANSPORTstdiostdio or http
HOST127.0.0.1HTTP bind address
PORT3000HTTP port
MCP_ENDPOINT/mcpStreamable HTTP path
ALLOWED_HOSTS–Comma-separated host allowlist, required with 0.0.0.0/::
DOTENV_CONFIG_PATH–Explicit absolute path to an env file
LOG_LEVELinfodebug, info, warn, or error

The old values TRANSPORT_TYPE=sse|httpStream and SSE_ENDPOINT still map to Streamable HTTP, so migration does not break an existing client.

Development

bash
npm run dev          # stdio with watch mode
npm run dev:http     # Streamable HTTP with watch mode
npm run check        # lint, types, tests, and build
npm run test:coverage

Further reading:

The documents under docs/ are currently written in German.

Troubleshooting

Expected "," or "]" after array element in Claude Desktop

Update to version 2 and rebuild. Earlier versions wrote log lines to the stdio protocol channel. Version 2 uses stderr for that.

DB-API-Zugangsdaten fehlen even though .env exists (the message reads "DB API credentials are missing")

The file must sit in the repository root next to package.json. If it lives somewhere else, set DOTENV_CONFIG_PATH to an absolute path. Do not wrap the values in quotes or leave trailing spaces around them.

401/403 from the DB API

Check that the client ID and the API key belong together, and that the application has subscribed to the Timetables product.

Wrong platform

Use getStationBoard and read effective.platform. planned.platform is the scheduled platform by definition, and changed.platform is present only when DB has reported a change.

Data source and license

The timetable data comes from Deutsche Bahn and is served through the Timetables API 1.0.274. According to the DB API Marketplace the data is under CC BY 4.0, so attribution to Deutsche Bahn is required when you use it. The Marketplace currently states a limit of 60 calls per minute.

The MCP server itself is under the MIT license.

Installation

TypingMind
{
  "mcpServers": {
    "db-timetable-mcp": {
      "command": "node",
      "args": [
        "dist/index.js"
      ]
    }
  }
}

Use DB Timetable MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once DB Timetable MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add DB Timetable MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the DB Timetable MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "db-timetable-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "db-timetable-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the DB Timetable MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the DB Timetable MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use DB Timetable MCP Server to help me with this task?
DB Timetable MCP Server
Sure. I read it.
Here is what I found using DB Timetable MCP Server.

Option 2: Add an MCP server URL

Use this when DB Timetable MCP Server is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter the MCP server URL from the provider in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste the MCP server URL from the provider into the Server URL field.
  2. Enter a connection name for DB Timetable MCP Server.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the DB Timetable MCP Server connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the DB Timetable MCP Server tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the DB Timetable MCP Server tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use DB Timetable MCP Server to help me with this task?
DB Timetable MCP Server
Sure. I read it.
Here is what I found using DB Timetable MCP Server.

Frequently asked questions

What is the DB Timetable MCP Server MCP server used for?

DB Timetable MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use DB Timetable MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use DB Timetable MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use DB Timetable MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With DB Timetable MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect DB Timetable MCP Server MCP to TypingMind?

DB Timetable MCP Server can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does DB Timetable MCP Server MCP provide in TypingMind?

DB Timetable MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use DB Timetable MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If DB Timetable MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇