rasmio-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.
- rasmio_mcp-0.1.0/.github/workflows/ci.yml +22 -0
- rasmio_mcp-0.1.0/.github/workflows/publish.yml +51 -0
- rasmio_mcp-0.1.0/.gitignore +6 -0
- rasmio_mcp-0.1.0/LICENSE +21 -0
- rasmio_mcp-0.1.0/PKG-INFO +108 -0
- rasmio_mcp-0.1.0/README.md +80 -0
- rasmio_mcp-0.1.0/pyproject.toml +56 -0
- rasmio_mcp-0.1.0/server.json +32 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/__init__.py +5 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/common.py +225 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/company.py +209 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/http.py +273 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/people.py +73 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/products.py +118 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/registry.py +16 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/search.py +332 -0
- rasmio_mcp-0.1.0/src/rasmio_mcp/server.py +96 -0
- rasmio_mcp-0.1.0/tests/conftest.py +78 -0
- rasmio_mcp-0.1.0/tests/fixtures/ad.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/categories.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/company_ikco.html +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/company_limit.html +2 -0
- rasmio_mcp-0.1.0/tests/fixtures/company_rasmio.html +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/design.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/filters_companies.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/licenses.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/person.html +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/product.html +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/search_all.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/search_companies.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/search_patents.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/search_people.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/search_products.json +1 -0
- rasmio_mcp-0.1.0/tests/fixtures/trademark.json +1 -0
- rasmio_mcp-0.1.0/tests/test_live_rasmio.py +68 -0
- rasmio_mcp-0.1.0/tests/test_rasmio.py +160 -0
- rasmio_mcp-0.1.0/uv.lock +1413 -0
|
@@ -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/rasmio-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
|
rasmio_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.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rasmio-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unofficial read-only MCP server for Rasmio (rasmio.com), Iran's company registry: companies, board members, official gazette ads, products, brands.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sepehr071/rasmio-mcp
|
|
6
|
+
Project-URL: Issues, https://github.com/sepehr071/rasmio-mcp/issues
|
|
7
|
+
Project-URL: Website, https://mcpfarsi.ir/
|
|
8
|
+
Author-email: Sepehr Radmard <sepehrr80@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: board-members,claude,company-registry,due-diligence,iran,kyb,mcp,model-context-protocol,official-gazette,persian,rasmio,roozname-rasmi,trademarks
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: beautifulsoup4>=4.12
|
|
23
|
+
Requires-Dist: curl-cffi>=0.16.3
|
|
24
|
+
Requires-Dist: httpx-curl-cffi>=0.1.5
|
|
25
|
+
Requires-Dist: httpx>=0.27
|
|
26
|
+
Requires-Dist: mcp<3,>=2.2
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
<!-- mcp-name: io.github.sepehr071/rasmio-mcp -->
|
|
30
|
+
|
|
31
|
+
<div align="center">
|
|
32
|
+
|
|
33
|
+
# rasmio-mcp: Rasmio (رسمیو) Iranian company registry MCP server for AI agents
|
|
34
|
+
|
|
35
|
+
**rasmio-mcp is an unofficial, read-only MCP server that gives AI agents Rasmio, the registry of Iranian companies.**<br>
|
|
36
|
+
Its 8 tools search companies with filters, open a company's registry profile (board, CEO, shareholders, licenses,<br>
|
|
37
|
+
capital history, official gazette ads), read gazette ads, show the companies a person manages, and look up products,<br>
|
|
38
|
+
trademarks, patents and industrial designs.<br>
|
|
39
|
+
No API key or Rasmio account is needed. It works in Claude, Cursor, Copilot and any other MCP client.
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/rasmio-mcp/)
|
|
42
|
+
[](https://pypi.org/project/rasmio-mcp/)
|
|
43
|
+
[](https://github.com/sepehr071/rasmio-mcp/actions/workflows/ci.yml)
|
|
44
|
+
[](https://github.com/sepehr071/rasmio-mcp/blob/main/LICENSE)
|
|
45
|
+
|
|
46
|
+
[For AI agents](#for-ai-agents) · [Quick start](#quick-start) · [Tools](#tools) · [Limits](#limits) · [فارسی](#فارسی)
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## For AI agents
|
|
53
|
+
|
|
54
|
+
- **What:** unofficial MCP server for rasmio.com, a registry of Iranian companies built from the official gazette
|
|
55
|
+
(روزنامه رسمی), the company registration office and other public sources.
|
|
56
|
+
- **Install:** `uvx rasmio-mcp` or `claude mcp add rasmio -- uvx rasmio-mcp`. Transport: stdio. Needs
|
|
57
|
+
[uv](https://docs.astral.sh/uv/getting-started/installation/) (Python 3.10+).
|
|
58
|
+
- **Auth:** none. Optional `RASMIO_MCP_PROXY` (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
|
|
59
|
+
- **Access:** read-only. It cannot log in, subscribe or edit anything.
|
|
60
|
+
- **Tools:** 8, all prefixed `rs_`. Typical sequences: `rs_search_companies` -> `rs_company` -> `rs_person` / `rs_ad`;
|
|
61
|
+
`rs_search(kind="products")` -> `rs_product` -> `rs_search_companies(product_category=...)`.
|
|
62
|
+
- **Use when:** the user asks who runs or owns an Iranian company, its national id, registration number, capital,
|
|
63
|
+
address, licenses or recent gazette notices; which companies a person is on the board of; who supplies a product;
|
|
64
|
+
who owns a trademark.
|
|
65
|
+
- **Output:** compact JSON. Money is Rial. Dates are Persian (1404/06/26). Text is Persian as the site has it.
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
claude mcp add rasmio -- uvx rasmio-mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Other clients: run `uvx rasmio-mcp` as a stdio server.
|
|
74
|
+
|
|
75
|
+
## Tools
|
|
76
|
+
|
|
77
|
+
| Tool | What it returns |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `rs_search_companies` | Companies by name or activity, filtered by province, city, status, legal form, size, capital, founding date, license, product category, brand/subsidiary/contract; sort by relevance, views, age or capital |
|
|
80
|
+
| `rs_company` | One company: founding date, status, legal form, registration number, economic code, national id, capital, activity, addresses, signature rule, board and CEO, other officers, auditors, shareholders and stock portfolio (listed companies), licenses, brands, patents and designs, capital changes, government contracts, Codal statements, 5 latest gazette ads |
|
|
81
|
+
| `rs_ad` | Full text of one official gazette ad |
|
|
82
|
+
| `rs_search` | People, products, brands, patents and industrial designs, or everything at once |
|
|
83
|
+
| `rs_person` | The companies a person manages, sits on the board of or audits, with dates and the gazette ad behind each role |
|
|
84
|
+
| `rs_product` | A product's specs (HS and ISIC codes, brand, maker, country), category and comparable suppliers |
|
|
85
|
+
| `rs_ip` | A trademark, patent or industrial design: numbers, date, owner, description |
|
|
86
|
+
| `rs_options` | Ids for the filters: legal forms, licenses, product categories, brand classes, provinces and cities |
|
|
87
|
+
|
|
88
|
+
## Limits
|
|
89
|
+
|
|
90
|
+
- Rasmio lets visitors without an account open only about **5 company profiles per IP address every 4 days**.
|
|
91
|
+
`rs_company` says so plainly when the limit is reached; search and the other tools keep working.
|
|
92
|
+
- Sections Rasmio keeps for subscribers are not available: parent and subsidiary companies, the full ad archive
|
|
93
|
+
(only the 5 latest ads are public), risk reports, the relationship graph.
|
|
94
|
+
- Privacy: people's national codes in gazette texts are shortened to their first 6 digits, as the site shows them.
|
|
95
|
+
Person contact details are never returned.
|
|
96
|
+
- Not affiliated with Rasmio. Data is as public on rasmio.com; check official sources for legal decisions.
|
|
97
|
+
|
|
98
|
+
## فارسی
|
|
99
|
+
|
|
100
|
+
**rasmio-mcp** یک سرور MCP غیررسمی و فقطخواندنی برای سایت رسمیو است: جستجوی شرکتها با فیلتر (استان، وضعیت، نوع
|
|
101
|
+
شرکت، سرمایه، تاریخ ثبت، مجوز)، پروندهی شرکت (هیئت مدیره و مدیرعامل، سهامداران، مجوزها، تغییرات سرمایه، آخرین
|
|
102
|
+
آگهیهای روزنامه رسمی)، متن کامل آگهیها، سمتهای هر شخص در شرکتها، محصولات و برندها. بدون حساب کاربری کار میکند؛
|
|
103
|
+
رسمیو برای کاربر مهمان حدود ۵ پروندهی شرکت در هر ۴ روز به ازای هر IP نشان میدهد.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT. Made by Sepehr Radmard ([github.com/sepehr071](https://github.com/sepehr071) ·
|
|
108
|
+
[linkedin.com/in/sepehr-radmard](https://www.linkedin.com/in/sepehr-radmard)).
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.sepehr071/rasmio-mcp -->
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
# rasmio-mcp: Rasmio (رسمیو) Iranian company registry MCP server for AI agents
|
|
6
|
+
|
|
7
|
+
**rasmio-mcp is an unofficial, read-only MCP server that gives AI agents Rasmio, the registry of Iranian companies.**<br>
|
|
8
|
+
Its 8 tools search companies with filters, open a company's registry profile (board, CEO, shareholders, licenses,<br>
|
|
9
|
+
capital history, official gazette ads), read gazette ads, show the companies a person manages, and look up products,<br>
|
|
10
|
+
trademarks, patents and industrial designs.<br>
|
|
11
|
+
No API key or Rasmio account is needed. It works in Claude, Cursor, Copilot and any other MCP client.
|
|
12
|
+
|
|
13
|
+
[](https://pypi.org/project/rasmio-mcp/)
|
|
14
|
+
[](https://pypi.org/project/rasmio-mcp/)
|
|
15
|
+
[](https://github.com/sepehr071/rasmio-mcp/actions/workflows/ci.yml)
|
|
16
|
+
[](https://github.com/sepehr071/rasmio-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 for rasmio.com, a registry of Iranian companies built from the official gazette
|
|
27
|
+
(روزنامه رسمی), the company registration office and other public sources.
|
|
28
|
+
- **Install:** `uvx rasmio-mcp` or `claude mcp add rasmio -- uvx rasmio-mcp`. Transport: stdio. Needs
|
|
29
|
+
[uv](https://docs.astral.sh/uv/getting-started/installation/) (Python 3.10+).
|
|
30
|
+
- **Auth:** none. Optional `RASMIO_MCP_PROXY` (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
|
|
31
|
+
- **Access:** read-only. It cannot log in, subscribe or edit anything.
|
|
32
|
+
- **Tools:** 8, all prefixed `rs_`. Typical sequences: `rs_search_companies` -> `rs_company` -> `rs_person` / `rs_ad`;
|
|
33
|
+
`rs_search(kind="products")` -> `rs_product` -> `rs_search_companies(product_category=...)`.
|
|
34
|
+
- **Use when:** the user asks who runs or owns an Iranian company, its national id, registration number, capital,
|
|
35
|
+
address, licenses or recent gazette notices; which companies a person is on the board of; who supplies a product;
|
|
36
|
+
who owns a trademark.
|
|
37
|
+
- **Output:** compact JSON. Money is Rial. Dates are Persian (1404/06/26). Text is Persian as the site has it.
|
|
38
|
+
|
|
39
|
+
## Quick start
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
claude mcp add rasmio -- uvx rasmio-mcp
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Other clients: run `uvx rasmio-mcp` as a stdio server.
|
|
46
|
+
|
|
47
|
+
## Tools
|
|
48
|
+
|
|
49
|
+
| Tool | What it returns |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `rs_search_companies` | Companies by name or activity, filtered by province, city, status, legal form, size, capital, founding date, license, product category, brand/subsidiary/contract; sort by relevance, views, age or capital |
|
|
52
|
+
| `rs_company` | One company: founding date, status, legal form, registration number, economic code, national id, capital, activity, addresses, signature rule, board and CEO, other officers, auditors, shareholders and stock portfolio (listed companies), licenses, brands, patents and designs, capital changes, government contracts, Codal statements, 5 latest gazette ads |
|
|
53
|
+
| `rs_ad` | Full text of one official gazette ad |
|
|
54
|
+
| `rs_search` | People, products, brands, patents and industrial designs, or everything at once |
|
|
55
|
+
| `rs_person` | The companies a person manages, sits on the board of or audits, with dates and the gazette ad behind each role |
|
|
56
|
+
| `rs_product` | A product's specs (HS and ISIC codes, brand, maker, country), category and comparable suppliers |
|
|
57
|
+
| `rs_ip` | A trademark, patent or industrial design: numbers, date, owner, description |
|
|
58
|
+
| `rs_options` | Ids for the filters: legal forms, licenses, product categories, brand classes, provinces and cities |
|
|
59
|
+
|
|
60
|
+
## Limits
|
|
61
|
+
|
|
62
|
+
- Rasmio lets visitors without an account open only about **5 company profiles per IP address every 4 days**.
|
|
63
|
+
`rs_company` says so plainly when the limit is reached; search and the other tools keep working.
|
|
64
|
+
- Sections Rasmio keeps for subscribers are not available: parent and subsidiary companies, the full ad archive
|
|
65
|
+
(only the 5 latest ads are public), risk reports, the relationship graph.
|
|
66
|
+
- Privacy: people's national codes in gazette texts are shortened to their first 6 digits, as the site shows them.
|
|
67
|
+
Person contact details are never returned.
|
|
68
|
+
- Not affiliated with Rasmio. Data is as public on rasmio.com; check official sources for legal decisions.
|
|
69
|
+
|
|
70
|
+
## فارسی
|
|
71
|
+
|
|
72
|
+
**rasmio-mcp** یک سرور MCP غیررسمی و فقطخواندنی برای سایت رسمیو است: جستجوی شرکتها با فیلتر (استان، وضعیت، نوع
|
|
73
|
+
شرکت، سرمایه، تاریخ ثبت، مجوز)، پروندهی شرکت (هیئت مدیره و مدیرعامل، سهامداران، مجوزها، تغییرات سرمایه، آخرین
|
|
74
|
+
آگهیهای روزنامه رسمی)، متن کامل آگهیها، سمتهای هر شخص در شرکتها، محصولات و برندها. بدون حساب کاربری کار میکند؛
|
|
75
|
+
رسمیو برای کاربر مهمان حدود ۵ پروندهی شرکت در هر ۴ روز به ازای هر IP نشان میدهد.
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT. Made by Sepehr Radmard ([github.com/sepehr071](https://github.com/sepehr071) ·
|
|
80
|
+
[linkedin.com/in/sepehr-radmard](https://www.linkedin.com/in/sepehr-radmard)).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "rasmio-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Unofficial read-only MCP server for Rasmio (rasmio.com), Iran's company registry: companies, board members, official gazette ads, products, brands."
|
|
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", "rasmio", "company-registry", "official-gazette", "roozname-rasmi", "board-members", "kyb", "due-diligence", "trademarks", "iran", "claude", "persian"]
|
|
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
|
+
"beautifulsoup4>=4.12",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/sepehr071/rasmio-mcp"
|
|
32
|
+
Issues = "https://github.com/sepehr071/rasmio-mcp/issues"
|
|
33
|
+
Website = "https://mcpfarsi.ir/"
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
rasmio-mcp = "rasmio_mcp.server:main"
|
|
37
|
+
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
dev = ["pytest>=8", "ruff>=0.6"]
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["hatchling"]
|
|
43
|
+
build-backend = "hatchling.build"
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
testpaths = ["tests"]
|
|
47
|
+
addopts = "-m 'not live'"
|
|
48
|
+
markers = ["live: calls the real Rasmio site (run with -m live)"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
line-length = 120
|
|
52
|
+
target-version = "py310"
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint]
|
|
55
|
+
select = ["E", "F", "I", "B", "UP"]
|
|
56
|
+
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/rasmio-mcp",
|
|
4
|
+
"title": "Rasmio Company Registry",
|
|
5
|
+
"description": "Read-only Rasmio (rasmio.com): Iranian companies, board members, gazette ads, products, brands.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/sepehr071/rasmio-mcp",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"websiteUrl": "https://github.com/sepehr071/rasmio-mcp",
|
|
11
|
+
"version": "0.1.0",
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "pypi",
|
|
15
|
+
"registryBaseUrl": "https://pypi.org",
|
|
16
|
+
"identifier": "rasmio-mcp",
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"runtimeHint": "uvx",
|
|
19
|
+
"transport": {
|
|
20
|
+
"type": "stdio"
|
|
21
|
+
},
|
|
22
|
+
"environmentVariables": [
|
|
23
|
+
{
|
|
24
|
+
"name": "RASMIO_MCP_PROXY",
|
|
25
|
+
"description": "Optional HTTP proxy URL for the Rasmio 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
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"""Helpers shared by the tool modules: digits, dates, privacy masking and reading the site's HTML pages."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
from typing import Any
|
|
8
|
+
from urllib.parse import unquote
|
|
9
|
+
|
|
10
|
+
from bs4 import BeautifulSoup, Tag
|
|
11
|
+
|
|
12
|
+
from .http import SITE, ApiError
|
|
13
|
+
|
|
14
|
+
_DIGITS = str.maketrans("۰۱۲۳۴۵۶۷۸۹٠١٢٣٤٥٦٧٨٩٫٬", "01234567890123456789.,")
|
|
15
|
+
# A person's 10-digit national code after "شماره ملی"/"کد ملی"; the site itself shows only the first 6 digits.
|
|
16
|
+
_NATIONAL_CODE = re.compile(r"((?:شماره|کد)\s*ملی\s*:?\s*)(\d{6})\d{4}(?!\d)")
|
|
17
|
+
_PUSH = re.compile(r'self\.__next_f\.push\(\[1,("(?:[^"\\]|\\.)*")\]\)')
|
|
18
|
+
# Shown instead of a company profile once the anonymous per-IP quota is used up.
|
|
19
|
+
_LIMIT_MARKERS = ("سقف مجاز", "امکان مشاهده این اطلاعات برای شما وجود ندارد")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def ascii_digits(text: str) -> str:
|
|
23
|
+
"""Persian/Arabic digits and separators to ASCII ('۱۴۰۴/۰۶/۲۶' -> '1404/06/26', '۶۰٬۰۰۰' -> '60,000')."""
|
|
24
|
+
return text.translate(_DIGITS)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def clean(text: str | None) -> str:
|
|
28
|
+
"""ASCII digits, single spaces, person national codes masked like the site does (0923198891 -> 092319xxxx)."""
|
|
29
|
+
if not text:
|
|
30
|
+
return ""
|
|
31
|
+
text = re.sub(r"\s+", " ", ascii_digits(text)).strip()
|
|
32
|
+
return _NATIONAL_CODE.sub(r"\g<1>\g<2>xxxx", text)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def number(text: str | None) -> int | None:
|
|
36
|
+
"""'۶۰٬۰۰۰٬۰۰۰ ریال' -> 60000000; None when there are no digits."""
|
|
37
|
+
digits = re.sub(r"[^\d]", "", ascii_digits(text or ""))
|
|
38
|
+
return int(digits) if digits else None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def g2j(gy: int, gm: int, gd: int) -> tuple[int, int, int]:
|
|
42
|
+
"""Gregorian date to Persian (Jalali) date."""
|
|
43
|
+
gdm = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334)
|
|
44
|
+
gy2 = gy + 1 if gm > 2 else gy
|
|
45
|
+
days = 355666 + 365 * gy + (gy2 + 3) // 4 - (gy2 + 99) // 100 + (gy2 + 399) // 400 + gd + gdm[gm - 1]
|
|
46
|
+
jy = -1595 + 33 * (days // 12053)
|
|
47
|
+
days %= 12053
|
|
48
|
+
jy += 4 * (days // 1461)
|
|
49
|
+
days %= 1461
|
|
50
|
+
if days > 365:
|
|
51
|
+
jy += (days - 1) // 365
|
|
52
|
+
days = (days - 1) % 365
|
|
53
|
+
if days < 186:
|
|
54
|
+
return jy, 1 + days // 31, 1 + days % 31
|
|
55
|
+
return jy, 7 + (days - 186) // 30, 1 + (days - 186) % 30
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def j2g(jy: int, jm: int, jd: int) -> tuple[int, int, int]:
|
|
59
|
+
"""Persian (Jalali) date to Gregorian."""
|
|
60
|
+
jy += 1595
|
|
61
|
+
days = -355668 + 365 * jy + (jy // 33) * 8 + ((jy % 33) + 3) // 4 + jd
|
|
62
|
+
days += (jm - 1) * 31 if jm < 7 else (jm - 7) * 30 + 186
|
|
63
|
+
gy = 400 * (days // 146097)
|
|
64
|
+
days %= 146097
|
|
65
|
+
if days > 36524:
|
|
66
|
+
days -= 1
|
|
67
|
+
gy += 100 * (days // 36524)
|
|
68
|
+
days %= 36524
|
|
69
|
+
if days >= 365:
|
|
70
|
+
days += 1
|
|
71
|
+
gy += 4 * (days // 1461)
|
|
72
|
+
days %= 1461
|
|
73
|
+
if days > 365:
|
|
74
|
+
gy += (days - 1) // 365
|
|
75
|
+
days = (days - 1) % 365
|
|
76
|
+
gd = days + 1
|
|
77
|
+
leap = (gy % 4 == 0 and gy % 100 != 0) or gy % 400 == 0
|
|
78
|
+
months = (0, 31, 29 if leap else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
|
|
79
|
+
gm = 0
|
|
80
|
+
while gm < 13 and gd > months[gm]:
|
|
81
|
+
gd -= months[gm]
|
|
82
|
+
gm += 1
|
|
83
|
+
return gy, gm, gd
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def jalali(iso: str | None) -> str | None:
|
|
87
|
+
"""'2025-10-06T00:00:00' -> '1404/07/14'; None stays None."""
|
|
88
|
+
m = re.match(r"(\d{4})-(\d{2})-(\d{2})", iso or "")
|
|
89
|
+
if not m:
|
|
90
|
+
return None
|
|
91
|
+
y, mo, d = g2j(*(int(x) for x in m.groups()))
|
|
92
|
+
return f"{y}/{mo:02d}/{d:02d}"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def to_iso(day: str | None) -> str | None:
|
|
96
|
+
"""A user date, Persian ('1402/01/15', '۱۴۰۲-۰۱-۱۵') or Gregorian ('2023-04-04'), to the site's ISO UTC midnight."""
|
|
97
|
+
if not day:
|
|
98
|
+
return None
|
|
99
|
+
m = re.fullmatch(r"(\d{4})[/-](\d{1,2})[/-](\d{1,2})", ascii_digits(day.strip()))
|
|
100
|
+
if not m:
|
|
101
|
+
raise ApiError(f"Date {day!r} is not YYYY/MM/DD (Persian like 1402/01/15, or Gregorian like 2023-04-04).")
|
|
102
|
+
y, mo, d = (int(x) for x in m.groups())
|
|
103
|
+
if y < 1700:
|
|
104
|
+
y, mo, d = j2g(y, mo, d)
|
|
105
|
+
return f"{y:04d}-{mo:02d}-{d:02d}T00:00:00.000Z"
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def soup(html: str) -> BeautifulSoup:
|
|
109
|
+
"""Parse a page and stop with a clear message when the site shows its anonymous-quota wall instead."""
|
|
110
|
+
page = BeautifulSoup(html, "html.parser")
|
|
111
|
+
main = page.find(id="main-content")
|
|
112
|
+
text = main.get_text(" ", strip=True) if main else ""
|
|
113
|
+
if any(m in text for m in _LIMIT_MARKERS):
|
|
114
|
+
quota = re.search(r"سقف مجاز[^.]*\.", text)
|
|
115
|
+
raise ApiError(
|
|
116
|
+
"Rasmio shows this page to anonymous visitors only a few times per IP address and the limit is used up"
|
|
117
|
+
f"{' (' + clean(quota.group(0)) + ')' if quota else ''}. Search results still work; try the profile again "
|
|
118
|
+
"after the waiting time, or from another network."
|
|
119
|
+
)
|
|
120
|
+
return page
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def flight(html: str) -> str:
|
|
124
|
+
"""The React Server Components payload a Next.js page streams in `self.__next_f.push` calls."""
|
|
125
|
+
return "".join(json.loads(m.group(1)) for m in _PUSH.finditer(html))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def query_data(html: str, key: str) -> Any:
|
|
129
|
+
"""The data of the dehydrated React Query whose key starts with `key` (e.g. 'person'), or None."""
|
|
130
|
+
found: list[Any] = []
|
|
131
|
+
|
|
132
|
+
def walk(x: Any) -> None:
|
|
133
|
+
if isinstance(x, dict):
|
|
134
|
+
queries = x.get("queries")
|
|
135
|
+
for q in queries if isinstance(queries, list) else []:
|
|
136
|
+
if isinstance(q, dict) and (q.get("queryKey") or [None])[0] == key:
|
|
137
|
+
found.append((q.get("state") or {}).get("data"))
|
|
138
|
+
for v in x.values():
|
|
139
|
+
walk(v)
|
|
140
|
+
elif isinstance(x, list):
|
|
141
|
+
for v in x:
|
|
142
|
+
walk(v)
|
|
143
|
+
|
|
144
|
+
for line in flight(html).split("\n"):
|
|
145
|
+
if '"queryKey"' in line and ":" in line:
|
|
146
|
+
try:
|
|
147
|
+
walk(json.loads(line.split(":", 1)[1]))
|
|
148
|
+
except ValueError:
|
|
149
|
+
continue
|
|
150
|
+
return found[0] if found else None
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def link_ids(el: Tag) -> dict[str, str]:
|
|
154
|
+
"""Ids from the links inside an element: person (hex), company (national id), ad, codal letter, brand."""
|
|
155
|
+
out: dict[str, str] = {}
|
|
156
|
+
for a in [el, *el.find_all("a", href=True)] if el.name == "a" else el.find_all("a", href=True):
|
|
157
|
+
href = unquote(a["href"]).replace(SITE, "")
|
|
158
|
+
for name, pattern in (
|
|
159
|
+
("person_id", r"^/person/([0-9A-Fa-f]+)/"),
|
|
160
|
+
("company_id", r"^/company/(\d+)/?(?:[^/]*/?)?$"),
|
|
161
|
+
("ad_id", r"^/News/(\d+)"),
|
|
162
|
+
("codal_id", r"^/codal/(\d+)"),
|
|
163
|
+
("brand_id", r"^/brand/(\d+)"),
|
|
164
|
+
("certificate_id", r"certificates=(\d+)"),
|
|
165
|
+
):
|
|
166
|
+
if name not in out and (m := re.search(pattern, href)):
|
|
167
|
+
out[name] = m.group(1)
|
|
168
|
+
return out
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# Column headers of the profile tables -> output keys; an unknown header is kept as written.
|
|
172
|
+
HEADS = {
|
|
173
|
+
"نام": "name",
|
|
174
|
+
"سمت": "position",
|
|
175
|
+
"تاریخ شروع": "start",
|
|
176
|
+
"تاریخ پایان": "end",
|
|
177
|
+
"درجه": "kind",
|
|
178
|
+
"سال مالی": "fiscal_year",
|
|
179
|
+
"نام سهامدار": "shareholder",
|
|
180
|
+
"تعداد سهم": "shares",
|
|
181
|
+
"درصد سهم": "percent",
|
|
182
|
+
"ارزش سهام (ریال)": "value_rial",
|
|
183
|
+
"نام شرکت و سهم": "holding",
|
|
184
|
+
"مجوز": "license",
|
|
185
|
+
"مرجع صادر کننده": "issuer",
|
|
186
|
+
"تاریخ شروع مجوز": "start",
|
|
187
|
+
"مبلغ سرمایه (ریال)": "capital_rial",
|
|
188
|
+
"نوع": "type",
|
|
189
|
+
"محل تغییر سرمایه": "source",
|
|
190
|
+
"تاریخ ثبت": "registered",
|
|
191
|
+
"عنوان قرارداد": "title",
|
|
192
|
+
"کارفرما": "employer",
|
|
193
|
+
"مبلغ (ریال)": "amount_rial",
|
|
194
|
+
"سال مالی (منتهی به)": "fiscal_year_end",
|
|
195
|
+
"وضعیت حسابرسی": "audit",
|
|
196
|
+
"دوره": "period",
|
|
197
|
+
"تاریخ انتشار": "published",
|
|
198
|
+
"عنوان اختراع یا طرح": "title",
|
|
199
|
+
"شرکت": "company",
|
|
200
|
+
"محصول منطبق": "matching_product",
|
|
201
|
+
"سن شرکت": "age",
|
|
202
|
+
"سرمایه ثبتی": "capital",
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def table(el: Tag | None, max_rows: int) -> dict[str, Any] | None:
|
|
207
|
+
"""Rows of the first <table> in a section as {column: cell text} plus ids from the row's links."""
|
|
208
|
+
t = el if el is not None and el.name == "table" else el.find("table") if el else None
|
|
209
|
+
if t is None:
|
|
210
|
+
return None
|
|
211
|
+
heads = [clean(th.get_text(" ", strip=True)) for th in t.find_all("th")]
|
|
212
|
+
heads = [HEADS.get(h, h) for h in heads]
|
|
213
|
+
rows = []
|
|
214
|
+
for tr in t.find_all("tr"):
|
|
215
|
+
cells = tr.find_all("td")
|
|
216
|
+
if not cells:
|
|
217
|
+
continue
|
|
218
|
+
row: dict[str, Any] = {}
|
|
219
|
+
for head, td in zip(heads, cells, strict=False):
|
|
220
|
+
text = clean(td.get_text(" ", strip=True))
|
|
221
|
+
if head and text and text != "-":
|
|
222
|
+
row[head] = text
|
|
223
|
+
row.update(link_ids(tr))
|
|
224
|
+
rows.append(row)
|
|
225
|
+
return {"total_shown": len(rows), "rows": rows[:max_rows]}
|