nayanraj210401/irctc-mcp
If you are the rightful owner of irctc-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server for IRCTC integration using RapidAPI, providing tools for train-related functionalities.
searchTrains
Search for trains between two stations
checkSeatAvailability
Check seat availability for a specific train
getTrainSchedule
Get the complete schedule of a train
getLiveTrainStatus
Get live status of a running train
getPnrStatus
Get the current status of a PNR
IRCTC MCP Server
A Model Context Protocol (MCP) server for IRCTC (Indian Railways) integration using RapidAPI. This server provides tools for searching trains, checking PNR status, and other IRCTC-related functionalities.
Features
- Search trains between stations
- Check seat availability
- Get train schedules
- Check PNR status
- Get live train status
- Built with TypeScript for type safety
- Environment-based configuration
Prerequisites
- Node.js 18+
- npm or yarn
- RapidAPI key for IRCTC API
Setup
-
Clone the repository:
git clone <repository-url> cd irctc-mcp
-
Install dependencies:
npm install
-
Copy
.env.example
to.env
and update with your RapidAPI key:cp .env.example .env
-
Build the project:
npm run build
Running the Server
Development Mode
npm run dev
Production Mode
npm run build
npm start
Using the MCP in Your Applications
Adding to Cascade
To add the IRCTC MCP to Cascade, you need to update your MCP configuration file located at ~/.codeium/windsurf/mcp_config.json
:
{
"mcpServers": {
"irctc": {
"command": "node",
"args": [
"/path/to/irctc-mcp/dist/index.js"
],
"env": {
"RAPIDAPI_KEY": "your_rapidapi_key_here",
"RAPIDAPI_HOST": "irctc1.p.rapidapi.com"
}
}
}
}
Replace /path/to/irctc-mcp
with the actual path to your project directory and update the RAPIDAPI_KEY
with your actual API key.
Adding to Claude or Other MCP-Compatible Applications
You can add this MCP to Claude or other MCP-compatible applications by creating a JSON configuration file:
{
"name": "IRCTC MCP",
"description": "MCP server for IRCTC integration with RapidAPI",
"transport": {
"type": "http",
"url": "http://localhost:3000"
}
}
Adding to Claude Desktop
macOS:
- Open Claude Desktop
- Click on "Claude" in the menu bar
- Select "Settings" (or "Preferences")
- Go to the "Developer" tab
- Click on "Edit Config"
- This will open the configuration file at:
~/Library/Application Support/Claude/claude_desktop_config.json
- This will open the configuration file at:
Windows:
- Open Claude Desktop
- Click on the hamburger menu (☰) in the top-left corner
- Go to "File" > "Settings"
- Navigate to the "Developer" tab
- Click on "Edit Config"
- This will open the configuration file at:
%APPDATA%\Claude\claude_desktop_config.json
- This will open the configuration file at:
Configuration Example:
Add the following JSON to your Claude Desktop configuration file:
{
"mcpServers": {
"irctc": {
"command": "node",
"args": [
"/path/to/irctc-mcp/dist/index.js"
],
"env": {
"RAPIDAPI_KEY": "your_rapidapi_key_here",
"RAPIDAPI_HOST": "irctc1.p.rapidapi.com"
}
}
}
}
After making changes, completely close and restart Claude Desktop for the changes to take effect.
Adding to Claude Web
- Save the above JSON configuration to a file (e.g.,
irctc-mcp.json
) - In Claude Web, click on the '+' button in the sidebar
- Select 'Add MCP Server' and upload your JSON configuration file
- The IRCTC MCP will now be available in your Claude conversations
Example Usage in Claude
Once connected, you can ask Claude to use the IRCTC MCP with prompts like:
Can you search for trains from NDLS to PNBE on 2023-12-25?
Or:
Check the PNR status for 1234567890
Available Tools
Train Tools
searchTrains
: Search for trains between two stationscheckSeatAvailability
: Check seat availability for a specific traingetTrainSchedule
: Get the complete schedule of a traingetLiveTrainStatus
: Get live status of a running train
PNR Tools
getPnrStatus
: Get the current status of a PNRgetPnrHistory
: Get booking history for a PNR (placeholder)checkPnrChartStatus
: Check if the chart has been prepared for a PNR
RapidAPI Integration
This project uses the IRCTC API available on RapidAPI. To use this API:
- Sign up for a free account at RapidAPI
- Subscribe to the IRCTC API
- Get your API key from the RapidAPI dashboard
Environment Variables
RAPIDAPI_KEY
: Your RapidAPI key (required)RAPIDAPI_HOST
: Set toirctc1.p.rapidapi.com
PORT
: Server port (default: 3000)NODE_ENV
: Environment (development/production)
Credits
If you use this project in your work, we'd appreciate a shoutout! While not required, it helps the project grow and helps others discover it. You can mention it like this:
IRCTC MCP - A Model Context Protocol server for Indian Railway IRCTC API integration
https://github.com/nayanraj210401/irctc-mcp
License
This project is licensed under the - see the file for details.