Train schedules, live running status, seat availability and PNR status from Indian Railways’ own enquiry services — as an MCP server for AI assistants, and as a TypeScript library.
npx -y indian-rail-mcp — runs on your machine, all six tools.
A hosted endpoint is available too, with four.
An MCP server. Point an AI assistant at it and the assistant can answer real questions about Indian trains — where a train is right now, which trains run between two stations, whether there are berths free.
It reads from the two services Indian Railways operates publicly: the National Train Enquiry System for running information, and IRCTC’s reservation chart service for seats and PNR. No third-party data vendor sits in between.
both works over stdio and at the hosted URL. stdio only works when you run the server on your own machine — IRCTC refuses requests from datacenters, so the hosted endpoint cannot reach those two. Why.
Your MCP client launches it as a subprocess. Nothing to host, and the two IRCTC tools work.
{
"mcpServers": {
"indian-rail": {
"command": "npx",
"args": ["-y", "indian-rail-mcp"]
}
}
}
No install, but IRCTC refuses this server, so seat availability and PNR are unavailable.
https://indian-rail-mcp.vercel.app/api/mcp
{
"mcpServers": {
"indian-rail": {
"type": "http",
"url": "https://indian-rail-mcp.vercel.app/api/mcp"
}
}
}
import { trackTrain } from "indian-rail-mcp";
const status = await trackTrain("12951");
IRCTC’s edge blocks datacenter traffic. The same request, with identical headers, seconds apart:
your machine OK 18 coaches | chart=true | 51 vacant berths listed
hosted server 403 Access Denied — "You don't have permission to access
/online-charts/api/trainComposition on this server"
Nothing in the code differs. It is a decision made at their edge about where the request came from, and no amount of header-fiddling changes it. NTES has no such restriction, which is why four tools work everywhere and two do not.
Run the server on your own machine and the requests come from you, so all six work. That is also the better privacy outcome — PNR responses never touch anyone else’s server.
This project reads only information those services already publish openly. Responses that do not change during a day are cached, and requests are rate-limited, to keep load off the public services it depends on. Use of this data is subject to the NTES terms of use.