Repository avatar
Other Tools
v1.1.0
active

transitous

io.github.udondan/transitous

Stops, departures and connections on Transitous, with cancellations, delays and missed transfers

Documentation

transitous

transitous – Public transport. CLI + MCP.

Release Docker udondan/transitous MCP server CI codecov Maintainability License

CLI and MCP server for public transport connections and departures, using the Transitous API (MOTIS 2).

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

StatusMeaning
okAs planned, as far as the realtime data tells
delayedThe arrival is late, or the departure is off its schedule
cancelledA ride, or boarding or alighting at a stop of it, is cancelled
unreachableA transfer can no longer be made, or the first ride has left
no_realtimeNo 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

Installation

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

The releases also have binaries for Linux (x86_64, aarch64, static), macOS and Windows. 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/transitous \
  --certificate-identity-regexp '^https://github.com/udondan/transitous/' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Set up

Transitous is run by volunteers and asks every client to name a contact in its User-Agent. Set yours once; without it, transitous sends no request at all and answers contact_missing:

transitous config set contact mailto:you@example.org   # or a URL, or an email address

TRANSITOUS_CONTACT sets it for a single run instead.

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

source <(transitous completion bash)

Usage

$ transitous stops "Frankfurt Hauptwache"
Frankfurt (Main) Hauptwache, Frankfurt am Main
  de-DELFI_de:06412:1_G
Frankfurt (Main) Freßgass/Hauptwache, Frankfurt am Main
  de-DELFI_de:06412:60854:1:1
…

$ transitous departures de-DELFI_de:06412:1_G --count 3
Departures at Frankfurt (Main) Hauptwache
23:14     U1 → Frankfurt (Main) Ginnheim Mitte
23:13 +1  U6 → Frankfurt (Main) Ostbahnhof
          ! Frankfurt: U3, U4, U6, U8 - Zusatzfahrten, längere Züge
23:13 +2  S8 → Wiesbaden Hauptbahnhof
Data: Transitous (https://transitous.org) and its sources, …
CommandDoes
stops <name> [--near LAT,LON]Finds stops by name, with their IDs
departures <stop> [--time T] [--count N] [--arrivals] [--modes M]The next departures or arrivals at a stop
trip <from> <to> [--arrive T | --depart T] [--count N] [--modes M] [--max-transfers N] [--realtime-routing]Connections, each with its status
journey <trip-id>A trip with all its stops, by its ID from departures or trip
config show|path|get|set|unsetThe configuration file
usageThe requests of the last 24 hours and the limits
mcp [--http [ADDR]]The MCP server
completion <shell>The completion script
  • Stops are given by ID, 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, never rolled over to tomorrow), a local time like 2026-11-27T07:50, or RFC 3339 with an offset. HH:MM and local times are the time at the stop, in its time zone, like the times of the results: at the stop of departures, at the origin of trip, and at the destination with --arrive. The time zone of the machine or container does not matter.
  • trip --arrive 07:50 returns the connections arriving last before 07:50, together with earlier ones to switch to.
  • Pages: every result has a page_cursor with earlier and later; pass one with --page-cursor.

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:

statusMeaning
contact_missingNo contact configured; nothing was sent
config_errorThe configuration file, a setting or the contact is invalid
invalid_input(MCP) A time, mode or place could not be read; the CLI reports these as usage errors
ambiguous_stopThe name fits several stops; see candidates
stop_not_foundNo stop has that name
not_foundTransitous does not know the stop or trip ID
rate_limitedToo many requests in the last minute; see retry_after_seconds
daily_limitThe daily limit of plan requests is used up; see retry_after_seconds
timeout, unavailable, bad_request, upstream_errorTransitous did not answer, or refused
usage_errorThe usage counter could not be read or written

Text output always ends with the attribution of the data, which must be kept.

MCP server

transitous mcp serves four 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.

ToolReturns
transitous_find_stopStops by name, with their IDs
transitous_departuresThe next departures or arrivals at a stop
transitous_tripConnections between two places, each with its status and reasons
transitous_journeyA trip with all its stops

For example, in Claude Code:

