QueensCoach ♔

MCP serverDev tools

Live CATS bus and light rail positions and arrival predictions from the agency's GTFS-Realtime feeds

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use QueensCoach ♔

From the project's README

As published by ajwann/queenscoach in README.md.

QueensCoach is an MCP server for live Charlotte Area Transit System (CATS) bus and light rail data, built on the agency's public GTFS-Realtime feeds. It runs over stdio, launched by the MCP client that uses it, or over HTTP with Google OAuth in front of it, for a hosted server. Both transports serve the same three tools.

Hosted server

A public instance runs on Google Cloud Run. Sign in with any Google account:

https://queenscoach.adamwanninger.com/mcp

There is zero guarantee of uptime. The hosted server is provided as-is. It may be slow, down, switched off by its spending cap, or retired without notice. For anything you rely on, run your own: over stdio, or on your own Google Cloud project with deploy/GCP.md.

Signing in tells the server your Google account's email address, which is used only to decide whether to admit you, and is never stored. The tokens it issues record your account's opaque Google ID and nothing else about you. The privacy policy and terms of service cover the hosted server.

Adding it to Claude

Claude calls a remote MCP server a connector. Custom connectors are available on Claude's paid plans.

  1. Open Settings → Connectors. On the web that's claude.ai/settings/connectors; in the desktop app, Settings then Connectors.
  2. Click Add custom connector at the bottom of the list.
  3. Give it a name, QueensCoach, and paste the URL above as the remote MCP server URL. Leave the advanced OAuth fields empty: this server registers your client automatically.
  4. Click Add, then Connect on the connector that appears. A browser window opens for the Google sign-in; approve it and it closes itself.
  5. In a chat, open the tools menu and check that QueensCoach is enabled. Its three tools then appear.

The connector belongs to your Claude account, so it follows you across web, desktop, and mobile. To disconnect, remove it from that same Connectors page; that revokes the tokens this server issued.

Adding it to Claude Code

claude mcp add --transport http queenscoach https://queenscoach.adamwanninger.com/mcp

Then run /mcp, pick queenscoach, and choose Authenticate, which opens the same Google sign-in. /mcp shows the connection's state afterwards. A server added this way loads when Claude Code next starts.

Any other client

Any MCP client that supports remote servers over streamable HTTP with OAuth works: give it the same URL and it discovers the rest.

Tools

ToolPurpose
find_vehicleLocate one bus/train by vehicle number, or every vehicle on a route, and return GPS coordinates.
list_vehiclesCurrent GPS coordinates of every bus and train in service.
get_arrivalsEstimated arrival times at a specific stop or station.

find_vehicle

ArgumentTypeNotes
vehiclestringVehicle number as shown on the bus/train, e.g. 2301, LRV307.
routestringRoute to locate: 9, 501, Blue Line, Mt. Holly Road.
modebus | trainOptional filter.

At least one of vehicle or route is required. Returns position, heading, speed, occupancy, headsign, and the next scheduled stop.

list_vehicles

ArgumentTypeNotes
modebus | trainOptional filter.
routestringOptional single-route filter.
limitintegerMax vehicles to return (default and cap: 250).

Includes countsByMode and totalInService so the total is visible even when the list is truncated.

get_arrivals

ArgumentTypeNotes
stopstringRequired. Stop id (02400), stop code, or part of a stop name (CTC Station).
routestringOptional route filter.
modebus | trainOptional filter.
limitintegerMax arrivals (default 10, cap 50).

Returns minutes away, predicted and scheduled times, schedule deviation, the vehicle number, and that vehicle's live position. When a name query is ambiguous, the best match is used and the runners-up are listed under otherStopsMatchingQuery. Service alerts affecting the stop or its routes are attached when present.

Install

Requires Python 3.11+.

python3 -m venv .venv
.venv/bin/pip install .

Transports

Pick one with --transport or QUEENSCOACH_TRANSPORT; the default is stdio.

