Back to search
Railway-mcp-server
MCP serverGitHub
Spring Boot MCP server exposing the Railway Reservation API as tools for GitHub Copilot and other MCP clients. It uses Streamable HTTP and connects to the backend at http://localhost:8080 by default.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Checked today
Badge for your README
Markdown
[](/listings/dkawale499--railway-mcp-server)HTML
<a href="/listings/dkawale499--railway-mcp-server"><img src="/api/listings/dkawale499--railway-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>Install
i
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
README.md · README · 116 lines
- # Railway Reservation MCP Server
- Spring Boot MCP server exposing the Railway Reservation API as tools for
- GitHub Copilot and other MCP clients. It uses Streamable HTTP and connects to
- the backend at `http://localhost:8080` by default.
- ## Configuration and startup
- The MCP server listens on `127.0.0.1:8081`. Optional default backend credentials
- and the API base URL can be set with environment variables:
- | Environment variable | Default | Description |
- | --- | --- | --- |
- | `RAILWAY_BASE_URL` | `http://localhost:8080` | Railway API base URL |
- | `RAILWAY_EMAIL` | `ADMIN_BOOTSTRAP_USERNAME` or empty | Optional default account email |
- | `RAILWAY_PASSWORD` | `ADMIN_BOOTSTRAP_PASSWORD` or empty | Optional default account password |
- PowerShell example:
- ```powershell
- $env:RAILWAY_EMAIL = "asha@example.com"
- $env:RAILWAY_PASSWORD = "<password>"
- .\mvnw.cmd spring-boot:run
- ```
- The backend does not create an administrator by default. To explicitly
- bootstrap one, set `ADMIN_BOOTSTRAP_PASSWORD` before starting the backend; the
- optional `ADMIN_BOOTSTRAP_USERNAME` selects its login email. The MCP server
- does not create accounts. To use an already-existing account, call its `login`
- tool with that account's email and password. `login` switches the server's
- active account and role; this authentication state is shared by all clients
- connected to this local MCP server. Keep the server on localhost and do not
- use this shared account-switching model as a multi-user hosted service.
- After a `401 Unauthorized`, the server clears the cached token, logs in again
- with the active account credentials, and retries the failed request once.
- `403 Forbidden` responses explain which active role lacks permission and
- recommend switching accounts. `400 Bad Request` and `402 Payment Required`
- responses include the backend status and response body.
- ## VS Code / GitHub Copilot
- Add `.vscode/mcp.json` to the workspace where you use Copilot:
- ```json
- {
- "servers": {
- "railway-reservation": {
- "type": "http",
- "url": "http://127.0.0.1:8081/mcp"
- }
- }
- }
- ```
- Reload VS Code, open Copilot Chat in Agent mode, and enable the
- `railway-reservation` server.
- ## Authentication tools
- | Tool | Purpose |
- | --- | --- |
- | `login(email, password)` | Log in or switch the active account and role (`USER` or `ADMIN`). |
- | `logout()` | Clear the active account and cached JWT; subsequent requests are unauthenticated until the next login. |
- | `registerPassenger(fullName, email, phone, password)` | Register a passenger and automatically log in. The backend grants its one-time welcome bonus. |
- The MCP server keeps the active account's credentials in memory to refresh its
- JWT after a 401. A successful `login` replaces the active account; a failed
- login does not replace it. `logout` clears the MCP server's local credentials
- and token. The backend API has no token-revocation endpoint, so this does not
- revoke an already-issued JWT server-side.
- ## Available tools
- | Tool | Backend operation |
- | --- | --- |
- | `checkApplicationHealth` | `GET /actuator/health` |
- | `searchTrains` | `GET /trains/search` |
- | `bookTicket` | `POST /ticket`, with `name`, `dob`, `gender`, `doj`, `source`, `dest`, and `trainNo` |
- | `searchPnr` | `GET /ticket/{ticketId}` |
- | `cancelTicket` | `POST /ticket/{ticketId}/cancel` |
- | `walletDetails` | `GET /wallet` |
- | `myTickets` | `GET /tickets/mine` |
- | `getTrainFare` | `GET /trains/fare` |
- | `getAllTickets` | **ADMIN ONLY:** `GET /admin/tickets` |
- | `getCancelledTickets` | **ADMIN ONLY:** `GET /admin/tickets?status=Cancelled` |
- | `ticketSummary` | **ADMIN ONLY:** `GET /admin/tickets/summary` |
- | `listUsers` | **ADMIN ONLY:** `GET /admin/users` |
- | `createTrainSchedule` | **ADMIN ONLY:** `POST /admin/trains` |
- | `updateFare` | **ADMIN ONLY:** `PUT /admin/trains/{scheduleId}/fare` |
- | `updateCoachConfiguration` | **ADMIN ONLY:** `PUT /admin/trains/{scheduleId}/coaches` |
- | `getTrainSchedules` | **ADMIN ONLY:** `GET /admin/trains` |
- The train-schedule tools use typed arguments rather than raw JSON:
- - `createTrainSchedule(trainNo, source, destination, journeyDate, ticketFare, coaches)`
- - `updateFare(scheduleId, ticketFare)`
- - `updateCoachConfiguration(scheduleId, coaches)`
- Each coach is a `CoachConfig` object with `coachType`, `coachCount`, and
- `seatsPerCoach`. Supported coach types are `SL`, `3AC`, `2AC`, and `1AC`.
- `updateCoachConfiguration` sends the list of coach objects as the request body.
- `bookTicket` expects dates in `yyyy-MM-dd` format and gender as `MALE`,
- `FEMALE`, or `OTHER`. The backend enforces passenger ownership and role
- authorization; admin tools require an `ADMIN` account.
- See [API.md](./API.md) for the complete MCP tool and backend API reference.
- ## Testing
- Run the test suite:
- ```powershell
- .\mvnw.cmd test
- ```
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.