Skip to main content
Glama

rmv

Release crates.io Docker udondan/rmv MCP server CI codecov Maintainability License

CLI and MCP server for public transport departures and connections in the Rhein-Main-Verkehrsverbund (RMV), on the RMV OpenData API (HAFAS ReST).

It is built for callers that check fixed daily trips, like a script or an agent asking in the morning whether the usual train still runs. For each connection it reports scheduled and actual times, delays, cancellations and RMV's disruption messages, and sums them up in one status:

Status

Meaning

ok

As planned, as far as the realtime data tells

delayed

The arrival is late, or the departure is off its schedule

cancelled

A ride, or boarding or alighting at a stop of it, is cancelled

unreachable

A transfer can no longer be made, or the first ride has left

no_realtime

No realtime data: the times are the timetable

A cancelled connection stays in the result, marked as cancelled, instead of silently dropping out. reasons says why, like {"kind": "transfer_missed", "leg": 2, "margin_minutes": -3}. docs/status.md explains the rules.

Contents

Related MCP server: Bay Area Transit MCP

Installation

brew install udondan/software/rmv   # macOS and Linux
cargo install rmv                   # from source
docker pull udondan/rmv             # see Docker below

The releases also have binaries for Linux (x86_64, aarch64, static), macOS and Windows, each with the shell completion scripts. SHA256SUMS.txt lists their checksums and is signed with the GPG key F111A9BDD62F384A:

gpg --verify SHA256SUMS.txt.asc SHA256SUMS.txt
sha256sum --check --ignore-missing SHA256SUMS.txt

The Docker image is signed with cosign by the release workflow:

cosign verify udondan/rmv \
  --certificate-identity-regexp '^https://github.com/udondan/rmv/' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Access key

Every request to the RMV API needs an access key of your own. No key comes with rmv, its image or its releases: the terms of use make it personal and confidential, and forbid passing it on.

  1. Request one on the RMV OpenData page.

  2. Set it once. - reads it from standard input, so it stays out of the shell history:

    rmv config set access_id -

    RMV_ACCESS_ID sets it for a single run instead.

Without a key, rmv sends no request at all and answers access_id_missing. A key the API rejects gives access_denied. RMV deletes keys that have not been used for more than 180 days.

The key is a query parameter of every request, so every URL contains it. rmv never prints it: not in output, errors or logs, even with -vv.

Shell completion, loaded when the shell starts (bash shown; zsh, fish, elvish and powershell work the same way):

source <(rmv completion bash)

Usage

$ rmv stops Hauptwache
Frankfurt (Main) Hauptwache
  3000001
Daten: Rhein-Main-Verkehrsverbund (RMV), https://www.rmv.de/s/de/rmv-open-data

$ rmv departures 3000010 --count 3
Departures at Frankfurt (Main) Hauptbahnhof tief
08:40 +15 S2 → Dietzenbach Bahnhof track 102
          ! S1, S2: Halt entfällt und Teilausfälle bis 13.12.
08:44     12 → Frankfurt (Main) Rheinlandstraße
08:44 +2  S8 → Offenbach (Main)-Offenbach Ost Ostbahnhof track 102
Daten: Rhein-Main-Verkehrsverbund (RMV), https://www.rmv.de/s/de/rmv-open-data

$ rmv trip 3000010 3000001 --count 2
Frankfurt (Main) Hauptbahnhof tief → Frankfurt (Main) Hauptwache
1. 08:44 +2 → 08:47 +1  2 min, 0 transfers  delayed
   S8 → Offenbach (Main)-Offenbach Ost Ostbahnhof
     08:44 +2  Frankfurt (Main) Hauptbahnhof tief track 102
     08:47 +1  Frankfurt (Main) Hauptwache track 2
2. 08:47 → 08:50  3 min, 0 transfers  ok
   S6 → Darmstadt Hauptbahnhof
     08:47     Frankfurt (Main) Hauptbahnhof tief track 101
     08:50     Frankfurt (Main) Hauptwache track 2
Daten: Rhein-Main-Verkehrsverbund (RMV), https://www.rmv.de/s/de/rmv-open-data

Command

Does

stops <name> [--near LAT,LON] [--count N]

Finds stops by name, with their IDs (up to 20)

departures <stop> [--time T] [--count N] [--arrivals] [--modes M]

