yyc-transit-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
yyc-transit-mcp
An MCP server that lets AI assistants answer "when's my bus, and can I trust it?" with Calgary Transit data:
live arrivals;
service alerts;
bus positions;
historical on-time reliability, which it measures itself from the live feeds.
When's the next 3 at Centre St and 16 Ave? The next Route 3 at Centre St and 16 Ave is the northbound one at 11:52 PM tonight, but that time is scheduled only, with no live tracking. The next live-tracked northbound buses are at 12:26 AM and 12:51 AM.
How reliable is route 1? About 85.8% of observed trips were on time (within 1 minute early to 5 minutes late)… However, this is based on only 1 day of data (239 observations), so the history is too short to be a solid measure.
Plan me a trip from Tuscany to the airport with two transfers. I can't plan multi-leg trips with transfers… Calgary Transit's trip planner or app can do that.
These are real answers from the eval suite (Claude Haiku 5.5), lightly trimmed.
Use the hosted server
A public instance runs at:
https://mcp-production-5d8ac39d.up.railway.app/mcpNothing to install:
Claude.ai or Claude Desktop: Settings → Connectors → Add custom connector, then paste the URL above.
Claude Code:
claude mcp add --transport http yyc-transit https://mcp-production-5d8ac39d.up.railway.app/mcp
Then ask: "When's the next train at City Hall?"
It's a hobby deployment with no uptime guarantee. A redeploy drops open sessions; reconnect and carry on. To run your own, see below.
Related MCP server: Calgary Open Data MCP Server
Tools
Tool | What it answers |
| Stops by name ("Centre St and 16 Ave"), stop number ("#4585") or location, with the routes serving each |
| Next arrivals at a stop in the next 3 hours: live, scheduled or cancelled |
| Active detours, closures and delays for a route or stop |
| Live bus positions on a route, with headsign and delay |
| Historical on-time %, median and 90th-percentile delay, by time of day |
| Reliability for two routes side by side |
Route names: riders can name routes the way they say them: "3", "route 3", "MAX Teal", "Red Line".
Times: all times are Calgary local time.
Freshness: every response says how fresh its data is (
meta.data_as_of,meta.is_stale). Live predictions are withheld when the City's feed is stale.Read-only: every tool only reads data.
Limitations
Calgary Transit only.
Direct routes only; no trip planning with transfers.
The City doesn't publish CTrain positions; CTrain arrivals and alerts work.
CTrain reliability isn't measured yet: the City's CTrain predictions are an hour off, and live arrivals correct for it, but the history waits until the correction is verified.
Reliability is computed from history the worker collects, so it needs a few days of running before the numbers mean much. Until then, results say
enough_data: false.
How it fits together
City of Calgary open data your machine / server
─────────────────────────── ───────────────────────────────────────────
static GTFS (nightly) ──▶ worker ──▶ Postgres + PostGIS ◀── MCP server ◀── Claude
GTFS-Realtime (30 s) ──▶ (schedule, live state, (6 tools)
delay history)The worker has to run all the time: it keeps the live state current and writes the delay history that reliability is computed from. The MCP server only reads the database.
Run it yourself (Docker)
Needs Docker. This starts the database, runs the migrations, loads the schedule (about a minute) and starts polling the live feeds:
git clone https://github.com/Abiolr/calgary-transit-MCP.git
cd calgary-transit-MCP
docker compose up -d
docker compose logs -f worker # wait for "rt_poll.done" linesThe MCP server is now at http://localhost:8000/mcp.
Connect your assistant
Claude Code:
claude mcp add --transport http yyc-transit http://localhost:8000/mcpClaude Desktop, or any client that launches servers over stdio: run the server with uv and point it at the database:
{
"mcpServers": {
"yyc-transit": {
"command": "uvx",
"args": ["yyc-transit-mcp"],
"env": { "DATABASE_URL": "postgresql://transit:transit@localhost:5432/transit" }
}
}
}To try it without a client, use the MCP Inspector:
npx @modelcontextprotocol/inspector, then connect to http://localhost:8000/mcp.
Install without Docker
You need Postgres 16 with PostGIS 3.
pip install yyc-transit-mcp # or: uv tool install yyc-transit-mcp
export DATABASE_URL=postgresql://user:pass@host:5432/transit
yyc-transit-migrate # create or upgrade the schema
yyc-transit-worker # load the schedule, then poll; keep it running
yyc-transit-mcp # MCP server over stdio (default)
yyc-transit-mcp --transport streamable-http --host 0.0.0.0 --port 8000Command | What it does |
| Creates or upgrades the database schema |
| Always-on: loads the schedule nightly and polls the live feeds every 30 s |
| Loads the latest schedule once (the worker does this for you) |
| The MCP server ( |
| Asks Claude a question through the tools. Needs |
Configuration
Set these as environment variables, or in a .env file in the working directory:
Variable | Default | |
|
| Postgres + PostGIS |
|
| How often the worker polls the live feeds |
|
| Live data older than this is reported as stale |
| City of Calgary open data | Feed locations |
| Only for | |
|
| Model used by |
Hosting
Run the worker on an always-on host; if it sleeps, the reliability history gets gaps.
Resource use: about 70 MB of RAM for the worker and about 300 MB for Postgres.
History growth: tens of MB a day.
Railway (how the hosted server runs): a PostGIS template plus two services built from this repo's
Dockerfile:worker: start command
yyc-transit-worker, pre-deployyyc-transit-migrate;mcp: start command
yyc-transit-mcp --transport streamable-http --host 0.0.0.0 --port 8000, with a public domain whose target port is 8000. No pre-deploy step: the worker runs the migrations.
Give both services
DATABASE_URLfrom the PostGIS service's private (railway.internal) URL.
Evals
The repo includes an eval suite that measures how well an LLM uses the tools: 40 rider questions covering:
stops, arrivals, alerts, vehicles, reliability and comparisons;
questions out of scope that it should decline;
questions it should answer with honest uncertainty.
Ground truth comes from SQL against a frozen database snapshot, never from an LLM.
Claude Haiku 5.5, 40 cases × 3 runs:
Baseline | Now | |
Answer correct | 94.2% (95% CI 88–97%) | 100% (95% CI 97–100%) |
Right tools called | 100% | 100% |
Latency p50 / p95 | 2.6 s / 6.1 s | 2.2 s / 4.3 s |
Tool calls per question | 1.2 | 1.2 |
Cost of a full run | about $0.08 | about $0.08 |
All 7 baseline failures were arrival questions, caused by the tools rather than the model:
City Hall: a bus stop named "City Hall LRT Station" ranked above the CTrain platforms, which were listed as routes "201" and "202".
MAX Teal: results showed the route code "MT" without the name "MAX Teal".
The fixes:
CTrain and MAX lines are shown by name (
Red Line (201),MAX Teal (MT));station searches list CTrain platforms first;
find_stopstakes aroute, so a station's many bays narrow to the ones that route serves.
The suite is small, so 100% means these 40 questions pass, not that every question will.
Results are in .claude/hillclimb/transit-agent/
(baseline/, then v1/ and v2/);
how to run the suite is in CONTRIBUTING.md.
More
How it works: schema, the live feed's quirks and how they're cleaned, measurements
CONTRIBUTING.md: development setup, tests, evals
Data & licence
Contains information licensed under the Open Government Licence – City of Calgary (City of Calgary open data). Every tool response carries this attribution. The data is fetched from the City at run time and isn't included in this package.
The code is MIT licensed; see LICENSE. This project is not affiliated with Calgary Transit or the City of Calgary.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
BusCalc 1.8.0 exposes 33 public tool families: 26 calculations and seven attributed data lookups. Calculate business pricing, finance, uncertainty, lease economics and emergency dispatch margins. Look up metals, energy, exchange rates, weather, BLS, USDA, Census and selected emergency sources, including NOAA gauges and USGS flood-impact points. Calculations include unsigned replayable receipts. Lookup results include source and observation dates where available. Road and outage coverage varies by location. The public Streamable HTTP endpoint is https://buscalc.com/api/mcp. Direct access is anonymous and rate limited. Full guide: https://buscalc.com/for-ai/
Connects AI assistants to TrackingTime for querying time entries, projects, tasks, customers, and team data using natural language.
Access your Callin.io AI phone agents, call history and transcripts from any AI assistant.
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides access to real-time Winnipeg Transit data and 311 City Services, enabling AI assistants to plan trips, check bus arrivals, and search for reported city issues. It allows users to interact with city infrastructure data and transit schedules through natural language.81MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search, explore, and query Calgary's open data portal using SoQL, with tools for dataset discovery, metadata inspection, and data querying.MIT
- AlicenseNot gradedqualityBmaintenanceEnables querying Calgary open data from data.calgary.ca using the Socrata SODA API through natural language questions or direct tool calls.94 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