Skip to content
Back to search

Railway-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.

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
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/dkawale499--railway-mcp-server/badge.svg)](/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
  1. # Railway Reservation MCP Server
  2. Spring Boot MCP server exposing the Railway Reservation API as tools for
  3. GitHub Copilot and other MCP clients. It uses Streamable HTTP and connects to
  4. the backend at `http://localhost:8080` by default.
  5. ## Configuration and startup
  6. The MCP server listens on `127.0.0.1:8081`. Optional default backend credentials
  7. and the API base URL can be set with environment variables:
  8. | Environment variable | Default | Description |
  9. | --- | --- | --- |
  10. | `RAILWAY_BASE_URL` | `http://localhost:8080` | Railway API base URL |
  11. | `RAILWAY_EMAIL` | `ADMIN_BOOTSTRAP_USERNAME` or empty | Optional default account email |
  12. | `RAILWAY_PASSWORD` | `ADMIN_BOOTSTRAP_PASSWORD` or empty | Optional default account password |
  13. PowerShell example:
  14. ```powershell
  15. $env:RAILWAY_EMAIL = "asha@example.com"
  16. $env:RAILWAY_PASSWORD = "<password>"
  17. .\mvnw.cmd spring-boot:run
  18. ```
  19. The backend does not create an administrator by default. To explicitly
  20. bootstrap one, set `ADMIN_BOOTSTRAP_PASSWORD` before starting the backend; the
  21. optional `ADMIN_BOOTSTRAP_USERNAME` selects its login email. The MCP server
  22. does not create accounts. To use an already-existing account, call its `login`
  23. tool with that account's email and password. `login` switches the server's
  24. active account and role; this authentication state is shared by all clients
  25. connected to this local MCP server. Keep the server on localhost and do not
  26. use this shared account-switching model as a multi-user hosted service.
  27. After a `401 Unauthorized`, the server clears the cached token, logs in again
  28. with the active account credentials, and retries the failed request once.
  29. `403 Forbidden` responses explain which active role lacks permission and
  30. recommend switching accounts. `400 Bad Request` and `402 Payment Required`
  31. responses include the backend status and response body.
  32. ## VS Code / GitHub Copilot
  33. Add `.vscode/mcp.json` to the workspace where you use Copilot:
  34. ```json
  35. {
  36. "servers": {
  37. "railway-reservation": {
  38. "type": "http",
  39. "url": "http://127.0.0.1:8081/mcp"
  40. }
  41. }
  42. }
  43. ```
  44. Reload VS Code, open Copilot Chat in Agent mode, and enable the
  45. `railway-reservation` server.
  46. ## Authentication tools
  47. | Tool | Purpose |
  48. | --- | --- |
  49. | `login(email, password)` | Log in or switch the active account and role (`USER` or `ADMIN`). |
  50. | `logout()` | Clear the active account and cached JWT; subsequent requests are unauthenticated until the next login. |
  51. | `registerPassenger(fullName, email, phone, password)` | Register a passenger and automatically log in. The backend grants its one-time welcome bonus. |
  52. The MCP server keeps the active account's credentials in memory to refresh its
  53. JWT after a 401. A successful `login` replaces the active account; a failed
  54. login does not replace it. `logout` clears the MCP server's local credentials
  55. and token. The backend API has no token-revocation endpoint, so this does not
  56. revoke an already-issued JWT server-side.
  57. ## Available tools
  58. | Tool | Backend operation |
  59. | --- | --- |
  60. | `checkApplicationHealth` | `GET /actuator/health` |
  61. | `searchTrains` | `GET /trains/search` |
  62. | `bookTicket` | `POST /ticket`, with `name`, `dob`, `gender`, `doj`, `source`, `dest`, and `trainNo` |
  63. | `searchPnr` | `GET /ticket/{ticketId}` |
  64. | `cancelTicket` | `POST /ticket/{ticketId}/cancel` |
  65. | `walletDetails` | `GET /wallet` |
  66. | `myTickets` | `GET /tickets/mine` |
  67. | `getTrainFare` | `GET /trains/fare` |
  68. | `getAllTickets` | **ADMIN ONLY:** `GET /admin/tickets` |
  69. | `getCancelledTickets` | **ADMIN ONLY:** `GET /admin/tickets?status=Cancelled` |
  70. | `ticketSummary` | **ADMIN ONLY:** `GET /admin/tickets/summary` |
  71. | `listUsers` | **ADMIN ONLY:** `GET /admin/users` |
  72. | `createTrainSchedule` | **ADMIN ONLY:** `POST /admin/trains` |
  73. | `updateFare` | **ADMIN ONLY:** `PUT /admin/trains/{scheduleId}/fare` |
  74. | `updateCoachConfiguration` | **ADMIN ONLY:** `PUT /admin/trains/{scheduleId}/coaches` |
  75. | `getTrainSchedules` | **ADMIN ONLY:** `GET /admin/trains` |
  76. The train-schedule tools use typed arguments rather than raw JSON:
  77. - `createTrainSchedule(trainNo, source, destination, journeyDate, ticketFare, coaches)`
  78. - `updateFare(scheduleId, ticketFare)`
  79. - `updateCoachConfiguration(scheduleId, coaches)`
  80. Each coach is a `CoachConfig` object with `coachType`, `coachCount`, and
  81. `seatsPerCoach`. Supported coach types are `SL`, `3AC`, `2AC`, and `1AC`.
  82. `updateCoachConfiguration` sends the list of coach objects as the request body.
  83. `bookTicket` expects dates in `yyyy-MM-dd` format and gender as `MALE`,
  84. `FEMALE`, or `OTHER`. The backend enforces passenger ownership and role
  85. authorization; admin tools require an `ADMIN` account.
  86. See [API.md](./API.md) for the complete MCP tool and backend API reference.
  87. ## Testing
  88. Run the test suite:
  89. ```powershell
  90. .\mvnw.cmd test
  91. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.