MOTIS MCP
# motis-mcp
[](https://github.com/esikora/motis-mcp/actions/workflows/ci.yml)
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](https://github.com/motis-project/motis) API of the public [Transitous](https://transitous.org) service **directly** from the MCP server's own Node.js process (via MOTIS' generated client [`@motis-project/motis-client`](https://www.npmjs.com/package/@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](#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](#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.
## What you can do with it
Once the server is connected to an MCP-capable AI agent or assistant (see [Requirements and setup](#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](https://nodejs.org/en/download) 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):
```bash
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](https://github.com/esikora/motis-mcp/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):
```json
{
"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](https://modelcontextprotocol.io/docs/develop/connect-local-servers) |
| Claude Code | [Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp) |
| OpenAI Codex CLI | [Model Context Protocol](https://learn.chatgpt.com/docs/extend/mcp?surface=cli) |
| VS Code (GitHub Copilot) | [Add and use MCP servers in VS Code](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) |
| Cursor | [Model Context Protocol (MCP)](https://cursor.com/docs/context/mcp) |
| Google Antigravity (CLI, IDE, app) | [MCP servers](https://antigravity.google/docs/mcp/) (config file `~/.gemini/config/mcp_config.json`, same `mcpServers` format) |
| ChatGPT | [Add custom MCP server](https://developers.openai.com/api/docs/guides/developer-mode) (remote servers only, see [Requirements](#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
```bash
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](https://github.com/motis-project/motis) instance to use. Change it only if you run your own MOTIS instance; the usage policy (see [Data source & usage policy](#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:
```json
"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](https://github.com/motis-project/motis) instance of [Transitous](https://transitous.org), 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](#known-limitations)).
Transitous has a [usage policy](https://transitous.org/api/) 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/](https://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](https://www.openstreetmap.org/copyright). This project shows the attribution in the [Third-party data attribution](#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](https://transitous.org/api/) 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](https://transitous.org/) and [usage policy](https://transitous.org/api/) 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](https://transitous.org/sources/) for the use of OpenStreetMap data, and the OpenStreetMap Foundation's [attribution guidelines](https://osmfoundation.org/wiki/Licence/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](#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](#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](https://github.com/jorekai/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](https://developers.deutschebahn.com/db-api-marketplace/apis/product/open-boards) 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](https://github.com/jorekai/db-timetable-mcp/pull/71) (version 3.0, OpenBoards; merged 2026-11-23), DB's [OpenBoards product page](https://developers.deutschebahn.com/db-api-marketplace/apis/product/open-boards) (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](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](#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](#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](https://transitous.org/doc/) (checked 2026-11-28).
- **A station name resolves to an oddly-named or unexpected result** - this is a data-source characteristic (see [Known limitations](#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](README-DEV.md). Bug reports and suggestions are welcome as GitHub issues; for pull requests, please open an issue first (see [CONTRIBUTING.md](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](#known-limitations)), so please do not open issues for it. Security vulnerabilities: please report them privately, see [SECURITY.md](SECURITY.md).
## Third-party data attribution
- **Transit data:** provided by [Transitous](https://transitous.org) from open GTFS/GTFS-RT feeds - see the list of [data sources and their licenses](https://transitous.org/sources/).
- **Map data:** walking routes and distances, geocoding (station addresses) and some stop metadata are based on [OpenStreetMap](https://www.openstreetmap.org/copyright), available under the Open Database License (ODbL). Sources (checked 2026-11-28): the Transitous [data sources page](https://transitous.org/sources/) for the use of OpenStreetMap data, the OpenStreetMap Foundation's [attribution guidelines](https://osmfoundation.org/wiki/Licence/Attribution_Guidelines) for the form of the credit.
## License
This project's own code is [MIT-licensed](LICENSE). 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](#data-source--usage-policy) and [Third-party data attribution](#third-party-data-attribution) above.
TDQS
Scored across 6 tools
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.
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.
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.
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.