queenscoach                                  # stdio (default)
queenscoach --transport http --port 8000     # streamable HTTP + Google OAuth

stdio

For a server the client launches itself. No authentication: the client already owns the process.

Register it with Claude Code:

claude mcp add queenscoach -- /absolute/path/to/queenscoach/.venv/bin/queenscoach

Or in an MCP client config file:

{
  "mcpServers": {
    "queenscoach": {
      "command": "/absolute/path/to/queenscoach/.venv/bin/queenscoach"
    }
  }
}

python -m queenscoach runs the same server, so any interpreter with the package installed works as the command.

stdout carries MCP protocol traffic only; all diagnostics go to stderr.

HTTP with Google OAuth

For a hosted server anyone with the URL can reach. Every request to /mcp needs a bearer token, and the only way to get one is to sign in with a Google account that is on the allow list.

How the sign-in works. MCP clients register themselves dynamically and expect an authorization server at the MCP server's own origin. Google offers neither dynamic registration nor tokens audience-restricted to a third-party resource, so this server is its own OAuth 2.1 authorization server and delegates only the login to Google:

MCP client  <--OAuth-->  queenscoach  <--OAuth-->  Google

Google's answer is used exactly once, to learn which account signed in. That email is checked against the allow list, and only then does this server mint its own tokens. Google's tokens are never handed to the client.

One-time setup in Google Cloud. At console.cloud.google.com/auth/clients, create an OAuth client of type Web application and add one authorized redirect URI:

https://your-public-url/auth/google/callback

It must match QUEENSCOACH_PUBLIC_URL exactly. The server logs the URI it expects at startup. Copy the client ID and secret into the environment below.

Run it. .env.example lists every setting; the shell form is:

export QUEENSCOACH_GOOGLE_CLIENT_ID=...apps.googleusercontent.com
export QUEENSCOACH_GOOGLE_CLIENT_SECRET=...
export QUEENSCOACH_ALLOWED_EMAILS=you@example.com
export QUEENSCOACH_PUBLIC_URL=https://queenscoach.example.com

queenscoach --transport http --port 8000

Then point a client at https://queenscoach.example.com/mcp; it discovers the rest and opens a browser for the Google sign-in. In Claude Code:

claude mcp add --transport http queenscoach https://queenscoach.example.com/mcp

Access is denied by default. Startup fails unless QUEENSCOACH_ALLOWED_EMAILS, QUEENSCOACH_ALLOWED_DOMAINS, or an explicit QUEENSCOACH_ALLOW_ANY_GOOGLE_ACCOUNT=true says who may get in, so a misconfigured deployment is unreachable rather than open to every Google account on the internet. Unverified Google addresses are always refused.

Endpoints.

PathPurpose
/mcpThe MCP endpoint. Requires Authorization: Bearer <token>.
/.well-known/oauth-protected-resource/mcpPoints clients at the authorization server.
/.well-known/oauth-authorization-serverThis server's OAuth metadata.
/registerDynamic client registration (RFC 7591).
/authorize, /token, /revokeThe OAuth endpoints.
/auth/google/callbackWhere Google returns the user.

scripts/install.sh does a whole deployment: a system user under /opt, a Cloudflare tunnel and its DNS record created over the API, both systemd units, and a verification pass. No port forwarding, so it works behind CGNAT or a locked router. See deploy/.

scripts/deploy-gcp.sh does the same on Google Cloud Run, in your own GCP project: the project itself, Firestore for sign-ins, the client secret in Secret Manager, a container built by Cloud Build, a monthly budget with an optional hard spend cap, and the same verification pass. It scales to zero, so a personal server costs next to nothing. See deploy/GCP.md.