The next departures or arrivals at a stop (up to 100)

trip <from> <to> [--arrive T | --depart T] [--count N] [--modes M] [--max-transfers N] [--realtime-routing]

Connections, each with its status (up to 6)

journey <trip-id>

A trip with all its stops, by its ID from departures or trip

recheck <token>

A connection again, with current data, by its recheck_token from trip

config show|path|get|set|unset

The configuration file

mcp [--http [ADDR]]

The MCP server

completion <shell>

The completion script

  • Stops are given by ID, like 3000010 or A=1@L=3000010@, or by a name that fits exactly one stop. A name that fits several gives ambiguous_stop with the candidates and their IDs, never a guess. trip also takes coordinates LAT,LON.

  • Times are HH:MM (always today, in Europe/Berlin, never rolled over to tomorrow), a local time like 2026-11-27T07:50, or RFC 3339.

  • trip --arrive 07:50 returns the connections arriving last before 07:50, together with earlier ones to switch to.

  • recheck asks RMV for exactly the connection you picked, with the current delays and cancellations. That is the cheapest way to poll a fixed trip: one request, no stop lookups.

  • Pages: results have a page_cursor with earlier and later (for departures only later); pass one with --page-cursor.

Modes

--modes takes a comma-separated list of these names, in any case. They stand for product classes of RMV:

Mode

RMV products

Class

HIGHSPEED_RAIL

ICE

1

LONG_DISTANCE

IC, ECE, NJ

2

REGIONAL_RAIL

RE, RB

4

SUBURBAN

S-Bahn

8

SUBWAY

U-Bahn

16

TRAM

Tram

32

BUS

Regional and city buses

64, 128

ODM

On-demand services (AST, ALT)

512

RAIL

All trains: the first four

1, 2, 4, 8

Results name the mode of each ride the same way, and OTHER for a class not listed.

Output

-o text|json|yaml chooses the format. JSON is the default when stdout is not a terminal, so scripts get JSON without asking. Errors are printed in the same format on stderr, with a stable status, and the exit code is 1 (2 for invalid arguments):

status

Meaning

access_id_missing

No access key configured; nothing was sent

access_denied

RMV rejected the access key

config_error

The configuration file or a setting is invalid

invalid_input

(MCP) A time, mode or place could not be read; the CLI reports these as usage errors

ambiguous_stop

The name fits several stops; see candidates

stop_not_found

No stop has that name

not_found

RMV does not know the stop or trip ID

rate_limited

The quota of the key is used up, or too many requests came at once; see retry_after_seconds

timeout, unavailable, bad_request, upstream_error

RMV did not answer, or refused

Text output always ends with the attribution of the data, which must be kept. JSON has it as attribution.

Besides the fields of each result, stops and stop events have dhid, the German stop ID like de:06412:10, and results have realtime_as_of, when RMV last updated its realtime data.

MCP server

rmv mcp serves five read-only tools to an MCP client on stdin and stdout. Each has an output schema and returns a one-line summary followed by the same JSON as the CLI.

Tool

Returns

rmv_find_stop

Stops by name, with their IDs

rmv_departures

The next departures or arrivals at a stop

rmv_trip

Connections between two places, each with its status and reasons

rmv_journey

A trip with all its stops

rmv_recheck

A connection from rmv_trip again, with current data

For example, in Claude Code:

claude mcp add rmv -e RMV_ACCESS_ID=<your key> -- rmv mcp

Or in the configuration of another client:

{
  "mcpServers": {
    "rmv": {
      "command": "rmv",
      "args": ["mcp"],
      "env": { "RMV_ACCESS_ID": "<your key>" }
    }
  }
}

With the key in the configuration file (rmv config set access_id -), the env entry is not needed.

The server tells the model that stop names and disruption texts from the API are data, not instructions, and that every call costs requests of the quota.

Agents that use the CLI instead can load the skill in skills/rmv/SKILL.md.

HTTP

rmv mcp --http serves streamable HTTP at http://127.0.0.1:8080/mcp; --http 0.0.0.0:9000 takes another address. It needs a bearer token of at least 16 characters in RMV_MCP_TOKEN, which every request must send as Authorization: Bearer <token>:

