Skip to main content
Glama

motis-mcp

CI

A local MCP (Model Context Protocol) server that gives Claude Desktop and Claude Code live access to German (and wider European) public transport data - station search, departures, arrivals, journey planning, and realtime trip tracking - so you can ask Claude things like "when's the next train from Berlin Hbf to Munich Hbf tomorrow morning?" and get real answers.

It calls the MOTIS API of the public Transitous service directly from the MCP server's own Node.js process (via MOTIS' generated client @motis-project/motis-client). No extra service, no Docker container - just your own local process calling the backend directly.

This project is a thin wrapper, not a data provider: each tool call is passed straight to the MOTIS API, and the response is only trimmed down to the fields an AI agent needs (see What you can do with it). It doesn't cache or correct the data - accuracy, coverage, and formatting are entirely down to Transitous/MOTIS (see Data source & usage policy below).

Status: early (version 0.x). The tools work against the public Transitous service, which comes with no uptime guarantee; tool parameters and outputs may still change between minor versions (see the release notes).

Why this exists

I wanted to plan a multi-stop Geocaching roundtrip through Brandenburg using regional trains - the stops along the way chosen for the caches nearby - and couldn't find a comfortable tool for it: the options I tried each fell short in some way. So I built this instead, with Claude Code.

Related MCP server: BVG MCP Server

What you can do with it

Once the server is connected to an MCP-capable AI agent or assistant (see Requirements and setup), the agent gains six tools it can call on its own during a conversation:

Tool

What it does

find_stations

Search stations/stops by name -> id, name, lat/lon, served products

get_stop

Look up a single stop/station by its ID, with the lines serving it

get_departures

Departures at a stop in a time window (default: next 30 minutes, max. 20 entries; any start time), optionally only certain kinds of transport

get_arrivals

Arrivals at a stop in a time window (default: next 30 minutes, max. 20 entries; any start time), optionally only certain kinds of transport

plan_journey

Plan a journey between two stops, optionally at a specific departure/arrival time, with only certain kinds of transport (e.g. Deutschlandticket-valid), a maximum number of changes, a minimum transfer time, up to two stops along the way (each with a minimum stay), bike transport or wheelchair routing; pages to later/earlier connections

get_trip

Full stop-by-stop realtime schedule for one specific trip (e.g. to track delays)

You don't call these tools yourself - you talk to the agent normally, and it chains them as needed. Example prompts:

  • "Find the station ID for Frankfurt Hauptbahnhof"

  • "What are the next trains from Berlin Hbf to Hamburg Hbf tomorrow at 9am?"

  • "Show me live departures from Koeln Hbf in the next 20 minutes"

  • "Is ICE 623 running on time right now?"

  • "How do I get from Berlin to Rostock tomorrow morning with the Deutschlandticket? I need at least 10 minutes for each change."

  • "Plan a trip from Berlin to München with a two-hour stop in Leipzig."

  • "Can I take my bike from Berlin Ostbahnhof to Potsdam by train?"

  • "Plan a trip from Berlin Hbf via Cottbus to Frankfurt(Oder) ... and back for next Saturday starting at 9 am."

Results are compact JSON trimmed to what's needed to answer travel questions (the raw backend responses repeat full station metadata on every entry and would quickly exhaust an agent's tool-output limit). Times are ISO 8601 with UTC offset, delays are in seconds, and time inputs must include an explicit offset (e.g. 2026-11-14T08:00+01:00). All times are given in the local time of the respective station (e.g. a London departure in UK time, the arrival in Paris in French time), and each stop carries its time zone, so the agent can present local times and point out time-zone differences where they matter.

An agent typically calls find_stations first to resolve station names to IDs, then feeds those IDs into plan_journey, get_departures, etc. Station IDs from this backend are opaque GTFS-style strings (e.g. at-Railway-Current-Reference-Data-2026_de:11000:900003200:1:51), not short numeric codes - always resolve them via find_stations rather than guessing or hardcoding one. The same station can appear under several IDs (one per data feed that covers it), and departure boards list the specific platform/bus stop each vehicle leaves from, so IDs in results won't always match the ID you asked for. IDs also change over time (some feeds are renamed every timetable year), so don't store them for later use.

Requirements and setup