Deployment notes.

  • By default the server speaks plain HTTP and expects a tunnel or proxy to terminate TLS, which is what the install script sets up. Setting QUEENSCOACH_TLS_CERT and QUEENSCOACH_TLS_KEY instead makes it serve HTTPS itself, for a deployment with nothing in front of it.
  • QUEENSCOACH_PUBLIC_URL is what clients dial and is this server's OAuth issuer identifier, so it must be the external URL, not the bind address.
  • Token state is in memory by default and therefore per-process: restarting invalidates outstanding tokens. QUEENSCOACH_TOKEN_STORE=firestore keeps it in Firestore instead (install the gcp extra: pip install 'queenscoach[gcp]'), so sign-ins survive restarts and every instance shares them. Pair it with QUEENSCOACH_STATELESS_HTTP=true so that any instance can answer any request.
  • Access tokens last an hour and refresh tokens 30 days, both rotated on refresh.

Data sources

Realtime (GTFS-Realtime protobuf, refreshed every 20s):

  • https://gtfsrealtime.ridetransit.org/GTFSRealTime/Vehicle/VehiclePositions.pb
  • https://gtfsrealtime.ridetransit.org/GTFSRealTime/TripUpdate/TripUpdates.pb
  • https://gtfsrealtime.ridetransit.org/GTFSRealTime/Alert/Alerts.pb

Static schedule (cached 6h), used to turn feed identifiers into route names, stop names, and coordinates:

  • https://gtfsrealtime.ridetransit.org/GTFSStatic/api/GTFSDownload/GTFS.zip

Only routes.txt, stops.txt, and trips.txt are read; stop_times.txt and shapes.txt are the bulk of the archive and are not needed.

Feed quirks this server works around

Verified against live feed captures:

  • VehiclePosition.stop_id and current_stop_sequence are unusable. None of the 158 vehicle stop ids in a sample capture matched any stop in the published schedule, and reported sequence numbers exceeded the trip's own stop count (e.g. sequence 192 on a 52-stop trip). This server never surfaces them; next-stop data comes from the TripUpdates feed instead, whose stop ids resolve 100%.
  • StopTimeEvent.delay is never populated. Schedule deviation is computed from time minus scheduled_time, which are both present.
  • TripUpdates cover ~83% of active vehicles, so nextStop is omitted rather than guessed for the remainder.
  • Route matching is exact-first, so a query of 5 returns route 5, not 501 or 510.

Behavior notes

  • Arrival predictions already in the past are filtered out; no negative ETAs.
  • Feed responses are capped in size and time-bounded; one slow feed cannot hang a call.
  • Concurrent calls share a single in-flight fetch per feed, and one call giving up does not abort a fetch the others are awaiting.
  • If a refresh fails but cached data exists, the last good data is served rather than an error. feedAgeSeconds on every response shows how stale it is.
  • The alerts feed is supplementary: if it fails, get_arrivals still returns arrivals.
  • Times are ISO 8601 UTC; coordinates are WGS84 decimal degrees.

Configuration

Feeds (both transports)

All optional; defaults target the CATS feeds above. Durations are in milliseconds.

VariableDefault
QUEENSCOACH_VEHICLE_POSITIONS_URLCATS vehicle positions feed
QUEENSCOACH_TRIP_UPDATES_URLCATS trip updates feed
QUEENSCOACH_ALERTS_URLCATS alerts feed
QUEENSCOACH_STATIC_GTFS_URLCATS static GTFS zip
QUEENSCOACH_REALTIME_TTL_MS20000
QUEENSCOACH_STATIC_TTL_MS21600000
QUEENSCOACH_REQUEST_TIMEOUT_MS30000
QUEENSCOACH_MAX_FEED_BYTES33554432
QUEENSCOACH_MAX_STATIC_BYTES268435456

Feed URLs must be http or https; anything else is rejected at startup.

Transport

VariableCLIDefault
QUEENSCOACH_TRANSPORT--transportstdio

HTTP transport

Read only when --transport http is selected.

