raja-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- raja_mcp-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +43 -0
- raja_mcp-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- raja_mcp-0.1.0/.github/banner.png +0 -0
- raja_mcp-0.1.0/.github/dependabot.yml +10 -0
- raja_mcp-0.1.0/.github/workflows/ci.yml +22 -0
- raja_mcp-0.1.0/.github/workflows/publish.yml +51 -0
- raja_mcp-0.1.0/.gitignore +6 -0
- raja_mcp-0.1.0/LICENSE +21 -0
- raja_mcp-0.1.0/PKG-INFO +149 -0
- raja_mcp-0.1.0/README.md +120 -0
- raja_mcp-0.1.0/pyproject.toml +57 -0
- raja_mcp-0.1.0/server.json +32 -0
- raja_mcp-0.1.0/src/raja_mcp/__init__.py +5 -0
- raja_mcp-0.1.0/src/raja_mcp/http.py +251 -0
- raja_mcp-0.1.0/src/raja_mcp/registry.py +16 -0
- raja_mcp-0.1.0/src/raja_mcp/server.py +93 -0
- raja_mcp-0.1.0/src/raja_mcp/trains.py +257 -0
- raja_mcp-0.1.0/tests/conftest.py +72 -0
- raja_mcp-0.1.0/tests/fixtures/news.json +50 -0
- raja_mcp-0.1.0/tests/fixtures/newsshow.json +7 -0
- raja_mcp-0.1.0/tests/fixtures/search.json +81 -0
- raja_mcp-0.1.0/tests/fixtures/stations.json +56 -0
- raja_mcp-0.1.0/tests/fixtures/timeline.json +98 -0
- raja_mcp-0.1.0/tests/fixtures/xrs.json +6 -0
- raja_mcp-0.1.0/tests/test_live_raja.py +32 -0
- raja_mcp-0.1.0/tests/test_raja.py +138 -0
- raja_mcp-0.1.0/uv.lock +1363 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: A tool failed or returned wrong data
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: input
|
|
6
|
+
id: tool
|
|
7
|
+
attributes:
|
|
8
|
+
label: Tool
|
|
9
|
+
description: Which tool, e.g. ins_quote_travel
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: input
|
|
14
|
+
attributes:
|
|
15
|
+
label: Arguments and result
|
|
16
|
+
description: The arguments the agent sent and the error or wrong output. Remove anything personal.
|
|
17
|
+
render: json
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: expected
|
|
22
|
+
attributes:
|
|
23
|
+
label: What you expected
|
|
24
|
+
description: e.g. what irantalent.com, jobinja.ir or jobvision.ir shows for the same input
|
|
25
|
+
- type: input
|
|
26
|
+
id: client
|
|
27
|
+
attributes:
|
|
28
|
+
label: MCP client and OS
|
|
29
|
+
placeholder: Claude Desktop 1.x on Windows 11
|
|
30
|
+
- type: dropdown
|
|
31
|
+
id: network
|
|
32
|
+
attributes:
|
|
33
|
+
label: Network
|
|
34
|
+
options:
|
|
35
|
+
- Direct connection from Iran
|
|
36
|
+
- Direct connection outside Iran
|
|
37
|
+
- VPN or proxy
|
|
38
|
+
- IRAN_JOBS_MCP_PROXY set
|
|
39
|
+
- type: input
|
|
40
|
+
id: version
|
|
41
|
+
attributes:
|
|
42
|
+
label: raja-mcp version
|
|
43
|
+
placeholder: "0.1.0"
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python: ["3.10", "3.11", "3.12", "3.13"]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python }}
|
|
19
|
+
- run: uv sync --locked
|
|
20
|
+
- run: uv run ruff check .
|
|
21
|
+
- run: uv run ruff format --check .
|
|
22
|
+
- run: uv run pytest -q
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
# Tag a release (git tag v0.1.0 && git push --tags) after bumping the version in
|
|
4
|
+
# pyproject.toml and server.json.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
pypi:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
environment: pypi
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write # PyPI trusted publishing
|
|
15
|
+
contents: write # GitHub Release
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
19
|
+
- name: Check versions match the tag
|
|
20
|
+
run: |
|
|
21
|
+
TAG=${GITHUB_REF_NAME#v}
|
|
22
|
+
grep -q "^version = \"$TAG\"" pyproject.toml
|
|
23
|
+
test "$(jq -r .version server.json)" = "$TAG"
|
|
24
|
+
test "$(jq -r '.packages[0].version' server.json)" = "$TAG"
|
|
25
|
+
- run: uv sync --locked && uv run pytest -q
|
|
26
|
+
- run: uv build
|
|
27
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
28
|
+
- run: gh release create "$GITHUB_REF_NAME" dist/* --generate-notes --title "$GITHUB_REF_NAME"
|
|
29
|
+
env:
|
|
30
|
+
GH_TOKEN: ${{ github.token }}
|
|
31
|
+
|
|
32
|
+
mcp-registry:
|
|
33
|
+
needs: pypi
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
permissions:
|
|
36
|
+
id-token: write # MCP Registry login via GitHub OIDC
|
|
37
|
+
contents: read
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v7
|
|
40
|
+
- name: Wait for PyPI to serve the new version
|
|
41
|
+
run: |
|
|
42
|
+
for i in $(seq 1 30); do
|
|
43
|
+
curl -sf "https://pypi.org/pypi/raja-mcp/${GITHUB_REF_NAME#v}/json" >/dev/null && exit 0
|
|
44
|
+
sleep 10
|
|
45
|
+
done
|
|
46
|
+
exit 1
|
|
47
|
+
- name: Install mcp-publisher
|
|
48
|
+
run: |
|
|
49
|
+
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.8.1/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
|
|
50
|
+
- run: ./mcp-publisher login github-oidc
|
|
51
|
+
- run: ./mcp-publisher publish
|
raja_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sepehr Radmard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
raja_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: raja-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unofficial read-only MCP server for Raja (raja.ir), the Iranian train ticket seller: stations, train search with prices and free seats, timetables, news.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sepehr071/raja-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/sepehr071/raja-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/sepehr071/raja-mcp/issues
|
|
8
|
+
Project-URL: Website, https://mcpfarsi.ir/
|
|
9
|
+
Author-email: Sepehr Radmard <sepehrr80@gmail.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai-agents,bilit-ghatar,claude,farsi,iran,iran-railways,mcp,mcp-server,model-context-protocol,persian,railway,raja,raja-ir,raja-passenger-trains,timetable,train,train-tickets,travel
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: cryptography>=42
|
|
24
|
+
Requires-Dist: curl-cffi>=0.16.3
|
|
25
|
+
Requires-Dist: httpx-curl-cffi>=0.1.5
|
|
26
|
+
Requires-Dist: httpx>=0.27
|
|
27
|
+
Requires-Dist: mcp<3,>=2.2
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
<!-- mcp-name: io.github.sepehr071/raja-mcp -->
|
|
31
|
+
|
|
32
|
+
<div align="center">
|
|
33
|
+
|
|
34
|
+
<img src="https://raw.githubusercontent.com/sepehr071/raja-mcp/main/.github/banner.png" alt="raja-mcp: unofficial Iran train ticket (بلیط قطار) MCP server that searches Raja trains, Toman prices, free seats and stops for Claude, Cursor and Copilot" width="100%">
|
|
35
|
+
|
|
36
|
+
# raja-mcp: Raja (رجا) Iran train tickets MCP server for AI agents
|
|
37
|
+
|
|
38
|
+
**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.**<br>
|
|
39
|
+
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.<br>
|
|
40
|
+
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).
|
|
41
|
+
|
|
42
|
+
[](https://pypi.org/project/raja-mcp/)
|
|
43
|
+
[](https://pypi.org/project/raja-mcp/)
|
|
44
|
+
[](https://github.com/sepehr071/raja-mcp/actions/workflows/ci.yml)
|
|
45
|
+
[](https://github.com/sepehr071/raja-mcp/blob/main/LICENSE)
|
|
46
|
+
|
|
47
|
+
[For AI agents](#for-ai-agents) · [Quick start](#quick-start) · [Tools](#tools) · [Limits](#limits) · [فارسی](#فارسی)
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## For AI agents
|
|
54
|
+
|
|
55
|
+
- **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.
|
|
56
|
+
- **Install:** `uvx raja-mcp` or `claude mcp add raja -- uvx raja-mcp`. Transport: stdio. Needs [uv](https://docs.astral.sh/uv/getting-started/installation/) (Python 3.10+).
|
|
57
|
+
- **Auth:** none. Optional `RAJA_MCP_PROXY` (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
|
|
58
|
+
- **Access:** read-only. It cannot log in, reserve, buy or refund a ticket.
|
|
59
|
+
- **Tools:** 5, all prefixed `rj_`.
|
|
60
|
+
- **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.
|
|
61
|
+
- **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.
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
You need [uv](https://docs.astral.sh/uv/getting-started/installation/). No API key or account. Run it from an Iranian network.
|
|
66
|
+
|
|
67
|
+
Claude Code:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
claude mcp add raja -- uvx raja-mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Claude Desktop, Cursor, VS Code and other clients:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"raja": { "command": "uvx", "args": ["raja-mcp"] }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Example prompts:
|
|
84
|
+
|
|
85
|
+
- "Find the cheapest train from Tehran to Mashhad on 1405/08/30."
|
|
86
|
+
- "Where does train 172 stop and at what times?"
|
|
87
|
+
- "When do Raja tickets for the next period go on sale?"
|
|
88
|
+
- <span dir="rtl">قطار تهران به مشهد در ۳۰ آبان را با قیمت و صندلی خالی پیدا کن.</span>
|
|
89
|
+
- <span dir="rtl">قطار ۱۷۲ در چه ایستگاههایی توقف میکند؟</span>
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
## Tools
|
|
94
|
+
|
|
95
|
+
| Tool | What it does |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `rj_stations` | Find Raja railway stations and their codes by Persian or English name. |
|
|
98
|
+
| `rj_search_trains` | Search one-way trains between two stations on a date, with prices in Toman and free seats. |
|
|
99
|
+
| `rj_train_stops` | List every stop of a train with its time, from a row's `ref` of rj_search_trains. |
|
|
100
|
+
| `rj_announcements` | Read the notices Raja shows at the top of its site: presale dates, refund rules, boarding rules. |
|
|
101
|
+
| `rj_news` | List the latest Raja company news (title, Jalali date, id) or read one story's text by id. |
|
|
102
|
+
|
|
103
|
+
## Limits
|
|
104
|
+
|
|
105
|
+
- 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.
|
|
106
|
+
- 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.
|
|
107
|
+
- `free_seats` is what the site shows: "20+" above 20, and sold-out trains are hidden unless asked.
|
|
108
|
+
- A train that passes the origin after midnight needs the previous day for `rj_train_stops`; the tool retries it.
|
|
109
|
+
- One wagon row (train 198, "پنج ستاره فدک") was in the API but not drawn on the page once; the server returns it.
|
|
110
|
+
- 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.
|
|
111
|
+
|
|
112
|
+
## How it works
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
## فارسی
|
|
117
|
+
|
|
118
|
+
<div dir="rtl">
|
|
119
|
+
|
|
120
|
+
raja-mcp یک سرور MCP غیررسمی و فقطخواندنی است که به ایجنت هوش مصنوعی اجازه میدهد قطارهای مسافری ایران، قیمت به تومان و صندلیهای خالی را در سایت رجا (raja.ir) جستوجو کند. ایستگاهها، توقفگاههای هر قطار، اطلاعیهها و اخبار رجا را هم میخواند. خرید، رزرو و استرداد ندارد. رجا فقط از آیپی ایران جواب میدهد. نصب در Claude Code:
|
|
121
|
+
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
claude mcp add raja -- uvx raja-mcp
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
uv sync
|
|
132
|
+
uv run ruff check . && uv run ruff format --check .
|
|
133
|
+
uv run python -m pytest -q # offline tests on recorded fixtures
|
|
134
|
+
uv run python -m pytest -m live -q # live calls to raja.ir, direct Iranian line only
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Releases: bump the version in `pyproject.toml` and `server.json`, run `uv lock`, then push a `v*` tag; GitHub Actions publishes to PyPI.
|
|
138
|
+
|
|
139
|
+
## Disclaimer
|
|
140
|
+
|
|
141
|
+
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.
|
|
142
|
+
|
|
143
|
+
## Author
|
|
144
|
+
|
|
145
|
+
Built and maintained by **Sepehr Radmard** (سپهر رادمرد). [LinkedIn](https://www.linkedin.com/in/sepehr-radmard) · [GitHub](https://github.com/sepehr071) · more servers in [iran-mcp](https://github.com/sepehr071/iran-mcp).
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
[MIT](https://github.com/sepehr071/raja-mcp/blob/main/LICENSE)
|
raja_mcp-0.1.0/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.sepehr071/raja-mcp -->
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
<img src="https://raw.githubusercontent.com/sepehr071/raja-mcp/main/.github/banner.png" alt="raja-mcp: unofficial Iran train ticket (بلیط قطار) MCP server that searches Raja trains, Toman prices, free seats and stops for Claude, Cursor and Copilot" width="100%">
|
|
6
|
+
|
|
7
|
+
# raja-mcp: Raja (رجا) Iran train tickets MCP server for AI agents
|
|
8
|
+
|
|
9
|
+
**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.**<br>
|
|
10
|
+
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.<br>
|
|
11
|
+
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).
|
|
12
|
+
|
|
13
|
+
[](https://pypi.org/project/raja-mcp/)
|
|
14
|
+
[](https://pypi.org/project/raja-mcp/)
|
|
15
|
+
[](https://github.com/sepehr071/raja-mcp/actions/workflows/ci.yml)
|
|
16
|
+
[](https://github.com/sepehr071/raja-mcp/blob/main/LICENSE)
|
|
17
|
+
|
|
18
|
+
[For AI agents](#for-ai-agents) · [Quick start](#quick-start) · [Tools](#tools) · [Limits](#limits) · [فارسی](#فارسی)
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## For AI agents
|
|
25
|
+
|
|
26
|
+
- **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.
|
|
27
|
+
- **Install:** `uvx raja-mcp` or `claude mcp add raja -- uvx raja-mcp`. Transport: stdio. Needs [uv](https://docs.astral.sh/uv/getting-started/installation/) (Python 3.10+).
|
|
28
|
+
- **Auth:** none. Optional `RAJA_MCP_PROXY` (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
|
|
29
|
+
- **Access:** read-only. It cannot log in, reserve, buy or refund a ticket.
|
|
30
|
+
- **Tools:** 5, all prefixed `rj_`.
|
|
31
|
+
- **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.
|
|
32
|
+
- **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.
|
|
33
|
+
|
|
34
|
+
## Quick start
|
|
35
|
+
|
|
36
|
+
You need [uv](https://docs.astral.sh/uv/getting-started/installation/). No API key or account. Run it from an Iranian network.
|
|
37
|
+
|
|
38
|
+
Claude Code:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
claude mcp add raja -- uvx raja-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Claude Desktop, Cursor, VS Code and other clients:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"raja": { "command": "uvx", "args": ["raja-mcp"] }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Example prompts:
|
|
55
|
+
|
|
56
|
+
- "Find the cheapest train from Tehran to Mashhad on 1405/08/30."
|
|
57
|
+
- "Where does train 172 stop and at what times?"
|
|
58
|
+
- "When do Raja tickets for the next period go on sale?"
|
|
59
|
+
- <span dir="rtl">قطار تهران به مشهد در ۳۰ آبان را با قیمت و صندلی خالی پیدا کن.</span>
|
|
60
|
+
- <span dir="rtl">قطار ۱۷۲ در چه ایستگاههایی توقف میکند؟</span>
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
## Tools
|
|
65
|
+
|
|
66
|
+
| Tool | What it does |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `rj_stations` | Find Raja railway stations and their codes by Persian or English name. |
|
|
69
|
+
| `rj_search_trains` | Search one-way trains between two stations on a date, with prices in Toman and free seats. |
|
|
70
|
+
| `rj_train_stops` | List every stop of a train with its time, from a row's `ref` of rj_search_trains. |
|
|
71
|
+
| `rj_announcements` | Read the notices Raja shows at the top of its site: presale dates, refund rules, boarding rules. |
|
|
72
|
+
| `rj_news` | List the latest Raja company news (title, Jalali date, id) or read one story's text by id. |
|
|
73
|
+
|
|
74
|
+
## Limits
|
|
75
|
+
|
|
76
|
+
- 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.
|
|
77
|
+
- 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.
|
|
78
|
+
- `free_seats` is what the site shows: "20+" above 20, and sold-out trains are hidden unless asked.
|
|
79
|
+
- A train that passes the origin after midnight needs the previous day for `rj_train_stops`; the tool retries it.
|
|
80
|
+
- One wagon row (train 198, "پنج ستاره فدک") was in the API but not drawn on the page once; the server returns it.
|
|
81
|
+
- 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.
|
|
82
|
+
|
|
83
|
+
## How it works
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
|
|
87
|
+
## فارسی
|
|
88
|
+
|
|
89
|
+
<div dir="rtl">
|
|
90
|
+
|
|
91
|
+
raja-mcp یک سرور MCP غیررسمی و فقطخواندنی است که به ایجنت هوش مصنوعی اجازه میدهد قطارهای مسافری ایران، قیمت به تومان و صندلیهای خالی را در سایت رجا (raja.ir) جستوجو کند. ایستگاهها، توقفگاههای هر قطار، اطلاعیهها و اخبار رجا را هم میخواند. خرید، رزرو و استرداد ندارد. رجا فقط از آیپی ایران جواب میدهد. نصب در Claude Code:
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
claude mcp add raja -- uvx raja-mcp
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Development
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
uv sync
|
|
103
|
+
uv run ruff check . && uv run ruff format --check .
|
|
104
|
+
uv run python -m pytest -q # offline tests on recorded fixtures
|
|
105
|
+
uv run python -m pytest -m live -q # live calls to raja.ir, direct Iranian line only
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Releases: bump the version in `pyproject.toml` and `server.json`, run `uv lock`, then push a `v*` tag; GitHub Actions publishes to PyPI.
|
|
109
|
+
|
|
110
|
+
## Disclaimer
|
|
111
|
+
|
|
112
|
+
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.
|
|
113
|
+
|
|
114
|
+
## Author
|
|
115
|
+
|
|
116
|
+
Built and maintained by **Sepehr Radmard** (سپهر رادمرد). [LinkedIn](https://www.linkedin.com/in/sepehr-radmard) · [GitHub](https://github.com/sepehr071) · more servers in [iran-mcp](https://github.com/sepehr071/iran-mcp).
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
[MIT](https://github.com/sepehr071/raja-mcp/blob/main/LICENSE)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "raja-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Unofficial read-only MCP server for Raja (raja.ir), the Iranian train ticket seller: stations, train search with prices and free seats, timetables, news."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Sepehr Radmard", email = "sepehrr80@gmail.com" }]
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
keywords = ["mcp", "model-context-protocol", "raja", "raja-ir", "raja-passenger-trains", "train", "train-tickets", "railway", "iran-railways", "bilit-ghatar", "timetable", "travel", "iran", "claude", "persian", "farsi", "ai-agents", "mcp-server"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"mcp>=2.2,<3",
|
|
24
|
+
"httpx>=0.27",
|
|
25
|
+
"httpx-curl-cffi>=0.1.5",
|
|
26
|
+
"curl-cffi>=0.16.3",
|
|
27
|
+
"cryptography>=42",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/sepehr071/raja-mcp"
|
|
32
|
+
Repository = "https://github.com/sepehr071/raja-mcp"
|
|
33
|
+
Issues = "https://github.com/sepehr071/raja-mcp/issues"
|
|
34
|
+
Website = "https://mcpfarsi.ir/"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
raja-mcp = "raja_mcp.server:main"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = ["pytest>=8", "ruff>=0.6"]
|
|
41
|
+
|
|
42
|
+
[build-system]
|
|
43
|
+
requires = ["hatchling"]
|
|
44
|
+
build-backend = "hatchling.build"
|
|
45
|
+
|
|
46
|
+
[tool.pytest.ini_options]
|
|
47
|
+
testpaths = ["tests"]
|
|
48
|
+
addopts = "-m 'not live'"
|
|
49
|
+
markers = ["live: calls the real raja.ir APIs (run with -m live)"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
line-length = 120
|
|
53
|
+
target-version = "py310"
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint]
|
|
56
|
+
select = ["E", "F", "I", "B", "UP"]
|
|
57
|
+
ignore = ["E501"] # long Field(description=...) strings read better on one line
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.sepehr071/raja-mcp",
|
|
4
|
+
"title": "Raja Train Tickets",
|
|
5
|
+
"description": "Read-only Raja (raja.ir) Iranian trains: stations, search with prices and seats, timetables, news.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/sepehr071/raja-mcp",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"websiteUrl": "https://github.com/sepehr071/raja-mcp",
|
|
11
|
+
"version": "0.1.0",
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "pypi",
|
|
15
|
+
"registryBaseUrl": "https://pypi.org",
|
|
16
|
+
"identifier": "raja-mcp",
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"runtimeHint": "uvx",
|
|
19
|
+
"transport": {
|
|
20
|
+
"type": "stdio"
|
|
21
|
+
},
|
|
22
|
+
"environmentVariables": [
|
|
23
|
+
{
|
|
24
|
+
"name": "RAJA_MCP_PROXY",
|
|
25
|
+
"description": "Optional HTTP proxy URL for the Raja requests; system proxy settings are ignored. Also accepts a comma-separated list: one is used until it gets blocked or fails to connect, then the next.",
|
|
26
|
+
"isRequired": false,
|
|
27
|
+
"isSecret": false
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|