traintrack-mcp

traintrack-mcp

MCP server for Indian Railways data, enabling AI agents to search trains, get schedules, live status, PNR info, and more without an API key.

Category
访问服务器

README

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

Installation

After the package is published:

npm install --global traintrack-mcp

To run it directly from a source checkout:

npm install
npm start

MCP 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 = 60

OpenCode

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_BASE_URL https://traintrack.stupidlabs.lol TrainTrack deployment to use. http and https URLs are supported, including deployments under a path.
TRAINTRACK_TIMEOUT_MS 30000 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
search_trains query Trains matching a name, number, or text
get_train_info train_number Train identity, endpoints, and running instances
get_train_schedule train_number, optional date Scheduled stops, times, running days, and coordinates
get_train_live_status train_number, optional date Live stops, delays, platforms, current reported position, and route geometry
find_trains_between_stations from, to, optional sort Direct trains between two station codes
get_train_exceptions train_number Exceptional service information such as cancellations or diversions
get_pnr_status pnr Booking, passenger, train, and chart status
get_station_coordinates code Bundled station name and coordinates
search_stations query, optional limit Stations matching a name or code
track_trains train_numbers Batched live tracking for up to 10 trains
check_traintrack_health 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 test

The project uses ESM throughout and relies on Node's built-in Fetch API.

Author

Nitin Bansal (freakynit)nitinbansal85@gmail.com

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选