Skip to main content
Glama
README.md
# @trackside/amtrak-mcp

[![npm version](https://img.shields.io/npm/v/@trackside/amtrak-mcp)](https://www.npmjs.com/package/@trackside/amtrak-mcp)

Unofficial MCP server for live Amtrak trains. It answers with train status, map positions, station departures and arrivals, alerts, and station or route lookup.

This is not an Amtrak product and is not affiliated with, endorsed by, or supported by Amtrak. It reads public data only. It does not book travel or sign in.

The GitHub repository is [TracksideTransport/amtrak-mcp](https://github.com/TracksideTransport/amtrak-mcp).

## Tools

| Tool | What you get |
| --- | --- |
| `get_train_status` | One train's journey. Every stop in order, with scheduled, estimated, and actual times in the station's local zone, delay minutes, track when Amtrak has posted one, and whether the stop is completed. Also the last stop, the next stop, and the map position when the train is active. |
| `get_train_positions` | Trains on the map. Optional route name and bounding box (`north`, `south`, `east`, `west`). |
| `get_station_board` | Departures and arrivals at one station, with tracks when the status document is readable. |
| `get_alerts` | Operational comments from the live fleet, plus titles from Amtrak's notices page when that page is readable. |
| `lookup_station` | A station by code (`BOS`, `PVD`, `KIN`, `NYP`) or by name. |
| `lookup_route` | A route by name, with the train numbers currently on it. |

Station arguments accept a code or a name. An exact code wins. A name that matches one station is used. A name that matches several, such as Springfield, returns the candidates and does not guess.

Times look like `{ "local": "2026-11-30T09:10:00-05:00", "timeZone": "America/New_York" }`. Delay minutes are positive when the train is late and negative when it is early.

### Examples

Train 67, whichever origin date is operating now:

```json
{ "name": "get_train_status", "arguments": { "train": "67" } }
```

A specific origin date:

```json
{ "name": "get_train_status", "arguments": { "train": "67", "serviceDate": "2026-11-30" } }
```

Providence departures and arrivals:

```json
{ "name": "get_station_board", "arguments": { "station": "PVD" } }
```

Northeast Regional trains in a box around New York:

```json
{
  "name": "get_train_positions",
  "arguments": { "route": "Northeast", "north": 42, "south": 40, "east": -73, "west": -75 }
}
```

Prompts that work once the server is connected:

- "Where is Amtrak 67, and what track is it using at Providence?"
- "What is departing Boston South Station this evening?"
- "Which Acela trains are on the map right now?"

## Setup

Requires Node.js 20 or newer.

```bash
npx -y @trackside/amtrak-mcp@latest
```

The published bin is `amtrak-mcp`. Stdio is the default. Logs go to stderr so they stay off the JSON-RPC stream. The MCP server name is `amtrak-mcp`.

### Cursor

Add this to `~/.cursor/mcp.json` or the project's `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "amtrak": {
      "command": "npx",
      "args": ["-y", "@trackside/amtrak-mcp@latest"]
    }
  }
}
```

### Claude Desktop

The same `mcpServers` block goes in the desktop config:

- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- Linux: `~/.config/Claude/claude_desktop_config.json`

Restart Claude Desktop after saving.

### Claude Code

```bash
claude mcp add amtrak -- npx -y @trackside/amtrak-mcp@latest
```

### VS Code

Create `.vscode/mcp.json`:

```json
{
  "servers": {
    "amtrak": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@trackside/amtrak-mcp@latest"]
    }
  }
}
```

### Other MCP clients

Any client that can start a stdio server can use the same command:

```bash
npx -y @trackside/amtrak-mcp@latest
```

### Streamable HTTP

HTTP mode is stateless and has no authentication. Bind it to localhost.

```bash
npx -y @trackside/amtrak-mcp@latest --http --port 3333
```

The MCP endpoint is `http://127.0.0.1:3333/mcp`. `GET /health` returns `ok`.

## Data sources

| Data | Endpoint |
| --- | --- |
| Positions, route, and stop times | `https://maps.amtrak.com/services/MapDataService/trains/getTrainsData` |
| Station directory | `https://maps.amtrak.com/services/MapDataService/stations/trainStations` |
| Route names | `https://maps.amtrak.com/rttl/js/RoutesList.json` |
| Tracks, actual times, and cancellation | `https://www.amtrak.com/dotcom/travel-service/statuses/{train}?service-date=YYYY-MM-DD` |
| Notices | `https://www.amtrak.com/alert` |