Requirements

  • Node.js 22+

  • An AI client that supports local (stdio) MCP servers - for example Claude Desktop, Claude Code, OpenAI Codex CLI, VS Code (GitHub Copilot agent mode), Cursor, or Google Antigravity (CLI, IDE or app).

  • Note: ChatGPT (web) currently connects only to remote MCP servers over HTTPS (SSE/streaming HTTP, as of November 2026), so it can't use this local server directly.

Setup steps

  1. Get and build the server (works the same on macOS, Linux and Windows - plain npm scripts):

    git clone --branch v0.1.0 https://github.com/esikora/motis-mcp.git
    cd motis-mcp
    npm install
    npm run build

    v0.1.0 is the latest release (see Releases); without --branch v0.1.0 you get the current development state of main instead. This produces dist/index.js. MCP clients run the built file and don't build TypeScript for you.

    To update to a newer release later: git fetch --tags, git checkout v<version>, npm install, npm run build, then fully restart your client.

  2. Register the server in your AI client as a local (stdio) server: the command is node, the only argument is the absolute path to dist/index.js, and optional environment variables come from Configuration below. Many clients (e.g. Claude Desktop, Cursor, Google Antigravity) use this JSON shape; others use a different format (e.g. VS Code uses a servers key, Codex CLI a TOML file):

    {
      "mcpServers": {
        "motis": {
          "command": "node",
          "args": ["/absolute/path/to/motis-mcp/dist/index.js"]
        }
      }
    }
  3. Restart or reload the client, check that the server shows as connected and its six tools are listed, then try one of the example prompts above.

The up-to-date, authoritative instructions are in your client's own documentation - config locations and UI change between releases. Official guides (checked November 2026):

Client

How to add a local MCP server

Claude Desktop

Connect to local MCP servers

Claude Code

Connect Claude Code to tools via MCP

OpenAI Codex CLI

Model Context Protocol

VS Code (GitHub Copilot)

Add and use MCP servers in VS Code

Cursor

Model Context Protocol (MCP)

Google Antigravity (CLI, IDE, app)

MCP servers (config file ~/.gemini/config/mcp_config.json, same mcpServers format)

ChatGPT

Add custom MCP server (remote servers only, see Requirements)

Tips:

  • On Windows, escape backslashes in JSON: "C:\\path\\to\\motis-mcp\\dist\\index.js".

  • Desktop apps don't always see the same PATH as your terminal. If the server fails to start with "node not found" or similar, use the full path to the Node executable as command (find it with where node on Windows or which node on macOS/Linux).

  • If you have other public-transport MCP servers connected (e.g. for DB station boards), the model may pick their tools instead of these. To be sure which server answered, expand a tool call in the conversation: it shows the server name.

Example: Claude Desktop

Open the config file from within the app, so you edit the file your installation actually uses instead of looking for it by hand. Where to find it depends on the app version: in version 7.37095.0 (Windows, November 2026) go to Settings -> Desktop app, scroll to the bottom and click Manage in the Extensions section (German: Einstellungen -> Desktop-App, section Erweiterungen, button Verwalten). This opens Desktop app / Extensions (German: Desktop-App / Erweiterungen), where the section Local MCP servers (German: Lokale MCP-Server) has the button Edit config (German: Konfiguration bearbeiten). On Windows it opens File Explorer in the config folder with claude_desktop_config.json selected; open that file in a text editor. Older versions had Settings -> Developer -> Edit Config. Add the mcpServers entry from step 2 and save.

Then fully quit Claude Desktop and start it again. Closing the window is not enough: the app keeps running in the background with the old configuration. On Windows, right-click the tray icon and choose Quit (or end it in Task Manager).

To check the result, open Settings -> Plugins: the server is listed under the key from your mcpServers entry (e.g. motis), with "Local MCP servers" and its six read-only tools. If an old name or no entry shows up, the app has not reloaded the configuration. "Unknown developer" is normal for servers added through the config file, and the app does not show the server version.

For reference, typical locations of claude_desktop_config.json (they can differ between installation types and versions):

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows (standard installer, per the official docs): %APPDATA%\Claude\claude_desktop_config.json

  • Windows (Microsoft Store install, observed November 2026): %LOCALAPPDATA%\Claude-Data\claude_pzs8sxrjxfjjc\claude_desktop_config.json

Example: Claude Code

claude mcp add --transport stdio motis -- node /absolute/path/to/motis-mcp/dist/index.js

On Windows: claude mcp add --transport stdio motis -- node C:\path\to\motis-mcp\dist\index.js. Add --scope user to make it available in all your projects (see claude mcp add --help), and check the result with claude mcp list.

