indian-rail-mcp
indian-rail-mcp
인도 철도 데이터를 공식 소스에서 가져오는, 타입이 지정된 TypeScript 라이브러리이자 MCP 서버입니다.
API 키가 필요 없습니다. 제3자 데이터 공급업체도 없습니다. 사라질 수 있는 npm 중간자도 없습니다.
NTES — | 열차 시간표, 실시간 운행 상태, 객차 위치, 역 간 열차, 실시간 역 게시판 |
IRCTC — | PNR 상태, 객차별 및 침대별 좌석 이용 가능 여부 |
왜 존재하는가
널리 쓰이던 irctc-connect 패키지는 더 이상 유지보수되지 않습니다. 작성자가 이를 railkit으로 이름을 바꾸고
가입 및 API 키 뒤로 숨겼으며, 이에 의존하던 무료 백엔드(bookmytrain.vercel.app, easy-rail.onrender.com)는
이제 404와 500을 반환합니다. 그 생태계에서 여전히 작동하는 것은 제3자 사이트의 마크업에서 가져온 자격 증명을
사용해 해당 사이트를 스크래핑하는 방식에 기대고 있습니다.
이 라이브러리는 인도 철도가 실제로 운영하는 소스로 직접 접근합니다.
Related MCP server: Indian Railway MCP
설치
npm install indian-rail-mcpNode 20+가 필요합니다. 유일한 런타임 의존성은 cheerio입니다.
라이브러리
import {
getTrainInfo,
trackTrain,
searchTrainsBetweenStations,
getLiveStation,
getSeatAvailability,
checkPnrStatus
} from "indian-rail-mcp";
// Full schedule and route
const info = await getTrainInfo("12951");
// -> { trainName: "NDLS TEJAS RAJ", type: "RAJDHANI", runsOn: "Daily",
// classes: ["1A","2A","3A"], route: [ { stationCode: "MMCT", departure: "17:00", ... }, ... ] }
// Where is it right now (defaults to the journey in progress)
const live = await trackTrain("12626");
// -> { journeyDate, summary: "Arrived at BUTI BORI(BTBR) at 13:27 26-Aug",
// stops: [...], coachPosition: [ { position: 0, coach: "ENG", classCode: "ENG" }, ... ] }
// Direct trains between two stations — code or full name
await searchTrainsBetweenStations("CAN", "PAY");
await searchTrainsBetweenStations("NEW DELHI", "MMCT");
// Next couple of hours at a station, with delay and platform
await getLiveStation("NDLS");
// Reservation chart: per-coach vacancy, plus berth detail when a class is given
await getSeatAvailability({ trainNumber: "12951", boardingStation: "MMCT", travelClass: "3A" });역은 코드 또는 전체 이름을 모두 허용합니다 — NDLS와 NEW DELHI 모두 작동하며, NTES 자체의
8,700개 역 카탈로그를 기준으로 확인됩니다. 날짜는 DD-MM-YYYY, DD-MMM-YYYY 또는 YYYY-MM-DD를 허용합니다.
오류
모든 실패는 타입이 지정된 RailError입니다:
클래스 |
| 의미 |
|
| 잘못된 역, 열차 번호 또는 날짜 — 네트워크 호출 전에 로컬에서 감지됨 |
|
| NTES가 |
|
| IRCTC가 |
|
| 네트워크 실패 또는 구문 분석 불가 응답 |
ERR000에 관하여: NTES는 잘못된 입력에 대해 실제 장애와 동일한 일반ERR000페이지를 반환합니다. 따라서 이 라이브러리는 NTES를 호출하기 전에 역 코드를 카탈로그와 대조하여 검증하므로, 사용자의 오타가 "철도 서비스가 중단되었습니다"로 보고될 수 없습니다.NtesError는 장애라고 단정하지 않고 두 가지 가능성을 모두 명시적으로 언급합니다.
MCP 서버
여섯 가지 도구: getTrainInfo, trackTrain, searchTrainBetweenStations, getLiveStation,
getSeatAvailability, checkPnrStatus.
import { createRailMcpServer } from "indian-rail-mcp/mcp";
const server = createRailMcpServer({ allowPnr: true });
await server.connect(yourTransport);Vercel에 배포
vercel deployvercel.json은 함수를 **bom1(뭄바이)**에 고정합니다 — 두 업스트림 모두 인도에 있으며, 이는 보기보다 훨씬
중요합니다: 웜 요청은 약 124ms, 콜드 요청은 약 885ms이며, 인도 egress IP에서 오는 인도 트래픽은 NTES 앞의
F5 WAF를 트리거할 가능성이 훨씬 낮습니다.
환경 변수:
변수 | 용도 |
|
|
| IP당 요청 상한. 기본값 30. |
Streamable HTTP 전송을 사용하여 모든 MCP 클라이언트를 https://<your-deployment>/api/mcp로 지정하세요.
PNR 및 개인 데이터
checkPnrStatus는 승객 개인 데이터 — 이름, 나이, 성별, 객차 및 침대 — 를 반환합니다.
RAIL_API_KEY가 설정되고 일치하지 않으면 비활성화됩니다. 실패 시 닫힙니다.라이브러리는 PNR 응답을 기록, 캐시 또는 영구 저장하지 않습니다.
의도적으로 일괄 처리 또는 열거 헬퍼가 없습니다. 설계상 호출당 하나의 PNR만 처리합니다.
공개적으로 배포하는 경우 이 상태를 유지하세요. PNR 스크래퍼를 만들지 마십시오.
데이터 소스 및 약관
모든 데이터는 인도 철도의 자산이며, **철도 정보 시스템 센터(CRIS)**가 제공합니다. 이 프로젝트는 인도 철도, CRIS 또는 IRCTC와 제휴, 보증 또는 지원 관계가 아닙니다.
배포 전에 다음을 읽으십시오:
NTES 이용 약관은 개인적 사용을 위한 발췌 다운로드를 허용하며, 사전 서면 허가 없이 "소프트웨어 프로그램"을 사용하여 사이트에서 데이터베이스를 체계적으로 구축하거나 사이트 페이지를 "공개 또는 비공개 전자 검색 시스템 또는 서비스"에 포함시키는 것을 금지한다고 명시합니다. 또한 철도 데이터는 "상업적 목적으로 사용해서는 안 된다"고 명시합니다.
CRIS는 요청 시 해당 허가를 부여합니다: "이 웹사이트에 제공된 자료는 당사에 이메일을 보내 적절한 허가를 받은 후 무료로 복제할 수 있습니다." 바로 보낼 수 있는 요청은
PERMISSION-REQUEST.md에 있습니다.이 프로젝트의 허가 상태: 요청됨, 대기 중.
IRCTC의 약관은 더 엄격하며, PNR 데이터는 개인 데이터입니다.
데이터 정확성은 최선을 다하지만 보장되지 않습니다 — NTES 자체 면책 조항도 동일하게 말합니다. 안전에 중요한 용도로 의존하지 말고 철도에 직접 확인하십시오.
좋은 시민이 되십시오: 기본값은 안정적인 것을 캐시하고, IP별로 속도를 제한하며, 단일 업스트림 세션을 재사용합니다. 이러한 기능을 제거하지 마십시오.
개발
npm install
npm test # parser regression tests against recorded fixtures — no network
npm run smoke # live end-to-end check against NTES and IRCTC
npm run test:mcp # drives the MCP handler locally: handshake, tools, auth, rate limit
npm run fixtures # re-record fixtures when upstream markup changes
npm run buildtest/fixtures/의 픽스처는 기록된 HTML/JSON입니다. CRIS가 마크업을 변경하면 npm test는 도구가 조용히 빈
결과를 반환하는 대신 특정 어설션으로 실패합니다.
라이선스
MIT — LICENSE 참조. 라이선스는 이 소스 코드에만 적용되며 기본 철도 데이터에는 적용되지 않습니다.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables real-time Indian Railways information retrieval, including live train running status, station schedules, and upcoming arrivals/departures.
- FlicenseNot gradedqualityDmaintenanceEnables searching and tracking Indian Railways trains, checking seat availability, live status, delays, and station/train codes.26
- FlicenseNot gradedqualityBmaintenanceProvides transit concierge tools for Indian Railways, including live train status, platform numbers, delay alerts, food options, and cab services, with offline fallback support.
- FlicenseNot gradedqualityDmaintenanceEnables checking railway seat availability, berth types, and pricing for Indian trains through natural language queries.
Related MCP Connectors
iRail MCP — Belgian rail (SNCB/NMBS) real-time via the community iRail API
Real-time BART departures, trip planning, fares, stations, and advisories.
Real-time transit stops, routes, arrivals, vehicle positions, and schedules via OneBusAway APIs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mahi-v-v/indian-rail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server