Skip to main content

MCP server exposing live Deutsche Bahn data: journeys, delays, disruptions, strikes, and alternative routes.

Project description

mcp-deutsche-bahn

Deutsche Bahn

An MCP server that gives any MCP-compatible AI assistant (Claude Desktop, Claude Code, Cursor, etc.) live access to Deutsche Bahn data: journey planning, real-time delays, disruptions, construction works, strikes, and alternative routes.

Not affiliated with or endorsed by Deutsche Bahn AG. Logo used for source identification only.

What it does

Six tools, available to your LLM:

Tool Answers
search_journeys "How do I get from Berlin Hbf to München Hbf tomorrow at 9am?"
station_departures "What's leaving Hamburg Hbf in the next hour?"
journey_status "Has my booked journey been delayed?"
get_disruptions "Any construction on the Köln–Frankfurt corridor?"
detect_strike "Is there a strike going on right now?"
find_alternatives "Route me around Hannover Hbf if it's blocked."

Quickstart (1 minute, no clone)

You need uv (one-line install):

curl -LsSf https://astral.sh/uv/install.sh | sh

That's the only prereq. The MCP server itself installs on demand — pick your client:

Claude Desktop

Open ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows). Add:

{
  "mcpServers": {
    "deutsche-bahn": {
      "command": "uvx",
      "args": ["mcp-deutsche-bahn"]
    }
  }
}

Restart Claude Desktop (⌘Q + reopen — closing the window isn't enough). A plug icon appears in the input bar → click it → confirm deutsche-bahn lists 6 tools.

Claude Code

claude mcp add deutsche-bahn -- uvx mcp-deutsche-bahn

Cursor / other MCP clients

Same shape — command: uvx, args: ["mcp-deutsche-bahn"].


Try it

Ask your assistant:

What are my options getting from Berlin Hbf to Munich tomorrow at 8am, and is there any construction on that route?

It will call search_journeys and get_disruptions and stitch a human answer.


Optional: standalone CLI agent

If you want a plain-English REPL without Claude Desktop, the package ships an anthropic-powered front-end that drives the MCP server directly:

export ANTHROPIC_API_KEY=sk-ant-...
uvx --from mcp-deutsche-bahn mcp-deutsche-bahn-agent                              # interactive
uvx --from mcp-deutsche-bahn mcp-deutsche-bahn-agent "next trains out of Hamburg" # one-shot

Local development

git clone https://github.com/heykay/mcp-deutsche-bahn.git
cd mcp-deutsche-bahn
uv sync --extra dev
uv run pytest -m live   # smoke tests, hit the real API
uv run ruff check .

Run the server in inspector mode to poke individual tools without an MCP client:

npx @modelcontextprotocol/inspector uv run mcp-deutsche-bahn

To point Claude Desktop at your local checkout (instead of the published package), use uv --directory /path/to/clone run mcp-deutsche-bahn as the command.


Roadmap

  • v0.2: hosted/remote MCP variant (HTTP + SSE) for non-CLI users
  • v0.2: richer strike signal — wire to a real news API
  • v0.3: ticket-price comparison via DB API Marketplace

Contributing

PRs welcome. File issues with the query that broke and the JSON the tool returned.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_deutsche_bahn-0.2.0.tar.gz (88.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_deutsche_bahn-0.2.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_deutsche_bahn-0.2.0.tar.gz.

File metadata

  • Download URL: mcp_deutsche_bahn-0.2.0.tar.gz
  • Upload date:
  • Size: 88.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mcp_deutsche_bahn-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2b6b96aa5822b31cd071a1853c196c624036278e227cba33dac0d72a8c349602
MD5 c76a6b3924567c5aa007c3e7d9b9307d
BLAKE2b-256 55a4c4e911ef5302807f32345d2ed0d5510867f709ea639791bff96e0c400fdf

See more details on using hashes here.

File details

Details for the file mcp_deutsche_bahn-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_deutsche_bahn-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mcp_deutsche_bahn-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57520155287ce3a1867b04f90dec58feb8c476002d7790aa435de257e04d6619
MD5 3f89ba2371b7492598161497bb1b4f7b
BLAKE2b-256 2e1f793eb2f724cc365c008caa7b3e02cc59728c746e3ac95a601d1dffbcf08d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page