Skip to main content
raja-mcp: unofficial Iran train ticket (بلیط قطار) MCP server that searches Raja trains, Toman prices, free seats and stops for Claude, Cursor and Copilot

raja-mcp: Raja (رجا) Iran train tickets MCP server for AI agents

raja-mcp is an unofficial, read-only MCP server that lets an AI agent search Iranian passenger trains, prices in Toman and free seats on Raja (رجا, raja.ir), the national train ticket seller.
Its 5 tools find stations, search trains between two stations on a date, list every stop of a train, and read Raja's notices (presale dates, refund and boarding rules) and company news.
No API key or account is needed; it works in Claude, Cursor, Copilot and any other MCP client. It needs an Iranian IP (see Limits).

PyPI Python CI License: MIT

For AI agents · Quick start · Tools · Limits · فارسی


For AI agents

  • What: unofficial MCP server (model context protocol) for raja.ir: stations, one-way train search with Toman prices and free seats, train stops, notices and news.
  • Install: uvx raja-mcp or claude mcp add raja -- uvx raja-mcp. Transport: stdio. Needs uv (Python 3.10+).
  • Auth: none. Optional RAJA_MCP_PROXY (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
  • Access: read-only. It cannot log in, reserve, buy or refund a ticket.
  • Tools: 5, all prefixed rj_.
  • Use when: the user asks which trains run between two Iranian cities on a date, what a ticket costs, how many seats are left, where a train stops, or when tickets for the next period go on sale.
  • Output: compact JSON. Prices are Toman per passenger. Stations are Persian or English names or codes; dates are Jalali (1405/08/30) or Gregorian. Notices and news are Persian text.

Quick start

You need uv. No API key or account. Run it from an Iranian network.

Claude Code:

claude mcp add raja -- uvx raja-mcp

Claude Desktop, Cursor, VS Code and other clients:

{
  "mcpServers": {
    "raja": { "command": "uvx", "args": ["raja-mcp"] }
  }
}

Example prompts:

  • "Find the cheapest train from Tehran to Mashhad on 1405/08/30."
  • "Where does train 172 stop and at what times?"
  • "When do Raja tickets for the next period go on sale?"
  • قطار تهران به مشهد در ۳۰ آبان را با قیمت و صندلی خالی پیدا کن.
  • قطار ۱۷۲ در چه ایستگاه‌هایی توقف می‌کند؟

A real answer (rj_search_trains, Tehran to Mashhad, 1405/08/30 = 21 Nov 2026, run 17 Nov 2026): 14 train and wagon rows. The cheapest was train 318 (Raja, 4-star bus-style Saba, 09:10 to 21:30) at 915,050 Toman with 340 seats; then train 330 (Joopar, 3-star 6-berth) at 1,120,000 Toman with 70 seats, and train 368 (Mahtab Sir Jam) at 1,223,800 Toman with 146 seats. Prices and seats change as tickets sell.

Tools

Tool What it does
rj_stations Find Raja railway stations and their codes by Persian or English name.
rj_search_trains Search one-way trains between two stations on a date, with prices in Toman and free seats.
rj_train_stops List every stop of a train with its time, from a row's ref of rj_search_trains.
rj_announcements Read the notices Raja shows at the top of its site: presale dates, refund rules, boarding rules.
rj_news List the latest Raja company news (title, Jalali date, id) or read one story's text by id.

Limits

  • Needs an Iranian IP. raja.ir and hostservice.raja.ir answer 403 from foreign exits; the error says so. Run it from Iran, or set RAJA_MCP_PROXY to an Iranian proxy. The server ignores system proxy variables on purpose.
  • Search is one-way, one passenger. Female-only and male-only seat groups are supported by the tool but were not compared against the site.
  • free_seats is what the site shows: "20+" above 20, and sold-out trains are hidden unless asked.
  • A train that passes the origin after midnight needs the previous day for rj_train_stops; the tool retries it.
  • One wagon row (train 198, "پنج ستاره فدک") was in the API but not drawn on the page once; the server returns it.
  • Booking, login, payment and refunds are not covered; tell the user to book on raja.ir. Raja rotates the search key and its api-key header with the site's code, so a site update can break the tools until the server is updated.

How it works

Raja has no public API. The endpoints behind its search page were mapped in Chrome, and the tools were checked in Chrome against the real pages (search rows, prices, seats, stops, news and notices matched). The search query is encrypted the way the site's own script does it, using a public key the site serves. Requests use a browser-like client, a short cache and low concurrency.

فارسی

raja-mcp یک سرور MCP غیررسمی و فقط‌خواندنی است که به ایجنت هوش مصنوعی اجازه می‌دهد قطارهای مسافری ایران، قیمت به تومان و صندلی‌های خالی را در سایت رجا (raja.ir) جست‌وجو کند. ایستگاه‌ها، توقف‌گاه‌های هر قطار، اطلاعیه‌ها و اخبار رجا را هم می‌خواند. خرید، رزرو و استرداد ندارد. رجا فقط از آی‌پی ایران جواب می‌دهد. نصب در Claude Code:

claude mcp add raja -- uvx raja-mcp

Development

uv sync
uv run ruff check . && uv run ruff format --check .
uv run python -m pytest -q          # offline tests on recorded fixtures
uv run python -m pytest -m live -q  # live calls to raja.ir, direct Iranian line only

Releases: bump the version in pyproject.toml and server.json, run uv lock, then push a v* tag; GitHub Actions publishes to PyPI.

Disclaimer

Unofficial and not affiliated with or endorsed by Raja. It is read-only and uses the public pages and API of that site, which can change without notice.

Author

Built and maintained by Sepehr Radmard (سپهر رادمرد). LinkedIn · GitHub · more servers in iran-mcp.

License

MIT

Metadata

Release files for raja-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raja-mcp 0.1.0
File Size Uploaded Provenance Actions
raja_mcp-0.1.0.tar.gz 468.3 kB With provenance Details for raja_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for raja-mcp 0.1.0
File Interpreter ABI Platform Actions
raja_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for raja_mcp-0.1.0-py3-none-any.whl

Total release size: 485.6 kB

Release files / raja_mcp-0.1.0.tar.gz

Download URL raja_mcp-0.1.0.tar.gz
Size 468.3 kB
Tags Source
SHA-256 checksum
How to use checksums
99da1cb47ad2ba45edac72c99dd19ef38395cd8d58461114ab82c1506795709a
BLAKE2b-256 checksum
How to use checksums
7aa4458a7a8eb57433a8a6991ad7ba70d26a91e0a322abbe5e140d7fc6a858b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / raja_mcp-0.1.0-py3-none-any.whl

Download URL raja_mcp-0.1.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
321c3cd155600b4035968c28951247f0ff411f3eb3dd3cc5a03bef5e4bb52601
BLAKE2b-256 checksum
How to use checksums
2bafb44c3eb45ac9e373a4c08ccf90d8baeb33f7a8a0d816a5905344953f2172
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for raja-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for raja_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page