Back to Guides

Deutsche Bahn MCP Server — Train Timetables for AI Agents

Search Deutsche Bahn timetables, departures, arrivals, and journeys from any AI agent via MCP. Free DB Fahrplan adapter in AnythingMCP — no API key needed.

Pre-built adapter available on AnythingMCP Cloud

Skip the self-hosted setup — install this adapter in one click with a free trial. No credit card required.

Install on Cloud — Free Trial

Query Deutsche Bahn Timetables with AI Agents

Deutsche Bahn (DB) operates Germany's national rail network plus most of the regional and S-Bahn services. AnythingMCP wraps the community-maintained v6.db.transport.rest proxy over DB's HAFAS API so your AI agent can resolve stations, look up live departures, plan journeys, and surface real-time delay information.

Quick Setup with Built-in Adapter

The Deutsche Bahn adapter ships with AnythingMCP. The endpoint is free and requires no authentication.

Step 1: Deploy AnythingMCP

git clone https://github.com/HelpCode-ai/anythingmcp.git
cd anythingmcp && docker compose up -d

Step 2: Import the Adapter

Open http://localhost:3000/connectors/store, find Deutsche Bahn Fahrplan, and click Import. No credentials are required.

Step 3: Connect to Your AI Agent

{
  "mcpServers": {
    "db": {
      "url": "http://localhost:4000/mcp"
    }
  }
}

Available Tools

| Tool | Description | |------|-------------| | db_search_locations | Resolve a station, address, or POI name to a stop id | | db_get_stop | Stop details — name, location, products served (ICE/IC/RE/S) | | db_get_departures | Live departures with line, destination, delay, platform | | db_get_arrivals | Live arrivals with origin, delay, platform | | db_get_journeys | Plan a journey between two stops with transfers and times |

AI Agent Use Cases

  • "What are the next ICE departures from Freiburg Hbf to Berlin?"
  • "Plan a journey from Munich to Hamburg leaving tomorrow at 8am"
  • "Are there any delays at Frankfurt(Main)Hbf right now?"
  • "How do I get from Stuttgart Hbf to Heidelberg by train this afternoon?"

Production Notes

v6.db.transport.rest is a public, community-maintained proxy hosted best-effort. For mission-critical integrations, consider self-hosting db-rest — the adapter baseUrl can be overridden after import.

Next Steps