Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
A public, read-only Model Context Protocol server that lets AI agents query both live and scheduled Amtrak transit data:
- Realtime (GTFS-RT) — live predictions, train positions, and alerts, fetched on every call from the transitdocs feed.
- Static (GTFS) — routes, stops, trips, schedules, and service calendars, loaded into this val's SQLite database from Amtrak's GTFS.zip.
| Tool | Description |
|---|---|
get_feed_header | Feed metadata: version, timestamp, and counts of trip updates / vehicles / alerts. |
get_trip_updates | Real-time arrival/departure predictions. Filters: routeId, tripId. |
get_vehicle_positions | Live train positions (lat/long, bearing, speed, current stop). Filters: routeId, tripId, vehicleId. |
get_service_alerts | Active service alerts / advisories. Filter: routeId. |
| Tool | Description |
|---|---|
get_routes | List routes. Filters: routeId, query (name search). |
get_stops | List stations. Filters: stopId, query (name search), or lat/lon/radiusKm (nearby). |
get_trips | List scheduled trips. Filters: routeId, tripId, headsign, limit. |
get_trip_schedule | Full itinerary of a trip: stops in order with scheduled times. Requires tripId. |
get_stop_departures | Scheduled departures/arrivals at a station. Requires stopId, optional routeId. |
get_calendar | Service days/date range for a tripId or serviceId. |
get_agency | Transit agency info. Filter: agencyId. |
Realtime times are ISO-8601; static schedule times are HH:MM:SS; delays are in seconds.
- All realtime tools (
get_feed_header,get_trip_updates,get_vehicle_positions,get_service_alerts) share a single 60-second cache of the raw GTFS-RT feed, stored in SQLite. The upstream feed is fetched at most once per minute; every tool reads from the same cached copy. - Static GTFS is stored in SQLite and refreshed daily at 4:00 UTC by the
refresh-gtfs.tsinterval, which re-downloads the GTFS.zip and re-ingests viaingest-gtfs.ts. You can also runingest-gtfs.tsmanually at any time.
Point your MCP client at the server's URL (streamable HTTP transport). For example, in a Claude Code / MCP config:
{ "mcpServers": { "amtrak-gtfs": { "type": "http", "url": "https://<your-subdomain>.val.run" } } }
You can also test it quickly in the Cloudflare MCP playground.
Ask your agent: "Where is Amtrak train 287743 right now, and what are its upcoming stops?"
It will call get_vehicle_positions and get_trip_updates (live) and
get_trip_schedule (scheduled) to answer.
- Read-only: realtime tools only fetch the upstream feed; static tools only read SQLite.
- Built on the v2 TypeScript SDK (
@modelcontextprotocol/server), compatible with MCP 2.0 (2026-07-28 spec) and the legacy spec.