The two map documents are the ciphertext the public map page decrypts in the browser. This package opens that envelope locally. It does not call a third-party train API.

Requests are one at a time, at least 500 ms apart. The fleet is cached for 45 seconds, a status document for 60 seconds, notices for 5 minutes, routes for 6 hours, and the station directory for 12 hours. A station board fetches at most 8 status documents.

| Variable | Default | Purpose |
| --- | --- | --- |
| `AMTRAK_MIN_INTERVAL_MS` | `500` | Minimum gap between Amtrak requests |
| `AMTRAK_CACHE` | enabled | Set to `0` to disable the memory cache |
| `AMTRAK_BROWSER` | on when Chrome exists | Set to `0` or `false` to skip the local Chrome read of `www.amtrak.com` |
| `AMTRAK_CHROME` | usual Chrome paths | Chrome or Chromium binary. Used only when the browser is on |

## Caveats

- `www.amtrak.com` answers a plain request with 403. A local Chrome or Chromium reads it by opening a public Amtrak page and fetching from that page. That path is **on by default** when Chrome is installed. Set `AMTRAK_BROWSER=0` or `false` to turn it off. Nothing is downloaded, and the User-Agent is not disguised as a browser.
- Chrome is what loads track numbers, the status document's actual times and cancellations, and the notices page (`/alert`).
- Without Chrome, or with it turned off, these still work from `maps.amtrak.com`: positions, route names, the station directory, scheduled and estimated stop times, posted fleet times, delay phrases, last stop and next stop, station lookup, and route lookup. Train status and station boards then set `tracksUnavailable`. Alerts fall back to fleet comments.
- The map point is the train's position. The status document's location pin stays at the origin after departure, so it is not used.
- `Velocity` is reported as miles per hour. Observed values match train speeds. `Heading` is a compass point such as `SW`.
- Fleet clocks are local wall times. `E`, `C`, `M`, and `P` map to New York, Chicago, Denver, and Los Angeles. Yuma and the other Arizona codes in the feed stay on `America/Phoenix` even though the feed labels them `M`.
- A blank track or `TBD` means Amtrak has not posted a track. The departure track is preferred.
- `AllTTMTrains`, the station-board file on the map host, is not used. Copies of it have been hours behind the fleet feed.
- Service date is the day the train left its origin, not the day it reaches a later station. Omit it to use the trip closest to now. Pass `serviceDate` when you want a particular day.
- Live data is late, missing, or revised. This server does not guarantee a track, a connection, or an arrival.

## Credits

The map-feed envelope and the shape of Amtrak's public train and station documents were worked out by [Piero Maddaleni (piemadd)](https://github.com/piemadd) and are documented, with later endpoint research, in [TracksideTransport/Amtrak-GTFS-RT](https://github.com/TracksideTransport/Amtrak-GTFS-RT). That repository is AGPL-3.0. This package is MIT. It does not copy Amtrak-GTFS-RT source. Comments in `src/amtrak/decrypt.ts` point at that work.

[gtfs-mcp](https://github.com/sohampatwardhan/gtfs-mcp) stays operator-agnostic. This server does not depend on it.

## Development

```bash
npm install
npm run lint
npm test
npm run typecheck
npm run build
node dist/cli.js --help
```

`npm test` uses fixtures and does not open a network connection. `npm run test:live` makes a few real requests (station `BOS` and a short position list). CI does not run it.

```bash
npm run test:live
```

## License

MIT. See [LICENSE](LICENSE).

Amtrak's data and names remain Amtrak's. This project does not grant any right to them.

TDQS

A4/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a clearly distinct resource or action: station departures board, single-train journey status, fleet-wide map positions, alerts, station reference lookup, and route reference lookup. The get_ vs lookup_ split is meaningful (live feeds vs reference data) and the descriptions reinforce the boundaries, so an agent can pick correctly.

Naming Consistency5/5

All six tools use a consistent snake_case verb_noun pattern with two clearly principled verb families (get_ for live data, lookup_ for reference data). No casing or style mixing.

Tool Count5/5

Six tools is well-scoped for a read-only Amtrak real-time data server; every tool covers a distinct facet (board, train, positions, alerts, station, route) and none feels redundant or padding.

Completeness4/5

The real-time surface is well covered, but there is no itinerary/trip-planning or schedule search between two stations, and no way to enumerate all stations or all routes (only name-based lookup). These are modest gaps an agent can partly work around via the station board.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues