MCP server for live UK train data. Query departures, arrivals, and service details from any MCP client using the Realtime Trains NG API.
You'll need a free refresh token from api-portal.rtt.io. Sign up, then click on the UUID shown on the dashboard to reveal your refresh token (a long JWT starting with eyJ...). The UUID itself is not the token.
The quickest way to get started. No installation needed.
claude mcp add --transport http national-rail https://rtt-mcp.henricook.com/mcp \
--header "Authorization: Bearer <your-rtt-refresh-token>"Set your refresh token as an env var:
export RTT_REFRESH_TOKEN="<your-rtt-refresh-token>"Then add the server in ~/.codex/config.toml:
[mcp_servers.national-rail]
url = "https://rtt-mcp.henricook.com/mcp"
bearer_token_env_var = "RTT_REFRESH_TOKEN"- "What are the next departures from King's Cross?"
- "Show me arrivals at Clapham Junction from Waterloo"
- "Get the full calling points for service gb-nr:C40827:2026-03-29"
git clone https://github.com/henricook/mcp-national-rail-ng.git
cd mcp-national-rail-ng
npm install && npm run buildEach connecting client provides their own RTT refresh token via the Authorization header.
PORT=3456 npm run start:httpFor local MCP clients like Claude Desktop or nanoclaw.
RTT_REFRESH_TOKEN=<your-token> npm startOr add to Claude Desktop's config:
{
"mcpServers": {
"national-rail": {
"command": "node",
"args": ["/path/to/mcp-national-rail-ng/dist/index.js"],
"env": {
"RTT_REFRESH_TOKEN": "<your-token>"
}
}
}
}| Tool | Description |
|---|---|
get_departures |
Live departures from a station, optionally filtered by destination |
get_arrivals |
Live arrivals at a station, optionally filtered by origin |
get_service |
Full calling points for a specific service |
Station codes are 3-letter CRS codes (e.g. KGX, PAD, CLJ) or longer TIPLOC codes. The gb-nr: namespace prefix is added automatically.
The RTT NG API has rate limits per token: 30/min, 750/hr, 9,000/day, 30,000/week. Each user's token is rate-limited independently.
Train data is provided by Realtime Trains, an independent project by swlines ltd. Realtime Trains has been providing live running information for the GB rail network since 2012 and is not affiliated with National Rail or any train operator. If you find the data useful, consider supporting the project.