export RMV_MCP_TOKEN=$(openssl rand -hex 32)
rmv mcp --http
claude mcp add --transport http rmv http://127.0.0.1:8080/mcp \
  --header "Authorization: Bearer $RMV_MCP_TOKEN"

The server shuts down cleanly on SIGINT and SIGTERM. It serves plain HTTP; put a TLS proxy in front of it to reach it over a network. It is for your own clients only: the terms of use forbid giving others access through your key.

Docker

The image runs rmv; without a command it starts the MCP server on stdio. It holds no key and no state, so it needs no volume:

docker run --rm -i -e RMV_ACCESS_ID udondan/rmv
docker run --rm -e RMV_ACCESS_ID udondan/rmv departures 3000010

mise run docker-build builds the image from source. For the Docker MCP Toolkit, mise run docker builds it and adds docker-mcp.yml to a profile. Set the secret rmv.access_id with docker mcp secret set.

The server is also in the MCP Registry as io.github.udondan/rmv.

Configuration

rmv config path shows the file, by default ~/.config/rmv/config.toml (%APPDATA% on Windows). rmv config show shows the settings in effect, with the key masked.

Setting

Default

Meaning

access_id

–

Your access key

base_url

https://www.rmv.de/hapi/

Another HAFAS ReST server

timeout_seconds

20

How long a command may take, retries and waits included

retries

2

Retries after a transient error, at most 5; 0 turns them off

delay_threshold_minutes

2

From how many minutes late an arrival counts as delayed

Variable

Does

RMV_ACCESS_ID

Overrides access_id

RMV_BASE_URL

Overrides base_url

RMV_CONFIG

Another configuration file

RMV_OUTPUT

The output format, like -o

RMV_LOG, RMV_LOG_FILE

Log level, like debug or hafas=debug, and a log file

RMV_MCP_TOKEN

The bearer token of mcp --http

RMV_NOW

Evaluate the status as if it were another time, as RFC 3339 like 2026-11-27T07:50:00+01:00; HH:MM times then count from that day

https://www.rmv.de/hapi/latest/ runs the next version of the API (2.52), which RMV offers for testing. rmv works with both versions, but use latest/ only to try it out.

Requests and quota

An access key may make 600 requests per hour and 5000 per day, shared by everything that uses it. rmv has no cache and no counter: it cannot see what else uses your key, so keeping within the quota is up to you. When RMV reports the quota as used up, the answer is rate_limited.

What a command costs:

  • one request for the search itself;

  • one more for every stop given by name instead of ID (trip with two names makes three). IDs and LAT,LON cost nothing extra;

  • trip --arrive: one more for an earlier page when the first has too few connections;

  • after a connection error, a timeout or a 500, 502, 503 or 504, up to retries more (2 by default), with waits of about 0.5 and 1 second, all within timeout_seconds. Errors that RMV reports with a code, like an invalid key, the used up quota or wrong parameters, are never retried. Set retries = 0 to make every command cost exactly what is listed above.

Polling one connection every 5 minutes for an hour with recheck costs 12 requests. Never run rmv in a loop without a pause: the terms of use forbid crawling and bulk downloads.

Merging with other sources

RMV knows cancellations and disruption messages in its area that wider sources often lack, while other sources cover more area. The output uses plain, documented field names so that it can be merged with data from other journey planners; docs/merging.md lists the join keys. How RMV reports realtime data is described in docs/realtime-findings.md.

Crates

Crate

crates.io

docs.rs

Purpose

hafas

hafas on crates.io

hafas on docs.rs

Neutral client for the HAFAS ReST API, versions 2.39 and 2.52

rmv-core

rmv-core on crates.io

rmv-core on docs.rs

Configuration, access key, retries, stop resolution, status and the output model

hafas-sim

hafas-sim on crates.io

hafas-sim on docs.rs

Fake HAFAS server for tests

rmv

rmv on crates.io

–

The binary: CLI and rmv mcp

Data and terms

Daten: Rhein-Main-Verkehrsverbund (RMV), from the RMV OpenData API, under the RMV terms of use. They allow the results for passenger information, for the user who asked, and forbid storing or publishing a substantial part of them. RMV can change or end the API at any time.

This project is not affiliated with RMV.

Security and contributing

See SECURITY.md and CONTRIBUTING.md.

License

Apache-2.0. The license covers the code, not the data.

Available Tools

