traintrack-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@traintrack-mcp check live status of 12627"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TrainTrack MCP
An MCP server for TrainTrack that gives AI agents access to Indian Railways train search, schedules, live status, trains between stations, station data, and PNR status.
It uses the MCP stdio transport, requires no API key, and talks to https://traintrack.stupidlabs.lol/ by default. TrainTrack uses unofficial NTES/Indian Railways data, which may occasionally be delayed, incomplete, or unavailable. Confirm time-sensitive journey details through official railway channels.
Requirements
Node.js 18 or newer
An MCP-compatible client
Related MCP server: SBB Open Data MCP Server
Installation
After the package is published:
npm install --global traintrack-mcpTo run it directly from a source checkout:
npm install
npm startMCP client configuration
No environment variables are required for the hosted TrainTrack API.
Claude Desktop, Claude Code, Cline, and compatible clients
Add this to the client's MCP configuration:
{
"mcpServers": {
"traintrack": {
"command": "npx",
"args": ["-y", "traintrack-mcp"]
}
}
}Codex
Add this to ~/.codex/config.toml:
[mcp_servers.traintrack]
command = "npx"
args = ["-y", "traintrack-mcp"]
tool_timeout_sec = 60OpenCode
Add this to ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"traintrack": {
"type": "local",
"command": ["npx", "-y", "traintrack-mcp"],
"enabled": true
}
}
}Configuration
Environment variable | Default | Description |
|
| TrainTrack deployment to use. |
|
| Positive request timeout in milliseconds. |
For example:
{
"mcpServers": {
"traintrack": {
"command": "npx",
"args": ["-y", "traintrack-mcp"],
"env": {
"TRAINTRACK_BASE_URL": "https://trains.example.com/"
}
}
}
}Tools
Tool | Inputs | What it returns |
|
| Trains matching a name, number, or text |
|
| Train identity, endpoints, and running instances |
|
| Scheduled stops, times, running days, and coordinates |
|
| Live stops, delays, platforms, current reported position, and route geometry |
|
| Direct trains between two station codes |
|
| Exceptional service information such as cancellations or diversions |
|
| Booking, passenger, train, and chart status |
|
| Bundled station name and coordinates |
|
| Stations matching a name or code |
|
| Batched live tracking for up to 10 trains |
| none | Public API availability and service status |
Dates use DD-MMM-YYYY, for example 26-Jul-2026. Train numbers contain 4–6 digits, station codes contain 1–10 letters or digits, and a PNR contains exactly 10 digits.
Rate limits
TrainTrack applies these default limits per client IP and per endpoint. This MCP server does not add another rate limiter. An upstream 429 response is returned to the MCP client as a tool error with its HTTP status, response details, and X-Request-ID when available.
Operation | Default upstream limit |
Train search | 60/minute |
Train information | 30/minute |
Train schedule | 20/minute |
Live train status | 12/minute |
Trains between stations | 20/minute |
Train exceptions | 20/minute |
PNR status | 2/minute |
Station coordinates | 120/minute |
Station search | 120/minute |
Batched live tracking | 6/minute |
Health check | 120/minute |
The hosted service also protects its railway-data provider from overload, so temporary 502 errors can occur even before a client endpoint limit is reached. Wait briefly before retrying a 429 or 502 response.
Cache and data freshness
Caching happens in TrainTrack, not in this MCP process. The MCP tools return the upstream response unchanged, including its cached field. A response with "cached": true came from an earlier identical request or was shared with a simultaneous identical request; it does not mean the data was just refreshed.
Data | Maximum default cache window |
Live running status | 45 seconds |
Train exceptions/service updates | 5 minutes |
Train information | 30 minutes |
Current running instance | 30 minutes |
Trains between stations | 30 minutes |
Train search | 12 hours |
Train schedules | 12 hours |
PNR results are never stored in the result cache. Identical simultaneous PNR requests may still share one in-flight lookup. Treat PNRs as sensitive travel information and avoid putting real values in shared logs, screenshots, or telemetry.
See the hosted TrainTrack API documentation for the full API behavior.
Development
npm install
npm run check
npm testThe project uses ESM throughout and relies on Node's built-in Fetch API.
Author
Nitin Bansal (freakynit) — nitinbansal85@gmail.com
License
Available Tools
11 toolscheck_traintrack_healthA
Check whether the public TrainTrack API is available. Upstream limit: 120 requests/minute.
Inputs: no named parameters.
find_trains_between_stationsA
Find direct trains between two station codes, optionally sorted by fastest journey or earliest departure. Upstream limit: 20 requests/minute; results may be cached for up to 30 minutes.
Inputs: to (required), from (required), sort.
get_pnr_statusA
Look up Indian Railways PNR booking, passenger, and chart status. PNR data is sensitive. Upstream limit: 2 requests/minute; PNR results are never stored in the result cache.
Inputs: pnr (required).
get_station_coordinatesA
Get the name and bundled map coordinates for an Indian Railways station code. Upstream limit: 120 requests/minute.
Inputs: code (required).
get_train_exceptionsA
Get exceptional service information such as cancellations or diversions. Read the returned message field. Upstream limit: 20 requests/minute; results may be cached for up to 5 minutes.
Inputs: train_number (required).
get_train_infoA
Get a train's identity, endpoints, and available running instances. Upstream limit: 30 requests/minute; results may be cached for up to 30 minutes.
Inputs: train_number (required).
get_train_live_statusA
Get live station-by-station progress, delays, platforms, current reported position, and route geometry. Upstream limit: 12 requests/minute; live results may be cached for up to 45 seconds.
Inputs: train_number (required), date.
get_train_scheduleA
Get a train's scheduled stops, running days, times, and available station coordinates. Upstream limit: 20 requests/minute; results may be cached for up to 12 hours.
Inputs: train_number (required), date.
search_stationsA
Search bundled Indian Railways stations by code or name. Upstream limit: 120 requests/minute.
Inputs: query (required), limit.
search_trainsA
Search Indian Railways trains by name, number, or text. Upstream limit: 60 requests/minute; results may be cached for up to 12 hours.
Inputs: query (required).
track_trainsA
Get live tracking for up to 10 trains in one request. Individual train failures are returned in the trains array. Upstream limit: 6 requests/minute; successful live results may be cached for up to 45 seconds.
Inputs: train_numbers (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool serves a unique function, from searching trains and stations to live tracking and PNR status, with no apparent overlap in purpose.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., get_train_info, search_stations, check_traintrack_health), ensuring predictability.
With 11 tools, the set is well-scoped for an Indian Railways data API, covering essential operations without unnecessary redundancy.
Core functionalities like search, schedule, live status, PNR, and exceptions are covered. Minor gaps like fare or seat availability exist but are not critical for the api's purpose.
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
Hosted MCP server for live public-data APIs and Skills for AI agents.
Web search API and MCP server for developers building AI agents.
Hosted WhatsApp MCP server for AI agents — read, search, send messages, media, polls, and groups.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to interact with the Netherlands Railways (NS) API for route planning, pricing, and real-time departure information. It provides tools for searching stations, planning trips with connections, and viewing real-time departure boards.31MIT
- AlicenseAqualityBmaintenanceAn MCP server for Swiss Federal Railways (SBB) open data, enabling AI models to query real-time disruptions, passenger frequencies, station details, and more without an API key.919 PyPI2MIT
- AlicenseNot gradedqualityDmaintenanceProduction-ready MCP server exposing India-specific public data, weather/environment, transport, and maps/address APIs through unified tools for AI agents.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to query real-time Indian Railways data including train schedules, live status, PNR status, seat availability, fares, and coach positions via the Model Context Protocol.-