claude mcp add transitous -e TRANSITOUS_CONTACT=mailto:you@example.org -- transitous mcp

Or in the configuration of another client:

{
  "mcpServers": {
    "transitous": {
      "command": "transitous",
      "args": ["mcp"],
      "env": { "TRANSITOUS_CONTACT": "mailto:you@example.org" }
    }
  }
}

The server tells the model that stop names and alert texts from the API are data, not instructions, and asks it to poll rarely.

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

HTTP

transitous 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 TRANSITOUS_MCP_TOKEN, which every request must send as Authorization: Bearer <token>:

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

All sessions share one cache and one usage counter. 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.

Docker

The image runs transitous; without a command it starts the MCP server on stdio:

docker run --rm -i -e TRANSITOUS_CONTACT=mailto:you@example.org udondan/transitous

The cache and the usage counter live in /home/transitous; mount a volume there to keep the counter across containers.

The image is listed in the MCP Registry as io.github.udondan/transitous; clients that install servers from there run this image and ask for TRANSITOUS_CONTACT.

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 the profile transitous. Set the secret transitous.contact with docker mcp secret set.

Configuration

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

SettingDefaultMeaning
contact–Your contact for the User-Agent: a URL, mailto: URL or email address
base_urlhttps://api.transitous.orgAnother MOTIS 2 server
timeout_seconds20How long to wait for an answer
plan_daily_limit720plan requests per 24 hours. Raise it only after agreeing on more with Transitous
delay_threshold_minutes2From how many minutes late an arrival counts as delayed
VariableDoes
TRANSITOUS_CONTACTOverrides contact
TRANSITOUS_BASE_URLOverrides base_url
TRANSITOUS_CONFIGAnother configuration file
TRANSITOUS_OUTPUTThe output format, like -o
TRANSITOUS_NO_CACHE1: no cache, like --no-cache
TRANSITOUS_LOG, TRANSITOUS_LOG_FILELog level, like debug or motis=debug, and a log file
TRANSITOUS_MCP_TOKENThe bearer token of mcp --http
TRANSITOUS_NOWEvaluate 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

Usage rules and limits

transitous follows the usage rules of Transitous:

  • every request carries the User-Agent transitous/<version> (+https://github.com/udondan/transitous; contact: <your contact>);
  • nothing is retried. The only automatic follow-up requests are one earlier page for trip --arrive when the first has too few connections, and one request again when a local time was read in another time zone than the stop's. That happens only for a stop given by ID whose time zone is not known yet; the time zone is then kept for an hour;
  • answers are cached on disk: stop searches for 15 minutes, departures, connections and journeys for 60 seconds;
  • at most 20 requests per minute go out, counted across all processes and MCP sessions; beyond that the answer is rate_limited with retry_after_seconds;
  • plan requests (one per trip) are counted against plan_daily_limit. A warning comes from 80 %, and at the limit the answer is daily_limit.

transitous usage shows the counts. The counter lives in ~/.local/state/transitous/usage.json.

Crates

Cratecrates.iodocs.rsPurpose
motismotis on crates.iomotis on docs.rsNeutral client for the MOTIS 2 API (v2.11.4)
motis-simmotis-sim on crates.iomotis-sim on docs.rsFake MOTIS server for tests, with recorded responses and injected cancellations, delays and errors
transitous-coretransitous-core on crates.iotransitous-core on docs.rsConfiguration, usage rules, cache, stop resolution, status and the output model
transitoustransitous on crates.io–The binary: CLI and transitous mcp

Versioning

transitous follows Semantic Versioning from 1.0.0. Its public interface is the commands and their options, the MCP tools, the JSON and YAML output, the error statuses, the settings and the environment variables. Breaking changes to it come with a new major version only; new fields in the output can come with any minor version. The text output is meant for people and can change at any time.

Data and credits

Timetable and realtime data come from the sources listed by Transitous. Map data © OpenStreetMap contributors. Transitous is a community project run by volunteers, without any guarantee; this project is not affiliated with it.

The feature set builds on ideas from Movm/transitous-mcp.

Security and contributing

See SECURITY.md and CONTRIBUTING.md.

License

Apache-2.0