Skip to main content
Glama
Live Transit MCP Server

Live Transit MCP Server

by loama

Live Transit

Live status, alerts, line maps and vehicle positions for public transport networks worldwide, straight from the operators. Metros, trains, trams, buses, ferries and airport boards from about 300 sources in dozens of countries, normalized into one data model and served as a website, a REST API and an MCP server.

Live at livetransit.vercel.app.

  • Website: a live map of every vehicle and line, network and line pages with status and alerts, airport boards.

  • REST API: /api/v1/*, documented at /api/v1/openapi.json and on the /developers page.

  • MCP server: /api/mcp (Streamable HTTP), with tools such as search, network_status, line_status, disruptions, airport and vehicles_near. A plain-text guide for agents is at /llms.txt.

How it works

  • Connectors (src/connectors/) each read one operator feed (GTFS-Realtime, a JSON or XML API, a flight board, or a scraped status page) and return alerts, line statuses, vehicles, stations and departures in the shared model in src/lib/types.ts. Around 230 standard GTFS-Realtime feeds come from the Mobility Database catalog (scripts/gen-global-gtfs.ts); the rest are written by hand.

  • Ingest (src/ingest/runner.ts) polls each source on its own interval from a once-a-minute cron, with backoff for failing feeds, and stores the latest snapshot in Postgres.

  • Line catalog: most realtime feeds name routes only by id, so each source is linked to its static GTFS schedule (src/connectors/static-gtfs.json, generated by bun scripts/gen-static-gtfs.ts). Routes and colors go into the routes table and simplified shapes into geometry files (below), reading only routes.txt, trips.txt, shapes.txt and stops.txt over HTTP Range requests, so even 500 MB feeds import in about a minute. On every ingest, vehicles get route names and colors from the catalog, and sources without per-line status get one line per route, with state derived from the alerts that name it.

  • Realtime reads: GET /api/v1/sources/{id}/live reads the operator's vehicle feed on request (cached for about 10 seconds) when the connector supports it. The maps poll it and animate vehicles between updates.

  • Route geometry is published outside Postgres as immutable JSON files, one per source per 0.5 degree cell, on Vercel Blob (src/ingest/geo.ts); /api/v1/geo lists the files covering an area and maps fetch them from the CDN. Without BLOB_READ_WRITE_TOKEN the files are written under public/geo/ and served by Next itself.

  • Stops are packed per source into small tiles in Postgres and power both the map's stop layer and search.

  • Maps use MapLibre GL with OpenFreeMap tiles built from OpenStreetMap data. No API key needed.

Related MCP server: Moscow Transport MCP

Running locally

Requires Bun.

bun install
cp .env.example .env.local

# A local Postgres. Any Postgres 15+ with pg_trgm works; this one needs no install.
bunx pglite-server --db=.localdb/pg --port=5433 -e pg_trgm --max-connections=4

bun run db:migrate             # apply src/db/schema.sql (idempotent)
bun run ingest --force         # poll every source once
bun run import:static          # import line catalogs and route shapes (a few minutes for all sources)
bun run dev                    # http://localhost:3000

Other scripts:

Command

What it does

bun run try <id or prefix> [--json]

Run connectors live without a database and print samples

bun run ingest [--force] [id ...]

Run due (or all) connectors against DATABASE_URL

bun run import:static [--force] [id ...]

Import static GTFS line catalogs, stops and route geometry

bun scripts/gen-schedule-feeds.ts, gen-extra-feeds.ts, gen-more-feeds.ts

Regenerate timetable and realtime source registries from the Mobility Database, Transitland and Transitous

bun scripts/dedupe-static-feeds.ts, bun scripts/fix-countries.ts <natural-earth-dir>

Drop duplicate feeds; place sources by their stops

bun test

Unit, API and MCP tests (API tests need DATABASE_URL; connector tests hit live feeds)

bun run typecheck, bun run lint

Static checks

Deploying

Built for Vercel with a Postgres database such as Neon and a public Vercel Blob store for route geometry. Set DATABASE_URL, CRON_SECRET and BLOB_READ_WRITE_TOKEN; the crons in vercel.json poll sources every minute and prune old rows hourly. Static catalogs are refreshed weekly by the Static GTFS refresh GitHub Action (.github/workflows/static-refresh.yml), which needs DATABASE_URL, BLOB_READ_WRITE_TOKEN and the portal credentials (SPAIN_NAP_API_KEY, AUSTRIA_MVB_EMAIL, AUSTRIA_MVB_PASSWORD) as repository secrets.

Data and licenses

The code is MIT licensed (see LICENSE). Transit data belongs to the operators and is used under each feed's own terms; every source lists its operator, license and endpoints on its network page and in the API. This project is not affiliated with any operator and is not a substitute for official information.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to access real-time public transport data for Moscow and the Moscow region, aggregating and reconciling information from multiple sources. Provides tools for finding stops, live arrival boards, vehicle tracking, route details, and ETA calculations.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to access real-time and scheduled public transit data, including routes, stops, departures, and service alerts, across multiple US metropolitan areas.
      5
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to retrieve live transit departures, vehicle positions, and service alerts for San Francisco Bay Area transit operators via the regional 511.org open-data API.
      54 npm
      MIT