irctc-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., "@irctc-mcp Show me trains from New Delhi to Mumbai tomorrow with 3A availability"
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.
π irctc-mcp
Live Indian Railways data for any AI assistant β via the Model Context Protocol.
Trains between stations, real-time seat availability, fares, PNR status and full timetables. No API key. No signup. No config.
What it does
Ask your assistant things like:
"Delhi se Mumbai kal ki trains dikhao, 3A me seat hai kya?"
"Compare Rajdhani vs Duronto for HowrahβNew Delhi on 5 October β cheapest with confirmed seats."
"Check PNR 4517896230 and tell me if my waitlist will clear."
β¦and it answers from live railway data, not from the model's memory.
**Howrah Junction (HWH) -> New Delhi (NDLS)** on 2026-10-05
2 passenger(s), General quota, ranked by balanced.
| Train | Name | Timing | Duration | Class | Availability | Fare (2 pax) |
| 12301 | Howrah Rajdhani Express | 16:50 -> 09:55 (+1d) | 17h 05m | 3A | AVAILABLE-31 | Rs 7,812 |
| 12301 | Howrah Rajdhani Express | 16:50 -> 09:55 (+1d) | 17h 05m | 2A | RAC 10 | Rs 10,888 |
**Best match:** 12301 Howrah Rajdhani Express, departing 16:50, 17h 05m journey.Related MCP server: railway-reservation-system-mcp
π Tools
Tool | What it returns |
| Station lookup by name or code, with disambiguation |
| Direct trains for a route and date β timings, duration, classes |
| Full stop-by-stop timetable: arrival, departure, halt, distance, day |
| Live availability β |
| Live quoted fare per class and quota |
| Per-passenger booking and current status, coach and berth |
| One-shot planner: finds trains, prices them, checks seats, ranks the options |
| Class and quota code reference ( |
Plus 3 resources (irctc://stations, irctc://trains, irctc://reference and an irctc://train/{number} template) and 2 prompts (plan_trip, check_my_booking).
Every tool returns readable Markdown and structuredContent, so a client can render prose or consume the JSON.
Station names are resolved for you
"NDLS", "New Delhi", "mumbai central" all work. When a name is genuinely ambiguous, it asks instead of guessing:
"delhi" matches more than one station.
Hint: NDLS = New Delhi; DLI = Delhi Junction; NZM = Hazrat Nizamuddin; ...π Quick start
git clone https://github.com/<your-username>/irctc-mcp.git
cd irctc-mcp
npm install # installs + builds
npm start # live, no key neededConnect to Claude Desktop
Edit claude_desktop_config.json:
Windows β
%APPDATA%\Claude\claude_desktop_config.jsonmacOS β
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"irctc": {
"command": "node",
"args": ["/absolute/path/to/irctc-mcp/dist/index.js"]
}
}
}Windows tip: use forward slashes β
C:/Users/you/irctc-mcp/dist/index.jsβ or escape them as\\. A single\is invalid JSON and is the most common setup mistake.
Fully quit Claude Desktop (tray icon β Quit, not just the window) and reopen.
Connect to Claude Code
claude mcp add irctc -- node /absolute/path/to/irctc-mcp/dist/index.jsInspect it manually
npm run inspect # MCP Inspectorπ Why no API key?
Most "Indian Railways API" projects hand you a signup page. This one doesn't, because the endpoints the public enquiry sites use are reachable directly.
The useful find: one ConfirmTkt search call returns trains, live seat availability, quoted fares and confirmation predictions together β so the three most valuable tools resolve from a single cached request.
Optional: setting IRCTC_RAPIDAPI_KEY adds a RapidAPI source at the front of the chain. Nothing requires it.
π How it works
Every provider implements one RailProvider interface, and a chain picks the first source that can actually answer each call:
[RapidAPI if key set] β ConfirmTkt β eRail β station directoryThey cover different things on purpose β ConfirmTkt has live availability but no route data; eRail has full routes but no availability. Chaining them per-capability gets every tool its best source, and adding a new provider is one file with zero changes to the tool layer.
Provider | Key? | Covers |
| No | Stations, trains between, live availability, fares, predictions, PNR |
| No | Trains between, stop-by-stop schedules |
| Optional | Full coverage via a keyed aggregator |
| No | Station codes from a bundled directory (static reference data) |
| No | Deterministic offline sample data for development |
Failures are reported, never faked
If every source fails, the tool returns an error naming what was tried. It does not quietly fall back to estimates, and it does not report an outage as "no trains found" β those are two different answers and the code keeps them apart.
Offline mode
IRCTC_PROVIDER=mock npm startRuns on a bundled dataset of 82 stations and 24 real trains. Availability and PNR are simulated (deterministic, so they stay self-consistent), every response is labelled OFFLINE MODE, and the server instructions tell the model to say so.
βοΈ Configuration
Variable | Default | Meaning |
|
|
|
| β | Optional: adds a keyed source at the front of the chain |
|
| Alternate RapidAPI listing |
|
| Per-request timeout |
|
| Append the offline estimator as a last resort |
Responses are cached in-process β 60s for volatile data, up to 24h for schedules and station lists β to keep upstream call volume low.
π§ͺ Testing
npm run test:parsers # 9 parser tests
npm run smoke # 39 end-to-end checks
npm run test:all # build + bothparsers.test.mjs runs the upstream parsers against verbatim captured live payloads, so format regressions are caught without network access. This caught two real bugs during development:
eRail's route payload opens with
^rather than~^β the naive split silently dropped every train's origin station.A waitlist string like
RLWL5/WL3must report the position after the lastWL(current), not the first (booking-time).
smoke.mjs spawns the built server with a real MCP client and exercises every tool, resource and prompt, including error paths: unknown train, malformed PNR, class not on that train, bad date format, travelling the wrong way along a route.
π Project structure
src/
index.ts stdio entry point
server.ts wires tools, resources and prompts onto McpServer
types.ts domain types, class/quota vocabularies, RailDataError
data/ bundled station directory and offline sample timetable
providers/
provider.ts the RailProvider interface
chain.ts per-capability failover
confirmtkt.ts key-free live: trains, availability, fares, PNR
erail.ts key-free live: trains, stop-by-stop schedules
rapidapi.ts optional keyed live provider
directory.ts bundled station lookup
mock.ts offline estimator
index.ts env config and provider factory
tools/register.ts the eight tool definitions
util/ dates (IST), http client, fare model, formatting
scripts/
parsers.test.mjs parser tests against real captured payloads
smoke.mjs end-to-end MCP session over stdio JSON-RPCAdding a data source
Implement RailProvider and register it in src/providers/index.ts. Nothing in the tool layer changes.
export class MyProvider implements RailProvider {
readonly name = 'my-provider';
readonly isLive = true;
async searchStations(query: string, limit: number) { /* ... */ }
// ...
}Throw RailDataError(code, message, hint?) for anything the user can act on β the tool layer turns it into a clean tool error with the hint attached.
β οΈ Disclaimer
Read this before depending on it.
This project is not affiliated with, endorsed by, or connected to IRCTC or Indian Railways.
It is read-only. It cannot book, cancel or pay for tickets, and it never will. Booking must be completed on IRCTC or through an authorised agent.
There is no official free public API for Indian Railways passenger data. The sources used here are the endpoints public enquiry sites call. They are unofficial and best-effort: they can change or break without notice, and using them may be subject to those sites' terms of service.
Always verify on IRCTC before booking or travelling. Do not treat this data as authoritative.
Fine for personal use, learning and development. For anything commercial, the honest path is an IRCTC agent licence or a paid aggregator with a contract behind it.
π License
Available Tools
8 toolscheck_seat_availabilityCheck seat availabilityA
Seat or berth availability for one train, class and quota on a date. Returns the railway status string (AVAILABLE / RAC / WL / REGRET) and, where known, a confirmation estimate.
Inputs: to (required), from (required), trainNumber (required), travelClass (required), +2 more.
find_trains_between_stationsFind trains between two stationsA
List direct trains connecting two stations on a given date, with departure, arrival, duration and available classes. Station names are accepted and resolved automatically.
Inputs: to (required), from (required), date, sortBy, +2 more.
get_fareGet ticket fareA
Itemised fare for a train, class and quota between two stations: base fare, reservation and superfast charges, catering, dynamic surcharge and GST.
Inputs: to (required), from (required), trainNumber (required), travelClass (required), +4 more.
get_pnr_statusGet PNR statusA
Current status of a 10 digit PNR: train, journey date, route, class and per-passenger booking and current status (CNF / RAC / WL) with coach and berth.
Inputs: pnr (required).
get_train_scheduleGet a train timetableB
Full stop-by-stop schedule for a train number: arrival, departure, halt, distance, day and platform, plus the days of the week it runs.
Inputs: trainNumber (required).
list_reference_dataList classes and quotasA
Reference list of Indian Railways travel class codes and booking quota codes, for interpreting or constructing other tool calls.
Inputs: kind.
plan_journeyPlan a rail journeyA
One-shot journey planner: finds trains between two stations on a date, then checks availability and fares for the preferred classes and ranks the options. Use this instead of chaining the individual tools when the user asks how to get from A to B.
Inputs: to (required), from (required), date, quota, +4 more.
search_stationsSearch railway stationsA
Find Indian Railways stations by name or code. Use this first when the user names a city rather than a station code, since most other tools need codes.
Inputs: query (required), limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 8 tools
Most tools target distinct resources, but there is overlap between search_stations and find_trains_between_stations since both can accept station names, and plan_journey subsumes find_trains plus availability/fare. Descriptions mitigate this somewhat by clarifying intended use, but an agent could still misselect.
All tools follow a consistent snake_case verb_noun pattern (search_stations, get_fare, list_reference_data, etc.). Even longer names like find_trains_between_stations remain predictable and readable.
Eight tools is well within the ideal range and matches the server's scope of Indian Railways information and journey planning. No tool feels redundant or excessive; each covers a distinct aspect of the travel workflow.
The surface covers the core journey-planning lifecycle: station lookup, trains, schedule, availability, fare, PNR status, and a reference list. Minor gaps exist, such as live train running status and connecting-route discovery, but these are workaround-able and not critical for the apparent purpose.
Maintenance
Related MCP Connectors
Give AI assistants access to real-time data. Search the web, compare flights, find hotels, and more.
Real-time data API for AI Agents: stocks, weather, forex, logistics, search, scrape, news, IP.
Find and call verified APIs from any AI assistant, with free trial calls and previewed writes.
Live crypto + IDX stock market intelligence for AI agents β 19 tools, no API key.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables real-time Indian Railways information retrieval, including live train running status, station schedules, and upcoming arrivals/departures.ISC
- FlicenseNot gradedqualityDmaintenanceEnables checking railway seat availability, berth types, and pricing for Indian trains through natural language queries.-
- AlicenseAqualityDmaintenanceMCP server for Indian Railways data, enabling AI agents to search trains, get schedules, live status, PNR info, and more without an API key.117 npmMIT
- 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.-