amar-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.
- amar_mcp-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +42 -0
- amar_mcp-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- amar_mcp-0.1.0/.github/dependabot.yml +10 -0
- amar_mcp-0.1.0/.github/workflows/ci.yml +22 -0
- amar_mcp-0.1.0/.github/workflows/publish.yml +51 -0
- amar_mcp-0.1.0/.gitignore +6 -0
- amar_mcp-0.1.0/LICENSE +21 -0
- amar_mcp-0.1.0/PKG-INFO +139 -0
- amar_mcp-0.1.0/README.md +108 -0
- amar_mcp-0.1.0/pyproject.toml +59 -0
- amar_mcp-0.1.0/server.json +32 -0
- amar_mcp-0.1.0/src/amar_mcp/__init__.py +5 -0
- amar_mcp-0.1.0/src/amar_mcp/certs/certum-dv-tls-g2-r39.pem +38 -0
- amar_mcp-0.1.0/src/amar_mcp/data.py +550 -0
- amar_mcp-0.1.0/src/amar_mcp/http.py +240 -0
- amar_mcp-0.1.0/src/amar_mcp/macro.py +324 -0
- amar_mcp-0.1.0/src/amar_mcp/registry.py +16 -0
- amar_mcp-0.1.0/src/amar_mcp/server.py +95 -0
- amar_mcp-0.1.0/src/amar_mcp/site.py +366 -0
- amar_mcp-0.1.0/tests/conftest.py +79 -0
- amar_mcp-0.1.0/tests/fixtures/calendar.html +97 -0
- amar_mcp-0.1.0/tests/fixtures/census.xlsx +0 -0
- amar_mcp-0.1.0/tests/fixtures/cpi_national.xlsx +0 -0
- amar_mcp-0.1.0/tests/fixtures/cpi_report.pdf +0 -0
- amar_mcp-0.1.0/tests/fixtures/gdp.xlsx +0 -0
- amar_mcp-0.1.0/tests/fixtures/indicators.xlsx +0 -0
- amar_mcp-0.1.0/tests/fixtures/labour.xlsx +0 -0
- amar_mcp-0.1.0/tests/fixtures/list.html +34 -0
- amar_mcp-0.1.0/tests/fixtures/news.xml +34 -0
- amar_mcp-0.1.0/tests/fixtures/news_20353.html +324 -0
- amar_mcp-0.1.0/tests/fixtures/ppi.xlsx +0 -0
- amar_mcp-0.1.0/tests/fixtures/release_58298.html +42 -0
- amar_mcp-0.1.0/tests/test_amar.py +190 -0
- amar_mcp-0.1.0/tests/test_amar_round2.py +124 -0
- amar_mcp-0.1.0/tests/test_live_amar.py +100 -0
- amar_mcp-0.1.0/uv.lock +1410 -0
|
@@ -0,0 +1,42 @@
|
|
|
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. bl_search
|
|
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 amar.org.ir shows for the same query
|
|
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
|
|
36
|
+
- VPN or proxy
|
|
37
|
+
- AMAR_MCP_PROXY set
|
|
38
|
+
- type: input
|
|
39
|
+
id: version
|
|
40
|
+
attributes:
|
|
41
|
+
label: amar-mcp version
|
|
42
|
+
placeholder: "0.1.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/amar-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
|
amar_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.
|
amar_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: amar-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unofficial read-only MCP server for the Statistical Centre of Iran (amar.org.ir): CPI inflation, unemployment, population, release tables.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sepehr071/amar-mcp
|
|
6
|
+
Project-URL: Issues, https://github.com/sepehr071/amar-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: amar,census,claude,cpi,inflation,iran,mcp,model-context-protocol,open-data,persian,population,statistical-centre-of-iran,statistics,unemployment
|
|
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
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
22
|
+
Requires-Python: >=3.10
|
|
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
|
+
Requires-Dist: openpyxl>=3.1
|
|
28
|
+
Requires-Dist: pypdf>=5
|
|
29
|
+
Requires-Dist: xlrd>=2.0
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
<!-- mcp-name: io.github.sepehr071/amar-mcp -->
|
|
33
|
+
|
|
34
|
+
# amar-mcp: Statistical Centre of Iran (مرکز آمار ایران) inflation, unemployment and census MCP server
|
|
35
|
+
|
|
36
|
+
**amar-mcp is an unofficial, read-only MCP server that gives AI agents the official numbers of the Statistical Centre of Iran (amar.org.ir).**<br>
|
|
37
|
+
Its 12 tools return the consumer price index and inflation (monthly, year-on-year, 12-month average, by CPI group, household region and province), unemployment and participation rates, GDP growth, producer prices, the monthly macro-indicators workbook (trade, housing price and rent, money, budget, household income and spending, CPI by decile), census population by province and county, news, the publishing calendar, and any Excel table of any release.<br>
|
|
38
|
+
No API key or account is needed. It works in Claude, Cursor, Copilot and any other MCP client.
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/amar-mcp/)
|
|
41
|
+
[](https://pypi.org/project/amar-mcp/)
|
|
42
|
+
[](https://github.com/sepehr071/amar-mcp/blob/main/LICENSE)
|
|
43
|
+
|
|
44
|
+
[For AI agents](#for-ai-agents) · [Quick start](#quick-start) · [Tools](#tools) · [FAQ](#faq) · [فارسی](#فارسی)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## For AI agents
|
|
49
|
+
|
|
50
|
+
- **What:** unofficial MCP server (model context protocol) for amar.org.ir, Iran's national statistics portal: official CPI and inflation, labour force survey rates, census 1395 population, the release catalog and calendar, and a reader for the portal's Excel tables.
|
|
51
|
+
- **Install:** `uvx amar-mcp` or `claude mcp add amar -- uvx amar-mcp`. Transport: stdio. Needs [uv](https://docs.astral.sh/uv/getting-started/installation/) (Python 3.10+).
|
|
52
|
+
- **Auth:** none. Optional `AMAR_MCP_PROXY` (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
|
|
53
|
+
- **Access:** read-only. It cannot log in or change anything, so no confirmation is needed before calling any tool.
|
|
54
|
+
- **Network:** amar.org.ir answers only from inside Iran (it drops foreign IPs), so run the server on an Iranian connection or set `AMAR_MCP_PROXY` to an Iranian proxy.
|
|
55
|
+
- **Tools:** 12, all prefixed `am_`. Typical sequences: `am_inflation` -> `am_inflation_groups`; `am_gdp`, `am_ppi`; `am_indicators` (topic -> table); `am_search` -> `am_release` -> `am_table`; `am_calendar` for "when is the next release".
|
|
56
|
+
- **Use when:** the user asks what Iran's official inflation, CPI, unemployment or population is, what drives inflation (food, housing...), how a province compares, when the Statistical Centre publishes something, or wants any table from amar.org.ir.
|
|
57
|
+
- **Do not use when:** the user wants central-bank data, exchange or gold prices (other servers cover those), or live market data. The monthly CPI Excel series trails the PDF report by about a week; `am_inflation` flags this in `newer_report` and reads the newer month's national figures from the PDF.
|
|
58
|
+
- **Output:** compact JSON. Periods are Jalali (`1405-06` = Shahrivar 1405). Percentages are percent. Names and titles are Persian as the Centre has them.
|
|
59
|
+
- **Machine-readable:** [`server.json`](https://github.com/sepehr071/amar-mcp/blob/main/server.json).
|
|
60
|
+
|
|
61
|
+
## Example
|
|
62
|
+
|
|
63
|
+
> **You:** What is Iran's official inflation, and what drives it?
|
|
64
|
+
>
|
|
65
|
+
> **Agent:** *calls* `am_inflation()` and `am_inflation_groups()`
|
|
66
|
+
>
|
|
67
|
+
> For Shahrivar 1405 the Statistical Centre reports 4.24% monthly, 89.8% year-on-year and 73.6% for the 12-month average. Food and tobacco rose 122% year-on-year, transport 115%, housing 38%.
|
|
68
|
+
|
|
69
|
+
<sub>Numbers from a live call on 2026-11-01.</sub>
|
|
70
|
+
|
|
71
|
+
Other prompts: "unemployment rate by quarter", "population of Yazd province and its counties", "inflation in Fars province", "when is the next CPI release", <span dir="rtl">تورم نقطه به نقطه مسکن شهری چقدر است؟</span>, <span dir="rtl">نرخ بیکاری آخرین فصل؟</span>
|
|
72
|
+
|
|
73
|
+
## Quick start
|
|
74
|
+
|
|
75
|
+
You need [uv](https://docs.astral.sh/uv/getting-started/installation/). No API key or account.
|
|
76
|
+
|
|
77
|
+
**Claude Code:** `claude mcp add amar -- uvx amar-mcp`
|
|
78
|
+
|
|
79
|
+
**Claude Desktop, Cursor, Windsurf, Gemini CLI:** add
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"amar": { "command": "uvx", "args": ["amar-mcp"] }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**VS Code:** `.vscode/mcp.json` with `{"servers": {"amar": {"type": "stdio", "command": "uvx", "args": ["amar-mcp"]}}}`.
|
|
90
|
+
|
|
91
|
+
**Codex CLI:** `codex mcp add amar -- uvx amar-mcp`. Anything else: `uvx amar-mcp`, or `pip install amar-mcp` and run `amar-mcp`.
|
|
92
|
+
|
|
93
|
+
## Tools
|
|
94
|
+
|
|
95
|
+
| Tool | What it does |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `am_inflation` | Official CPI index and inflation per month (monthly, point-to-point, 12-month average) by household region, CPI group or province |
|
|
98
|
+
| `am_inflation_groups` | Compare inflation across CPI groups (food, housing, transport...) for one month |
|
|
99
|
+
| `am_labour_force` | Unemployment, youth unemployment and participation rates by quarter, total, urban and rural |
|
|
100
|
+
| `am_population` | Population and households by province, or by county in one province, from the 1395 census |
|
|
101
|
+
| `am_search` | Search the portal's releases by Persian title words, year, frequency, type and topic |
|
|
102
|
+
| `am_release` | One release: topic, period and its Excel, PDF and Word files |
|
|
103
|
+
| `am_table` | Read any Excel table of a release as compact rows (sheet list, filter, paging) |
|
|
104
|
+
| `am_calendar` | The publishing calendar: which statistic comes out on which day of a month |
|
|
105
|
+
| `am_gdp` | GDP growth by quarter or year with agriculture, industry, oil and gas, services; levels in billion rials |
|
|
106
|
+
| `am_ppi` | Producer price index by quarter and sector (index, quarterly, year-on-year, 4-quarter average) |
|
|
107
|
+
| `am_indicators` | The monthly macro workbook: trade, housing price and rent, money, budget, household spending, Gini, CPI by decile and province, energy, stock market |
|
|
108
|
+
| `am_news` | Latest news and press releases of the Centre, or the text of one item |
|
|
109
|
+
|
|
110
|
+
All 12 tools are annotated `readOnlyHint: true`.
|
|
111
|
+
|
|
112
|
+
## How it works
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
AI agent ──MCP/stdio──▶ amar-mcp ──HTTPS──▶ amar.org.ir (release pages, Excel files)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The portal has no JSON API, so the server reads its catalog pages and downloads the Excel files that the portal
|
|
119
|
+
itself offers, then parses them. It sends browser-like requests (Chrome TLS fingerprint), makes at most 3 concurrent
|
|
120
|
+
requests, caches answers for 5 minutes and refuses files over 25 MB. The site's certificate chain is incomplete (it
|
|
121
|
+
omits an intermediate); the server ships that public intermediate certificate to verify the connection normally.
|
|
122
|
+
|
|
123
|
+
## FAQ
|
|
124
|
+
|
|
125
|
+
**Why does it fail from outside Iran?** amar.org.ir does not answer foreign IPs. Run it on an Iranian connection or set `AMAR_MCP_PROXY`.
|
|
126
|
+
|
|
127
|
+
**Why is the newest month missing in `am_inflation`?** The Centre publishes a PDF report first and updates the Excel series about a week later. The answer's `newer_report` names that release (use `am_release` for the PDF link); it also carries that month's national index and inflation, read from the PDF.
|
|
128
|
+
|
|
129
|
+
**Are these the same as central-bank figures?** No. These are the Statistical Centre's figures; the Central Bank of Iran publishes its own.
|
|
130
|
+
|
|
131
|
+
**Is it affiliated with the Centre?** No. It reads public pages and files, no login.
|
|
132
|
+
|
|
133
|
+
## فارسی
|
|
134
|
+
|
|
135
|
+
**amar-mcp** یک سرور MCP غیررسمی و فقطخواندنی برای درگاه ملی آمار (مرکز آمار ایران، amar.org.ir) است. با آن میتوانید تورم و شاخص قیمت مصرفکننده (ماهانه، نقطهبهنقطه، متوسط ۱۲ ماه؛ به تفکیک گروه کالا، مناطق شهری و روستایی و استان)، نرخ بیکاری و مشارکت، جمعیت استانها و شهرستانها در سرشماری ۱۳۹۵، تقویم انتشار و هر جدول اکسل منتشرشده را بپرسید.
|
|
136
|
+
|
|
137
|
+
نصب: `claude mcp add amar -- uvx amar-mcp` (نیاز به [uv](https://docs.astral.sh/uv/getting-started/installation/)). درگاه مرکز آمار فقط از داخل ایران پاسخ میدهد؛ سرور را روی اینترنت ایران اجرا کنید یا `AMAR_MCP_PROXY` را روی یک پروکسی ایرانی بگذارید.
|
|
138
|
+
|
|
139
|
+
<sub>Author: Sepehr Radmard (سپهر رادمرد), [github.com/sepehr071](https://github.com/sepehr071), [linkedin.com/in/sepehr-radmard](https://linkedin.com/in/sepehr-radmard). MIT license.</sub>
|
amar_mcp-0.1.0/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.sepehr071/amar-mcp -->
|
|
2
|
+
|
|
3
|
+
# amar-mcp: Statistical Centre of Iran (مرکز آمار ایران) inflation, unemployment and census MCP server
|
|
4
|
+
|
|
5
|
+
**amar-mcp is an unofficial, read-only MCP server that gives AI agents the official numbers of the Statistical Centre of Iran (amar.org.ir).**<br>
|
|
6
|
+
Its 12 tools return the consumer price index and inflation (monthly, year-on-year, 12-month average, by CPI group, household region and province), unemployment and participation rates, GDP growth, producer prices, the monthly macro-indicators workbook (trade, housing price and rent, money, budget, household income and spending, CPI by decile), census population by province and county, news, the publishing calendar, and any Excel table of any release.<br>
|
|
7
|
+
No API key or account is needed. It works in Claude, Cursor, Copilot and any other MCP client.
|
|
8
|
+
|
|
9
|
+
[](https://pypi.org/project/amar-mcp/)
|
|
10
|
+
[](https://pypi.org/project/amar-mcp/)
|
|
11
|
+
[](https://github.com/sepehr071/amar-mcp/blob/main/LICENSE)
|
|
12
|
+
|
|
13
|
+
[For AI agents](#for-ai-agents) · [Quick start](#quick-start) · [Tools](#tools) · [FAQ](#faq) · [فارسی](#فارسی)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## For AI agents
|
|
18
|
+
|
|
19
|
+
- **What:** unofficial MCP server (model context protocol) for amar.org.ir, Iran's national statistics portal: official CPI and inflation, labour force survey rates, census 1395 population, the release catalog and calendar, and a reader for the portal's Excel tables.
|
|
20
|
+
- **Install:** `uvx amar-mcp` or `claude mcp add amar -- uvx amar-mcp`. Transport: stdio. Needs [uv](https://docs.astral.sh/uv/getting-started/installation/) (Python 3.10+).
|
|
21
|
+
- **Auth:** none. Optional `AMAR_MCP_PROXY` (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
|
|
22
|
+
- **Access:** read-only. It cannot log in or change anything, so no confirmation is needed before calling any tool.
|
|
23
|
+
- **Network:** amar.org.ir answers only from inside Iran (it drops foreign IPs), so run the server on an Iranian connection or set `AMAR_MCP_PROXY` to an Iranian proxy.
|
|
24
|
+
- **Tools:** 12, all prefixed `am_`. Typical sequences: `am_inflation` -> `am_inflation_groups`; `am_gdp`, `am_ppi`; `am_indicators` (topic -> table); `am_search` -> `am_release` -> `am_table`; `am_calendar` for "when is the next release".
|
|
25
|
+
- **Use when:** the user asks what Iran's official inflation, CPI, unemployment or population is, what drives inflation (food, housing...), how a province compares, when the Statistical Centre publishes something, or wants any table from amar.org.ir.
|
|
26
|
+
- **Do not use when:** the user wants central-bank data, exchange or gold prices (other servers cover those), or live market data. The monthly CPI Excel series trails the PDF report by about a week; `am_inflation` flags this in `newer_report` and reads the newer month's national figures from the PDF.
|
|
27
|
+
- **Output:** compact JSON. Periods are Jalali (`1405-06` = Shahrivar 1405). Percentages are percent. Names and titles are Persian as the Centre has them.
|
|
28
|
+
- **Machine-readable:** [`server.json`](https://github.com/sepehr071/amar-mcp/blob/main/server.json).
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
> **You:** What is Iran's official inflation, and what drives it?
|
|
33
|
+
>
|
|
34
|
+
> **Agent:** *calls* `am_inflation()` and `am_inflation_groups()`
|
|
35
|
+
>
|
|
36
|
+
> For Shahrivar 1405 the Statistical Centre reports 4.24% monthly, 89.8% year-on-year and 73.6% for the 12-month average. Food and tobacco rose 122% year-on-year, transport 115%, housing 38%.
|
|
37
|
+
|
|
38
|
+
<sub>Numbers from a live call on 2026-11-01.</sub>
|
|
39
|
+
|
|
40
|
+
Other prompts: "unemployment rate by quarter", "population of Yazd province and its counties", "inflation in Fars province", "when is the next CPI release", <span dir="rtl">تورم نقطه به نقطه مسکن شهری چقدر است؟</span>, <span dir="rtl">نرخ بیکاری آخرین فصل؟</span>
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
You need [uv](https://docs.astral.sh/uv/getting-started/installation/). No API key or account.
|
|
45
|
+
|
|
46
|
+
**Claude Code:** `claude mcp add amar -- uvx amar-mcp`
|
|
47
|
+
|
|
48
|
+
**Claude Desktop, Cursor, Windsurf, Gemini CLI:** add
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"amar": { "command": "uvx", "args": ["amar-mcp"] }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**VS Code:** `.vscode/mcp.json` with `{"servers": {"amar": {"type": "stdio", "command": "uvx", "args": ["amar-mcp"]}}}`.
|
|
59
|
+
|
|
60
|
+
**Codex CLI:** `codex mcp add amar -- uvx amar-mcp`. Anything else: `uvx amar-mcp`, or `pip install amar-mcp` and run `amar-mcp`.
|
|
61
|
+
|
|
62
|
+
## Tools
|
|
63
|
+
|
|
64
|
+
| Tool | What it does |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `am_inflation` | Official CPI index and inflation per month (monthly, point-to-point, 12-month average) by household region, CPI group or province |
|
|
67
|
+
| `am_inflation_groups` | Compare inflation across CPI groups (food, housing, transport...) for one month |
|
|
68
|
+
| `am_labour_force` | Unemployment, youth unemployment and participation rates by quarter, total, urban and rural |
|
|
69
|
+
| `am_population` | Population and households by province, or by county in one province, from the 1395 census |
|
|
70
|
+
| `am_search` | Search the portal's releases by Persian title words, year, frequency, type and topic |
|
|
71
|
+
| `am_release` | One release: topic, period and its Excel, PDF and Word files |
|
|
72
|
+
| `am_table` | Read any Excel table of a release as compact rows (sheet list, filter, paging) |
|
|
73
|
+
| `am_calendar` | The publishing calendar: which statistic comes out on which day of a month |
|
|
74
|
+
| `am_gdp` | GDP growth by quarter or year with agriculture, industry, oil and gas, services; levels in billion rials |
|
|
75
|
+
| `am_ppi` | Producer price index by quarter and sector (index, quarterly, year-on-year, 4-quarter average) |
|
|
76
|
+
| `am_indicators` | The monthly macro workbook: trade, housing price and rent, money, budget, household spending, Gini, CPI by decile and province, energy, stock market |
|
|
77
|
+
| `am_news` | Latest news and press releases of the Centre, or the text of one item |
|
|
78
|
+
|
|
79
|
+
All 12 tools are annotated `readOnlyHint: true`.
|
|
80
|
+
|
|
81
|
+
## How it works
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
AI agent ──MCP/stdio──▶ amar-mcp ──HTTPS──▶ amar.org.ir (release pages, Excel files)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The portal has no JSON API, so the server reads its catalog pages and downloads the Excel files that the portal
|
|
88
|
+
itself offers, then parses them. It sends browser-like requests (Chrome TLS fingerprint), makes at most 3 concurrent
|
|
89
|
+
requests, caches answers for 5 minutes and refuses files over 25 MB. The site's certificate chain is incomplete (it
|
|
90
|
+
omits an intermediate); the server ships that public intermediate certificate to verify the connection normally.
|
|
91
|
+
|
|
92
|
+
## FAQ
|
|
93
|
+
|
|
94
|
+
**Why does it fail from outside Iran?** amar.org.ir does not answer foreign IPs. Run it on an Iranian connection or set `AMAR_MCP_PROXY`.
|
|
95
|
+
|
|
96
|
+
**Why is the newest month missing in `am_inflation`?** The Centre publishes a PDF report first and updates the Excel series about a week later. The answer's `newer_report` names that release (use `am_release` for the PDF link); it also carries that month's national index and inflation, read from the PDF.
|
|
97
|
+
|
|
98
|
+
**Are these the same as central-bank figures?** No. These are the Statistical Centre's figures; the Central Bank of Iran publishes its own.
|
|
99
|
+
|
|
100
|
+
**Is it affiliated with the Centre?** No. It reads public pages and files, no login.
|
|
101
|
+
|
|
102
|
+
## فارسی
|
|
103
|
+
|
|
104
|
+
**amar-mcp** یک سرور MCP غیررسمی و فقطخواندنی برای درگاه ملی آمار (مرکز آمار ایران، amar.org.ir) است. با آن میتوانید تورم و شاخص قیمت مصرفکننده (ماهانه، نقطهبهنقطه، متوسط ۱۲ ماه؛ به تفکیک گروه کالا، مناطق شهری و روستایی و استان)، نرخ بیکاری و مشارکت، جمعیت استانها و شهرستانها در سرشماری ۱۳۹۵، تقویم انتشار و هر جدول اکسل منتشرشده را بپرسید.
|
|
105
|
+
|
|
106
|
+
نصب: `claude mcp add amar -- uvx amar-mcp` (نیاز به [uv](https://docs.astral.sh/uv/getting-started/installation/)). درگاه مرکز آمار فقط از داخل ایران پاسخ میدهد؛ سرور را روی اینترنت ایران اجرا کنید یا `AMAR_MCP_PROXY` را روی یک پروکسی ایرانی بگذارید.
|
|
107
|
+
|
|
108
|
+
<sub>Author: Sepehr Radmard (سپهر رادمرد), [github.com/sepehr071](https://github.com/sepehr071), [linkedin.com/in/sepehr-radmard](https://linkedin.com/in/sepehr-radmard). MIT license.</sub>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "amar-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Unofficial read-only MCP server for the Statistical Centre of Iran (amar.org.ir): CPI inflation, unemployment, population, release tables."
|
|
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", "amar", "statistical-centre-of-iran", "iran", "inflation", "cpi", "unemployment", "census", "population", "statistics", "open-data", "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
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"mcp>=2.2,<3",
|
|
25
|
+
"httpx>=0.27",
|
|
26
|
+
"httpx-curl-cffi>=0.1.5",
|
|
27
|
+
"curl-cffi>=0.16.3",
|
|
28
|
+
"openpyxl>=3.1",
|
|
29
|
+
"pypdf>=5",
|
|
30
|
+
"xlrd>=2.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/sepehr071/amar-mcp"
|
|
35
|
+
Issues = "https://github.com/sepehr071/amar-mcp/issues"
|
|
36
|
+
Website = "https://mcpfarsi.ir/"
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
amar-mcp = "amar_mcp.server:main"
|
|
40
|
+
|
|
41
|
+
[dependency-groups]
|
|
42
|
+
dev = ["pytest>=8", "ruff>=0.6"]
|
|
43
|
+
|
|
44
|
+
[build-system]
|
|
45
|
+
requires = ["hatchling"]
|
|
46
|
+
build-backend = "hatchling.build"
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
testpaths = ["tests"]
|
|
50
|
+
addopts = "-m 'not live'"
|
|
51
|
+
markers = ["live: calls the real amar.org.ir site (run with -m live)"]
|
|
52
|
+
|
|
53
|
+
[tool.ruff]
|
|
54
|
+
line-length = 120
|
|
55
|
+
target-version = "py310"
|
|
56
|
+
|
|
57
|
+
[tool.ruff.lint]
|
|
58
|
+
select = ["E", "F", "I", "B", "UP"]
|
|
59
|
+
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/amar-mcp",
|
|
4
|
+
"title": "Statistical Centre of Iran",
|
|
5
|
+
"description": "Read-only Statistical Centre of Iran (amar.org.ir): CPI inflation, unemployment, census, any table.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/sepehr071/amar-mcp",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"websiteUrl": "https://github.com/sepehr071/amar-mcp",
|
|
11
|
+
"version": "0.1.0",
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "pypi",
|
|
15
|
+
"registryBaseUrl": "https://pypi.org",
|
|
16
|
+
"identifier": "amar-mcp",
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"runtimeHint": "uvx",
|
|
19
|
+
"transport": {
|
|
20
|
+
"type": "stdio"
|
|
21
|
+
},
|
|
22
|
+
"environmentVariables": [
|
|
23
|
+
{
|
|
24
|
+
"name": "AMAR_MCP_PROXY",
|
|
25
|
+
"description": "Optional HTTP proxy URL for the amar.org.ir 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,38 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIGnTCCBIWgAwIBAgIRAKgt2eXcr98TIF5wBD5rlagwDQYJKoZIhvcNAQENBQAw
|
|
3
|
+
ejELMAkGA1UEBhMCUEwxITAfBgNVBAoTGEFzc2VjbyBEYXRhIFN5c3RlbXMgUy5B
|
|
4
|
+
LjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR8wHQYD
|
|
5
|
+
VQQDExZDZXJ0dW0gVHJ1c3RlZCBSb290IENBMB4XDTI0MDYxODA3NDEyMloXDTM5
|
|
6
|
+
MDYwNTA3NDEyMlowUjELMAkGA1UEBhMCUEwxITAfBgNVBAoMGEFzc2VjbyBEYXRh
|
|
7
|
+
IFN5c3RlbXMgUy5BLjEgMB4GA1UEAwwXQ2VydHVtIERWIFRMUyBHMiBSMzkgQ0Ew
|
|
8
|
+
ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCo52NXEXWoO2w6zQeBtNer
|
|
9
|
+
d5ahhe8RgM8XVpwGEFoovjHc4K+Cp3auUWVlt7/ARthJoxOttF+jaSrlSve9mWnm
|
|
10
|
+
TJOo1QLuoOTWuZ9XUkMjDG1ztTbFsgRqQyOtZsDqniHD79wqD49DQW4geVslp9/L
|
|
11
|
+
iTQKUpPawtAwpBeoaRXL8RJ8xjNA+2bEr6vesz2MEvvhpWBSWNAIR5O5YbiLztQ9
|
|
12
|
+
KdOuBYS0CW59ptuCjg3AuLcp8aOjk9z/kJc8xKkO48hLTp+HpdHkuI+iFWZn0aCL
|
|
13
|
+
lM/ngpdoBw+NGs6TMC8B6BcK7y/zl8FsNC4gE86Kfd8J9zWhCA7umHnBXCSYCKRx
|
|
14
|
+
H5o7DtoGiWXvcRKYpGtWt9czdUa1edSk5mTrwZGEXLAkX1ECiAq4GS5vEGjrEQ1u
|
|
15
|
+
x8mag2LDh7ZnXdcyzkKZKGsx7uExe3Nx5gWWZMXFrZ5v+uxynKogHUY2vdIMB3dn
|
|
16
|
+
9qRYwpzvn3msfBbkRTAcS9eis1AY0Xxqlt3aXkVyqfKhdJxOPpzATM+Ve4jZSd1n
|
|
17
|
+
LzEj+kFuHnv2jyOY3Vb35n3EmW8yAwG1OWX/QnemMA5s2fZ+ZydHOTG4DkwXnaTr
|
|
18
|
+
R/vUhM+FNywNUlvzYjcM6zt3Ysf9M1hK5PjUEKzsPf5BrIp0fs1zhlVC+cgBN2+J
|
|
19
|
+
PtYwxP1nNpxwBgtIPoTk6wIDAQABo4IBRDCCAUAwcQYIKwYBBQUHAQEEZTBjMDcG
|
|
20
|
+
CCsGAQUFBzAChitodHRwOi8vc3ViY2EucmVwb3NpdG9yeS5jZXJ0dW0ucGwvY3Ry
|
|
21
|
+
Y2EuY2VyMCgGCCsGAQUFBzABhhxodHRwOi8vc3ViY2Eub2NzcC1jZXJ0dW0uY29t
|
|
22
|
+
MB8GA1UdIwQYMBaAFIz7HHW8AtOfTi5I2flgVKrEs0/6MBIGA1UdEwEB/wQIMAYB
|
|
23
|
+
Af8CAQAwNQYDVR0fBC4wLDAqoCigJoYkaHR0cDovL3N1YmNhLmNybC5jZXJ0dW0u
|
|
24
|
+
cGwvY3RyY2EuY3JsMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAOBgNV
|
|
25
|
+
HQ8BAf8EBAMCAQYwEQYDVR0gBAowCDAGBgRVHSAAMB0GA1UdDgQWBBQzqHe3AThv
|
|
26
|
+
Xx8kJKIebBTjbiID3zANBgkqhkiG9w0BAQ0FAAOCAgEACDQ1ggBelZZ/NYs1nFKW
|
|
27
|
+
HnDrA8Y4pv0lvxLzSAC4ejGavMXqPTXHA+DEh9kHNd8tVlo24+6YN96Gspb1kMXR
|
|
28
|
+
uuql23/6R6Fpqg49dkQ1/DobsWvAHoYeZvsaAgaKRD3bvsAcB0JBhyBVT/88S9gu
|
|
29
|
+
DnS5YKMldiLMkVW1Noskd4dHEJ2mkJcVzJIJ0Y4johA1lC1JnZMjkB8ZTNIblkgJ
|
|
30
|
+
K6PqlhYkeMOkx+XbmUuUgh29T0sPne7/V6PHnbEJIxUs40+iLCF0HrdqZypjvWQq
|
|
31
|
+
pSmHRHI3UWVERDeERca0uJ3I+a5ER9vUL9u5ilGG4afyx7QwzitBG+1rU3nRsHyZ
|
|
32
|
+
g6osILL/MWc0AbWJMyKzQ9Guj+uwq47h6BC9BsWF34pJeDC8EuN3HNxPlSWSII9l
|
|
33
|
+
Omwtipvq0EL1iocJhXdlsG+jIUVs/Sl/Um9JiZV+h/MoytnrPrWMIj+0zz6BdaPP
|
|
34
|
+
2sT6wcLzpnwYcE9FWSbQrzNpL283EOUkObjc8AIxICzPHGusF0IqsO+sj9XzvLTh
|
|
35
|
+
TjKfFlzx4NR8gbK7m8sXq6cgP4UAtyvDswebFIRQiuhjqOT9G7+56+4zC0RaEZx/
|
|
36
|
+
LwoFE+ObVXxX674szQvIc+7WPCooVsUbwZIikzJqZb4gJQ1OQx23CgyyYlsPHIDN
|
|
37
|
+
8FpPkganuCwy++7umTkM7+Q=
|
|
38
|
+
-----END CERTIFICATE-----
|