MCP ExplorerExplorer

Irctc Mcp

@nayanraj210401on 19 days ago
1 MIT
FreeCommunity
AI Systems
A Model Context Protocol (MCP) server for IRCTC (Indian Railways) integration using RapidAPI

Overview

What is Irctc Mcp

irctc-mcp is a Model Context Protocol (MCP) server designed for integration with the Indian Railways Catering and Tourism Corporation (IRCTC) using RapidAPI. It provides functionalities such as train searches, PNR status checks, and more.

Use cases

Use cases for irctc-mcp include developing travel booking applications, creating dashboards for train status monitoring, integrating with chatbots for customer support, and providing real-time updates for passengers.

How to use

To use irctc-mcp, clone the repository, install dependencies, configure your RapidAPI key in the .env file, build the project, and run the server in either development or production mode. You can also integrate it into applications like Cascade or Claude by updating their configuration files.

Key features

Key features of irctc-mcp include searching for trains between stations, checking seat availability, obtaining train schedules, checking PNR status, and getting live train status. It is built with TypeScript for type safety and supports environment-based configuration.

Where to use

irctc-mcp can be used in applications that require integration with Indian Railways services, such as travel booking platforms, mobile applications, and other software solutions that need real-time train information.

Content

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

  1. Clone the repository:

    git clone <repository-url>
    cd irctc-mcp
    
  2. Install dependencies:

    npm install
    
  3. Copy .env.example to .env and update with your RapidAPI key:

    cp .env.example .env
    
  4. 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:

  1. Open Claude Desktop
  2. Click on “Claude” in the menu bar
  3. Select “Settings” (or “Preferences”)
  4. Go to the “Developer” tab
  5. Click on “Edit Config”
    • This will open the configuration file at: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows:

  1. Open Claude Desktop
  2. Click on the hamburger menu (☰) in the top-left corner
  3. Go to “File” > “Settings”
  4. Navigate to the “Developer” tab
  5. Click on “Edit Config”
    • This will open the configuration file at: %APPDATA%\Claude\claude_desktop_config.json

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

  1. Save the above JSON configuration to a file (e.g., irctc-mcp.json)
  2. In Claude Web, click on the ‘+’ button in the sidebar
  3. Select ‘Add MCP Server’ and upload your JSON configuration file
  4. 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 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

PNR Tools

  • getPnrStatus: Get the current status of a PNR
  • getPnrHistory: 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:

  1. Sign up for a free account at RapidAPI
  2. Subscribe to the IRCTC API
  3. Get your API key from the RapidAPI dashboard

Environment Variables

  • RAPIDAPI_KEY: Your RapidAPI key (required)
  • RAPIDAPI_HOST: Set to irctc1.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 MIT License - see the LICENSE file for details.

Tools

No tools

Comments