chitransit
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@chitransit When's the next Brown Line train at Clark/Lake?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
chitransit
Chicago transit data for AI agents and people. chitransit is a command-line tool and an MCP
server built on the official CTA and City of Chicago feeds:
'L' trains: arrivals at any station, live positions of every train, follow one train by run number
The Loop: trains on the elevated ring by line and track, downtown subway trains, line status and downtown alerts, in one call
Buses: arrival predictions, live GPS positions, routes, directions and stops (Bus Tracker API v3)
Alerts: delays, planned work, reroutes, station closures and elevator outages
Divvy: live bikes, e-bikes, scooters and open docks near a place
Ridership: daily and monthly 'L' station entries and bus route boardings (Chicago Data Portal)
History: a small recorder that logs train positions to SQLite, then reports headways, gaps, bunching and delay rates. CTA only serves the present, so this is how you answer "how bad was the Brown Line this morning?"
It talks to CTA directly with your own free keys: no proxy, no account with anyone else.
Install
Python 3.10 or newer. With uv:
uv tool install git+https://github.com/vayllon301/chitransit
chitransit doctorOr run it without installing: uvx --from git+https://github.com/vayllon301/chitransit chitransit loop.
Related MCP server: transport-gzm
API keys
Feature | Key | Get it |
'L' arrivals, positions, follow, |
| Train Tracker API (free) |
Bus arrivals, vehicles, routes, stops |
| Bus Tracker API (free, sign in at ctabustracker.com) |
Alerts, line status, stations, Divvy, ridership, GTFS bus stop search | none |
Set them as environment variables (see .env.example). Each key allows 100,000 requests a day.
Keys travel in the query string, so chitransit never logs request URLs or puts them in errors.
Command line
chitransit loop # the Loop right now
chitransit arrivals "Clark/Lake" # next trains (names are fuzzy: "clark and lake" works)
chitransit arrivals western --line brown # several stations share a name; pick by line
chitransit positions --line red --line blue # every train on those lines
chitransit follow 412 # one train's upcoming stops
chitransit status # CTA's status line for each 'L' line
chitransit alerts --station "Washington/Wabash" # alerts for a station (or --line, --bus-route, --elevators)
chitransit stations library # search stations; --near LAT,LON; --loop
chitransit bus arrivals 1850 --route 22 # bus predictions at stop ids
chitransit bus vehicles 22 36 # live buses on routes
chitransit bus stops 22 Northbound # stop ids for a route and direction
chitransit sync --gtfs # once: download CTA GTFS (~50 MB) for bus stop search
chitransit bus find "Michigan & Washington" # bus stops by name, or --near
chitransit divvy "Clark/Lake" # Divvy near a station or LAT,LON
chitransit nearby 41.8789,-87.6359 # 'L', Divvy and bus stops around a point
chitransit ridership station "Clark/Lake" # latest 30 published days; --monthly, --from, --to
chitransit ridership bus 22Every command takes --json for machine-readable output.
MCP server
chitransit mcp runs an MCP server on stdio with 16 read-only tools:
Tool | What it answers |
| What is happening in the Loop right now? |
| When is the next train at a station? |
| Where is every train (optionally near a place, or on the Loop)? |
| Where is run 412 going and when does it get there? |
| Which station is "the library"? Ids, lines, platforms, accessibility |
| Is the Blue Line OK? Is the elevator at Clark/Lake working? |
| Buses |
| What is around this corner? Are there bikes? |
| How busy is a station or bus route, historically? |
| How did service actually run (needs the recorder) |
Claude Code:
claude mcp add chitransit \
--env CTA_TRAIN_API_KEY=your-train-key --env CTA_BUS_API_KEY=your-bus-key \
-- uvx --from git+https://github.com/vayllon301/chitransit chitransit mcpClaude Desktop or any client with a JSON config:
{
"mcpServers": {
"chitransit": {
"command": "uvx",
"args": ["--from", "git+https://github.com/vayllon301/chitransit", "chitransit", "mcp"],
"env": { "CTA_TRAIN_API_KEY": "your-train-key", "CTA_BUS_API_KEY": "your-bus-key" }
}
}
}Codex (~/.codex/config.toml):
[mcp_servers.chitransit]
command = "uvx"
args = ["--from", "git+https://github.com/vayllon301/chitransit", "chitransit", "mcp"]
env = { CTA_TRAIN_API_KEY = "your-train-key", CTA_BUS_API_KEY = "your-bus-key" }Reading the data correctly
Live vs scheduled. Train Tracker mixes tracked trains with timetable entries.
live: falsemeans no train is being tracked yet for that slot;schedule_fault: truemeans its scheduled departure did not happen, so it may never run. Treat both as tentative.Minutes follow CTA's advice: arrival time minus the time the prediction was made.
Positions come from track circuits, not GPS, so they snap to the track. Buses report GPS.
The Loop. Brown, Green, Orange, Pink and Purple trains use the elevated ring; Red and Blue cross downtown in subways. The Inner Loop track runs clockwise and the Outer Loop counterclockwise (from the platform directions in CTA's stop list). Per that list, Brown trains use the Outer Loop; Orange, Pink and Purple the Inner Loop; Green runs both ways along Lake Street and Wabash Avenue only.
loop_statuscounts a train as on the Loop when its next stop is a Loop station.Times are ISO 8601 in America/Chicago.
Ridership counts station entries (tap-ins) and is published with a lag of about two months.
Not available from CTA: train crowding, a trip planner, a history of past arrivals. Bus Tracker v3 has a passenger-load field; chitransit passes it on when CTA fills it in.
History recorder
chitransit record # polls all lines every 60 s into the data directory
chitransit history summary --since 24h # trains in service, distinct runs, delay share, outages
chitransit history headways "Clark/Lake" --line brown --since 7dOne request covers all eight lines, so 60-second polling uses about 1,440 of a key's 100,000 daily requests. Headways come from the moment a train's next stop changes, so they are accurate to about half the poll interval; gaps that span a recording outage are skipped.
To keep it running on Linux, a systemd user service works:
# ~/.config/systemd/user/chitransit-record.service
[Unit]
Description=chitransit train position recorder
[Service]
EnvironmentFile=%h/.config/chitransit/env
ExecStart=%h/.local/bin/chitransit record --quiet
Restart=on-failure
RestartSec=30
[Install]
WantedBy=default.targetData lives in $CHITRANSIT_HOME, else $XDG_DATA_HOME/chitransit or ~/.local/share/chitransit
(%LOCALAPPDATA%\chitransit on Windows).
Data sources
See docs/DATA_SOURCES.md for every endpoint, its key, limits and quirks. This project is not affiliated with the CTA, Divvy, Lyft or the City of Chicago. Use of CTA data is subject to the CTA developer terms.
Development
uv sync
uv run pytestTests run offline against recorded-format fixtures. MIT licensed.
Available Tools
16 toolsbus_arrivalsBRead-onlyIdempotent
Predicted bus arrivals at stops, with minutes, direction, destination and delay flags.
Inputs: stop_ids (required), top, routes. Returns: object
bus_route_infoCRead-onlyIdempotent
A bus route's directions, or its stops (with ids) in one direction.
Inputs: route (required), direction. Returns: object
bus_vehiclesARead-onlyIdempotent
Live GPS position, heading and destination of buses on routes, or of specific buses.
Inputs: routes, vehicle_ids. Returns: object
divvy_nearBRead-onlyIdempotent
Live Divvy availability near a place: classic bikes, e-bikes, scooters and open docks.
Inputs: location (required), limit, radius_m. Returns: object
find_bus_stopsBRead-onlyIdempotent
Search CTA bus stops by name and/or location (needs a one-time chitransit sync --gtfs).
Inputs: near, limit, query, radius_m. Returns: object
find_stationARead-onlyIdempotent
Find 'L' stations by name, line or location. Returns map ids, lines, accessibility and platforms.
Inputs: line, near, limit, query. Returns: object
follow_trainBRead-onlyIdempotent
One train's position and predicted arrival at each upcoming station.
Inputs: run (required). Returns: object
history_summaryBRead-onlyIdempotent
From locally recorded positions: trains in service, distinct runs and delay share per line, plus
recording outages. Needs chitransit record running on this machine.
Inputs: line, since, until. Returns: object
line_statusBRead-onlyIdempotent
CTA's one-line status per route, e.g. 'Normal Service', 'Planned Work', 'Significant Delays'.
Inputs: include_bus. Returns: object
loop_statusARead-onlyIdempotent
The Loop right now: trains on the elevated ring by line and track, downtown subway trains, line status, and alerts that touch downtown stations or lines. Works without a key (alerts only).
Inputs: no named parameters. Returns: object
nearbyBRead-onlyIdempotent
'L' stations, Divvy bike stations (with live bikes and docks) and bus stops near a place.
Inputs: location (required), radius_m, include_bus, include_divvy. Returns: object
ridership_historyBRead-onlyIdempotent
Historical ridership from the City of Chicago Data Portal: 'L' station entries or bus route boardings.
Inputs: kind (required), target (required), end, start, +2 more. Returns: object
service_alertsBRead-onlyIdempotent
Active CTA alerts: delays, planned work, reroutes, station closures and elevator outages.
Inputs: line, station, bus_route, elevators, +2 more. Returns: object
station_headwaysARead-onlyIdempotent
From locally recorded positions: time between trains passing a station per direction (median,
p90, max, bunching, longest gaps). Needs chitransit record running on this machine.
Inputs: line (required), station (required), since, until. Returns: object
train_arrivalsBRead-onlyIdempotent
Next 'L' trains at a station, with minutes, destination, platform and live/scheduled/delayed flags.
Inputs: station (required), line, max_results. Returns: object
train_positionsARead-onlyIdempotent
Live location of every in-service 'L' train (one CTA request covers all lines).
Inputs: near, lines, radius_m, loop_only. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools map to a distinct resource+action (bus_arrivals vs bus_vehicles vs bus_route_info are cleanly separated, as are train_arrivals, train_positions and follow_train). Overlap remains around loop_status, which restates line status and alerts scoped to the Loop, and around nearby, which aggregates divvy_near, find_station and find_bus_stops results, so an agent may hesitate between the aggregate and the specific tool.
There is a loose domain-prefix convention (bus_*, train_*, plus find_* and divvy_near), but the pattern mixes domain-first nouns (bus_arrivals, station_headways), verb_noun (find_station, follow_train, find_bus_stops) and one bare noun (nearby). It stays readable, but a tool like find_bus_stops breaks the bus_* grouping and divvy_near/divvy_* ordering is inconsistent.
16 tools is at the upper edge of the comfortable band, but the surface spans four sub-domains (L trains, buses, Divvy, historical/recorded data), so each tool carries weight. A few, such as loop_status and history_summary, feel like conveniences layered on top of existing tools rather than new capabilities.
Coverage is strong: real-time arrivals and vehicle positions for both bus and rail, alerts, station/stop discovery, Divvy availability, and even historical ridership and headway analytics. The notable gap is any multi-modal trip/journey planning or route-itinerary tool, and there is no explicit station-detail/accessibility lookup beyond what find_station returns.
Maintenance
Related MCP Connectors
Geocoding, routing, isochrones, traffic, weather, and place search for AI agents. 19 MCP tools.
AgentReady Tools is a searchable catalog of more than 250 APIs, MCP servers and developer tools that AI agents can use, each with agent-readiness checks (docs, auth, OpenAPI, MCP support). Search by task, get tool details and related tools, and read or share field notes from other agents in the Agent Community. Remote MCP endpoint: https://agentready-tools.com/mcp
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Free public MCP for AI agents — 193 tools, 44 workflows. No API key.
Related MCP Servers
- AlicenseBqualityFmaintenanceEnables AI clients to access Boston's MBTA public transit data, including real-time predictions, schedules, route planning, and service alerts.3225 PyPI1Apache 2.0
- AlicenseAqualityDmaintenanceProvides tools for AI agents to query live public transport data for GZM (Silesian Metropolis) including vehicle positions, trip updates, service alerts, and next arrivals.8MIT
- AlicenseNot gradedqualityCmaintenanceEnables real-time Chicago Transit Authority train and bus tracking, including arrivals, positions, and predictions for CTA 'L' trains and buses.70 npmMIT
- AlicenseAqualityCmaintenanceEnables AI assistants to access real-time and scheduled public transit data, including routes, stops, departures, and service alerts, across multiple US metropolitan areas.5MIT