VariableCLIDefaultNotes
QUEENSCOACH_HTTP_HOST--host127.0.0.1Bind address.
QUEENSCOACH_HTTP_PORT--port8000Bind port.
QUEENSCOACH_PUBLIC_URL--public-urlhttp://localhost:<port>External origin; the OAuth issuer.
QUEENSCOACH_GOOGLE_CLIENT_IDrequiredFrom Google Cloud credentials.
QUEENSCOACH_GOOGLE_CLIENT_SECRETrequiredFrom Google Cloud credentials.
QUEENSCOACH_ALLOWED_EMAILSAllowed addresses, comma- or space-separated.
QUEENSCOACH_ALLOWED_DOMAINSAllowed bare domains, e.g. example.com.
QUEENSCOACH_ALLOW_ANY_GOOGLE_ACCOUNTfalseOpt in to admitting every Google account.
QUEENSCOACH_TLS_CERT--tls-certPEM chain, to serve HTTPS directly.
QUEENSCOACH_TLS_KEY--tls-keyPEM private key. Required with the above.
QUEENSCOACH_ACCESS_TOKEN_TTL_MS3600000Access token lifetime.
QUEENSCOACH_REFRESH_TOKEN_TTL_MS2592000000Refresh token lifetime.
QUEENSCOACH_TOKEN_STOREmemorymemory, or firestore (needs the gcp extra).
QUEENSCOACH_FIRESTORE_DATABASE(default)Firestore database for the token store.
QUEENSCOACH_STATELESS_HTTPfalseServe without MCP sessions, for restarts and multiple instances.

One of the three allow-list settings is required; see above.

Layout

ModuleRole
config.pyEnvironment parsing and validation
feed_http.pyBounded, time-limited HTTP fetch
cache.pyTTL cache with single-flight refresh
gtfs_csv.pyGTFS-flavored CSV reading
static_gtfs.pyStatic schedule: routes, stops, trips
realtime.pyGTFS-Realtime protobuf decoding
transit.pyDomain layer: joins realtime to schedule, resolves queries
tools.pyThe three tools' behavior and JSON payloads
server.pyMCP tool registration and schemas
oauth.pyOAuth authorization server, with Google as the login
token_store.pyWhere OAuth state is kept, and the in-memory default
token_store_firestore.pyThe Firestore token store (the gcp extra only)
http.pyStreamable HTTP transport and the Google callback route
main.pyCLI entry point and transport selection

Plus scripts/install.sh, which deploys the HTTP transport onto a Debian host, and scripts/deploy-gcp.sh with the Dockerfile, which deploy it to Google Cloud Run.

Development

.venv/bin/pip install -e '.[dev]'
.venv/bin/pytest        # offline, against recorded feed fixtures
.venv/bin/mypy          # strict
.venv/bin/ruff check .
.venv/bin/ruff format .

Tests run against protobuf and GTFS fixtures captured from the live feeds, so they are deterministic and make no network calls. tests/test_feed_http.py is the exception: it serves canned responses from a loopback socket so the byte cap and timeout are exercised for real.

tests/test_http.py drives the whole OAuth handshake against the real ASGI app - registration, /authorize, the Google callback, /token, then an authenticated tools/list - with Google's token endpoint replaced by a stub, so no account or network is needed.

tests/test_token_store.py runs every token-store test against both stores. The Firestore half needs the emulator (gcloud emulators firestore start, then set FIRESTORE_EMULATOR_HOST) and is skipped without it. tests/test_stdio.py starts the real stdio server in a child process; CI also runs it against a plain pip install ., to prove stdio needs none of the optional extras.

License

MIT - see LICENSE.

Signals

Last commit
Sep 2026
Advanced
Delivery
queenscoach MCP server → your ahel gateway (mcp.ahel.ai) → every connected AI client.
Catalog kind
mcp-server
Gateway key
io-github-ajwann-queenscoach
Source
github.com/ajwann/queenscoach
Hosted endpoint
https://queenscoach.adamwanninger.com/mcp