Configuration

Optional environment variables:

Env var

Default

Purpose

MOTIS_TIMEOUT_MS

20000

Per-call backend timeout. A call that takes longer returns a tool error instead of leaving the agent waiting.

MOTIS_BASE_URL

https://api.transitous.org

Base URL of the MOTIS instance to use. Change it only if you run your own MOTIS instance; the usage policy (see Data source & usage policy) applies to the public instance.

Most clients accept them in the server entry, e.g. in the JSON format from step 2:

"motis": {
  "command": "node",
  "args": ["/absolute/path/to/motis-mcp/dist/index.js"],
  "env": { "MOTIS_TIMEOUT_MS": "30000" }
}

Data source & usage policy

By default this server queries the public MOTIS instance of Transitous, which describes itself as "a community-run provider-neutral international public transport routing service", "provided by a community of volunteers". It is not Deutsche Bahn's own official backend.

Transitous aggregates open GTFS feeds across Europe, including DB's own published schedule data, so long-distance and regional German trains are covered - but it's a different data source with different tradeoffs (see Known limitations).

Transitous has a usage policy worth knowing before you rely on this:

  • Open source and non-commercial use only: their policy asks for source code under an open-source license and says "commercial use is not allowed". This project is open source and non-commercial.

  • Attribution required: their policy asks that a link to transitous.org/sources/ be visible somewhere in any app using their data, that the conditions of those sources are respected, and in particular OpenStreetMap's attribution guidelines. This project shows the attribution in the Third-party data attribution section of this README, in the server's startup line in your client's MCP log, and at the end of every tool result, for the agent to credit once per conversation (the server instructions also ask the agent to name the versions, for clients that pass them on).

  • Best effort: "We provide the service on a best-effort basis and reserve the right to stop providing it to any consumer at any time." Expect occasional downtime. If your requests might need significant resources, their policy asks you to contact the Transitous team first (see the usage policy for how and when). Please keep your own request volume modest.

  • User-Agent: every request must name the application and its version and give a way of contact. This project sends motis-mcp/<version> (+https://github.com/esikora/motis-mcp) (set in src/index.ts; the version identifies the build, e.g. 0.1.0 or 0.1.0+3.g1a2b3c4) - if you fork this under a different repo, update it to point at your own fork per the policy.

Sources (checked 2026-11-28): the Transitous homepage and usage policy for the description and the points above (open source and non-commercial use, best effort, contact before significant resource use, User-Agent, attribution), their data sources page for the use of OpenStreetMap data, and the OpenStreetMap Foundation's attribution guidelines. If something here no longer matches those pages, the pages apply.

What is sent where: each tool call sends its parameters (search text, stop IDs, times and options) to the MOTIS instance - by default transitous.org - with the User-Agent above. The server itself stores nothing and keeps no logs beyond what your AI client records.

If you'd rather point at your own infrastructure, set MOTIS_BASE_URL to any MOTIS instance you run yourself (see Configuration) - the policy above only applies to the public instance.

Known limitations

  • Not DB's official data. Coverage, station naming, and realtime quality depend on what GTFS feeds Transitous ingests. Fuzzy name search can surface an oddly-named or slightly-off match as the top hit (e.g. searching "München Hauptbahnhof" may return an entity named "Hauptbahnhof Süd" as the closest station match) even when the underlying data is for the right hub - always use the resolved id, and sanity-check names in the results.

  • No ticket/price data. Unlike DB's own commercial APIs, this is a routing engine over open schedule data - don't expect fares or booking info.

  • No caching - every tool call hits the backend directly.

  • stdio transport only (no SSE/HTTP), so clients that only support remote MCP servers (e.g. ChatGPT web) can't use it.

  • No uptime guarantee for the public Transitous instance (see Data source & usage policy).

Combining with DB's official station boards

If you also want Deutsche Bahn's own, first-hand station boards (delays, platform changes, cancellations and disruption messages directly from DB), you can run db-timetable-mcp next to this server in the same AI client. The agent can then use both. motis-mcp does not integrate DB's API itself.

Things to know before adding it (as of November 2026):

  • Registration required: since version 3.0 it uses DB's new OpenBoards API, so you need an account on the DB API Marketplace and a subscription to the Open Boards product (DB offers a free plan with 10 calls/second). Older versions used the Timetables API, which no longer accepts new subscriptions and is planned to be shut down around mid-2027, so new users need version 3 or later.

  • Rail station boards only: departures and arrivals of German rail stations, no journey planning. Journey planning, buses, trams and other countries stay with motis-mcp.

  • Different station IDs: it uses DB station numbers (e.g. 8000105 for Frankfurt(Main)Hbf), not the IDs of this server, so results of the two servers can't be passed to each other's tools.

  • We compared it with version 2 (Timetables API); version 3 has not been tested by us.

Sources: db-timetable-mcp's pull request #71 (version 3.0, OpenBoards; merged 2026-11-23), DB's OpenBoards product page (free plan, checked 2026-11-26) and DB's announcement to Timetables API users (no new subscriptions, shutdown around mid-2027; November 2026). Details and dates: docs/data-sources.md > "DB OpenBoards" and "Related MCP servers".

In a spot check at Frankfurt(Main)Hbf, both sources agreed on almost all departures; DB's data was somewhat more complete for realtime details.

Troubleshooting

  • The client shows the server as disconnected / it errors immediately - confirm dist/index.js exists (npm run build), that the path in your config is correct and absolute, and that the client can find node (see the tips under Setup steps).

  • Which version is running? / Changes don't show up after an update - the client runs the build in the folder your config points to. Its version is in dist/build-info.json there, written by npm run build (e.g. 0.1.0 for a release, 0.1.0+3.g1a2b3c4 for 3 commits after it); the server also reports it to the client on connect, but not every client displays it. It is also in the server's startup line in the client's MCP log, e.g. motis-mcp 0.1.0 running (motis-client 2.11.4, …) (Claude Desktop: the mcp-server-<name>.log file in its logs folder). After updating (a newer release, or git pull on main), run npm install and npm run build and fully restart the client (see Example: Claude Desktop). If the version is right but the behaviour isn't, check that the config points to the folder you updated and not to another copy.

  • Tool calls return an error mentioning an HTTP status - most likely the public Transitous instance is temporarily down or overloaded. Wait and retry. If it persists, check the status page linked from the Transitous documentation (checked 2026-11-28).

  • A station name resolves to an oddly-named or unexpected result - this is a data-source characteristic (see Known limitations), not a bug: find_stations returns whatever Transitous's geocoder ranks highest, which can be a sub-entity of a larger station complex. Check the name field of results before assuming the id is wrong.

Development

Working on motis-mcp itself (building, tests, git workflow, internals)? See README-DEV.md. Bug reports and suggestions are welcome as GitHub issues; for pull requests, please open an issue first (see CONTRIBUTING.md). Wrong or missing data (stations, times, delays, disruptions, coverage) is not a motis-mcp issue and cannot be fixed here: it comes from the operators' feeds via Transitous (see Known limitations), so please do not open issues for it. Security vulnerabilities: please report them privately, see SECURITY.md.

Third-party data attribution

  • Transit data: provided by Transitous from open GTFS/GTFS-RT feeds - see the list of data sources and their licenses.

  • Map data: walking routes and distances, geocoding (station addresses) and some stop metadata are based on OpenStreetMap, available under the Open Database License (ODbL). Sources (checked 2026-11-28): the Transitous data sources page for the use of OpenStreetMap data, the OpenStreetMap Foundation's attribution guidelines for the form of the credit.

License

This project's own code is MIT-licensed. All dependencies (checked directly and transitively) are permissively licensed (MIT/ISC/BSD/Apache-2.0/CC0) - none impose copyleft obligations on this project. The one thing to be aware of is that the data returned by this server's tools comes from third parties under their own terms, not this project's license - see Data source & usage policy and Third-party data attribution above.

Available Tools

6 tools
find_stationsFind stationsA
Read-only

Search stops/stations by name (e.g. "Berlin Hbf", "Alexanderplatz", a town name). Returns a ranked list of stops only (no addresses or POIs). Call this first: every other tool takes an id, never a name. Ids are opaque; never guess, hardcode or reuse them across sessions. The same station can appear under several ids (one per data feed); any of them works. Results: JSON, then "Hints:" (situational advice; attribution, credit once).

Inputs: query (required), results.

get_arrivalsGet arrivalsA
Read-only

The arrivals board of a stop/station in a time window: line, origin, platform, realtime delay and the tripId of each vehicle run (for get_trip), ordered by arrival time. Large stations include related stops of the same hub; each entry's stop is the exact stop/platform. Disruption notices are listed once in alerts; entries refer to them by index. Use find_stations first if you only have a name. Times are ISO 8601 in each station's local time with its UTC offset; stops carry their IANA tz (none = German time). Delays in seconds (positive = late). Planned values equal to realtime ones and empty fields are omitted. Results: JSON, then "Hints:" (situational advice; attribution, credit once).

Inputs: stopId (required), when, results, duration, +1 more.

get_departuresGet departuresA
Read-only

The departures board of a stop/station in a time window: line, direction, platform, realtime delay and the tripId of each vehicle run (for get_trip), ordered by departure time. Large stations include related stops of the same hub; each entry's stop is the exact stop/platform. Disruption notices are listed once in alerts; entries refer to them by index. Use find_stations first if you only have a name. Times are ISO 8601 in each station's local time with its UTC offset; stops carry their IANA tz (none = German time). Delays in seconds (positive = late). Planned values equal to realtime ones and empty fields are omitted. Results: JSON, then "Hints:" (situational advice; attribution, credit once).

Inputs: stopId (required), when, results, duration, +1 more.

get_stopGet stop detailsA
Read-only

Stop/station details by id: name, coordinates, IANA tz, products and the lines serving it by product, as named in the feeds (long-distance names mix line numbers, train numbers and bare products like ICE; the boards and plan_journey show the actual trains). Use find_stations first if you only have a name. Results: JSON, then "Hints:" (situational advice; attribution, credit once).

Inputs: id (required).

get_tripGet tripA
Read-only

Stop-by-stop realtime schedule of one vehicle run on one day: origin and destination, plus every stop in between in stopovers, with planned/realtime times, delays and platforms. Covers the whole run, not just the leg the tripId came from (an ICE taken from Berlin may start in Hamburg). Use it to check whether a train or bus is on time. A trip id encodes its date: take it from a board or journey of the wanted day, never edit it. Times are ISO 8601 in each station's local time with its UTC offset; stops carry their IANA tz (none = German time). Delays in seconds (positive = late). Planned values equal to realtime ones and empty fields are omitted. Results: JSON, then "Hints:" (situational advice; attribution, credit once).

Inputs: tripId (required).

plan_journeyPlan journeyA
Read-only

Plan journeys between two stops/stations given as ids (use find_stations first). Returns up to results journeys, each a list of legs (walking or a vehicle) with times, line, platform and a tripId for get_trip (legs list no intermediate stops). For later or earlier journeys, call again with the same arguments, but with departure/arrival replaced by laterThan/earlierThan set to the returned laterRef/earlierRef. No ticket or price data. Times are ISO 8601 in each station's local time with its UTC offset; stops carry their IANA tz (none = German time). Delays in seconds (positive = late). Planned values equal to realtime ones and empty fields are omitted. Results: JSON, then "Hints:" (situational advice; attribution, credit once).

Inputs: to (required), from (required), via, bike, +10 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action: station search by name, stop details by id, departures board, arrivals board, journey planning, and single-trip schedule. The only superficially similar pair (get_departures vs get_arrivals) is clearly separated by direction, and get_trip vs plan_journey differ by scope (one vehicle run vs multi-leg itinerary). Descriptions explicitly state when to use find_stations first, removing selection ambiguity.

    Naming Consistency5/5

    All names follow a consistent snake_case verb_noun pattern (find_stations, get_stop, get_departures, get_arrivals, plan_journey, get_trip). Verbs are used meaningfully: find for search, get for retrieval by id, plan for computation.

    Tool Count5/5

    Six tools is well-scoped for a transit API: search, stop metadata, two board directions, journey planning, and trip detail. Each tool earns its place with no redundant or filler operations.

    Completeness4/5

    The core journey workflow is fully covered: name lookup, stop details, boards, planning, and trip tracking. Minor gaps exist, such as no lookup by coordinates/nearby stations, but agents can work around this via name search.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables AI assistants to interact with the Netherlands Railways (NS) API for route planning, pricing, and real-time departure information. It provides tools for searching stations, planning trips with connections, and viewing real-time departure boards.
      3
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for interacting with the Berlin Public Transport (BVG) API to search for locations and plan journeys. It provides real-time access to departures, arrivals, trip details, and vehicle tracking within Berlin's transit network.
      MIT
    • A
      license
      A
      quality
      D
      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
      2
      MIT