5 tools
rmv_departuresDepartures at a stopA
Read-onlyIdempotent

Lists the next departures, or with arrivals the arrivals, at one stop in the RMV area from time on: each with mode, line, operator, headsign, planned and realtime time, delay, track, cancellation of the stop or the whole ride, and alerts, and the trip_id for rmv_journey. Use it for what leaves a stop soon; to get from A to B with transfers use rmv_trip, for all stops of one ride rmv_journey. page_cursor.later of the result pages on. Each call costs one request of the access key's quota, and one more for a stop given by name (answer rate_limited with retry_after_seconds when it is used up).

Inputs: stop (required), time, count, modes, +2 more. Returns: stop, arrivals, warnings, departures, +3 more

rmv_find_stopFind a stopA
Read-onlyIdempotent

Searches stops in the RMV area by name, or a part of it, and returns up to count matches (default 10, at most 20), each with stop ID, name, area, DHID, coordinates and modes; near ranks stops close to a place first. Use it to get a stop ID, or when a name is ambiguous: rmv_departures and rmv_trip also take a name that fits one stop, and answer ambiguous_stop with candidates otherwise. One request of the access key's quota (answer rate_limited with retry_after_seconds when it is used up).

Inputs: name (required), near, count. Returns: query, stops, warnings, attribution

rmv_journeyOne ride with all stopsA
Read-onlyIdempotent

Returns one ride (a vehicle's trip) in the RMV area with line, operator, headsign, whether it is cancelled, its alerts, and every stop with planned and realtime times, delays, tracks and cancelled stops. Takes the trip_id of a departure from rmv_departures or of a leg from rmv_trip. Use it to follow a train along its route or to see where a delay starts. One request of the access key's quota (answer rate_limited with retry_after_seconds when it is used up).

Inputs: trip_id (required). Returns: line, mode, stops, alerts, +8 more

rmv_recheckCheck a connection againA
Read-onlyIdempotent

Returns one connection found by rmv_trip again, with current realtime times and its status (ok, delayed, cancelled, unreachable or no_realtime) and the reasons, in the same form as rmv_trip with one connection. Takes the recheck_token of that connection. Use it to follow a planned connection before and during the ride, instead of a new search with rmv_trip. One request of the access key's quota (answer rate_limited with retry_after_seconds when it is used up); ask every few minutes at most.

Inputs: recheck_token (required). Returns: to, from, warnings, attribution, +3 more

rmv_tripConnections from A to BA
Read-onlyIdempotent

Searches connections in the RMV area between two stops or places, each with departure, arrival, duration, transfers, its legs (with trip_id), a status: ok, delayed, cancelled, unreachable (a transfer is missed or the first ride has left) or no_realtime, with the reasons, and a recheck_token for rmv_recheck. With arrive_by, the connections arriving last before time, and earlier ones to switch to. Use it to plan a route; to check a connection found before use rmv_recheck, for one stop's departures rmv_departures, for one ride with all stops rmv_journey. page_cursor.earlier and later page through more. Each call costs one or two requests of the access key's quota, and one more for each stop given by name (answer rate_limited with retry_after_seconds when it is used up); ask every few minutes at most for the same trip.

Inputs: to (required), from (required), time, count, +5 more. Returns: to, from, warnings, attribution, +3 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 5 tools

    Disambiguation5/5

    Each tool targets a distinct question: departures at one stop, stop lookup, a single ride's route, A-to-B connection search, and rechecking an existing connection. The descriptions explicitly cross-reference each other (e.g. 'to get from A to B use rmv_trip, for all stops of one ride rmv_journey'), making boundaries unambiguous.

    Naming Consistency4/5

    All tools share the rmv_ prefix and snake_case, which is predictable. The only minor deviation is mixing noun-style names (rmv_departures, rmv_journey, rmv_trip) with verb-style ones (rmv_find_stop, rmv_recheck), but this remains readable and intuitive.

    Tool Count5/5

    Five tools is a tight, well-scoped set for a transit API, with each tool earning its place and no redundant entries. Nothing feels thin or bloated.

    Completeness4/5

    The surface covers the core lifecycle: find stop, plan trip, inspect ride, watch departures, and recheck a connection. Minor gaps exist (no dedicated alerts/disruption or operator/line lookup tool), but agents can work around these via the alert data embedded in other responses.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers