iran-apps-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.
Files changed (31) hide show
  1. iran_apps_mcp-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +42 -0
  2. iran_apps_mcp-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. iran_apps_mcp-0.1.0/.github/dependabot.yml +10 -0
  4. iran_apps_mcp-0.1.0/.github/workflows/ci.yml +22 -0
  5. iran_apps_mcp-0.1.0/.github/workflows/publish.yml +51 -0
  6. iran_apps_mcp-0.1.0/.gitignore +6 -0
  7. iran_apps_mcp-0.1.0/LICENSE +21 -0
  8. iran_apps_mcp-0.1.0/PKG-INFO +104 -0
  9. iran_apps_mcp-0.1.0/README.md +78 -0
  10. iran_apps_mcp-0.1.0/pyproject.toml +54 -0
  11. iran_apps_mcp-0.1.0/server.json +32 -0
  12. iran_apps_mcp-0.1.0/src/iran_apps_mcp/__init__.py +5 -0
  13. iran_apps_mcp-0.1.0/src/iran_apps_mcp/bazaar.py +134 -0
  14. iran_apps_mcp-0.1.0/src/iran_apps_mcp/http.py +174 -0
  15. iran_apps_mcp-0.1.0/src/iran_apps_mcp/myket.py +146 -0
  16. iran_apps_mcp-0.1.0/src/iran_apps_mcp/registry.py +16 -0
  17. iran_apps_mcp-0.1.0/src/iran_apps_mcp/server.py +71 -0
  18. iran_apps_mcp-0.1.0/src/iran_apps_mcp/tools.py +236 -0
  19. iran_apps_mcp-0.1.0/src/iran_apps_mcp/util.py +80 -0
  20. iran_apps_mcp-0.1.0/tests/conftest.py +83 -0
  21. iran_apps_mcp-0.1.0/tests/fixtures/bazaar_best.json +193 -0
  22. iran_apps_mcp-0.1.0/tests/fixtures/bazaar_detail.json +466 -0
  23. iran_apps_mcp-0.1.0/tests/fixtures/bazaar_notfound.json +12 -0
  24. iran_apps_mcp-0.1.0/tests/fixtures/bazaar_search.json +198 -0
  25. iran_apps_mcp-0.1.0/tests/fixtures/myket_app.html +1 -0
  26. iran_apps_mcp-0.1.0/tests/fixtures/myket_search.html +1 -0
  27. iran_apps_mcp-0.1.0/tests/test_http.py +46 -0
  28. iran_apps_mcp-0.1.0/tests/test_live.py +78 -0
  29. iran_apps_mcp-0.1.0/tests/test_tools.py +181 -0
  30. iran_apps_mcp-0.1.0/tests/test_util.py +21 -0
  31. iran_apps_mcp-0.1.0/uv.lock +1292 -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. ab_find_cheapest
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. the price shown on iran-appsshop.com for the same product
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
+ - Iranian IP, no VPN
36
+ - VPN or proxy
37
+ - ASALBANOO_MCP_PROXY set
38
+ - type: input
39
+ id: version
40
+ attributes:
41
+ label: iran-apps-mcp version
42
+ placeholder: "0.1.0"
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Question or idea
4
+ url: https://github.com/sepehr071/iran-apps-mcp/discussions
5
+ about: Ask how to use it or suggest a new tool
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: monthly
7
+ - package-ecosystem: uv
8
+ directory: /
9
+ schedule:
10
+ interval: monthly
@@ -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/iran-apps-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
@@ -0,0 +1,6 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ dist/
5
+ .pytest_cache/
6
+ .ruff_cache/
@@ -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,104 @@
1
+ Metadata-Version: 2.5
2
+ Name: iran-apps-mcp
3
+ Version: 0.1.0
4
+ Summary: Unofficial read-only MCP server for Iranian Android app stores Cafe Bazaar and Myket: search apps and games, compare versions and ratings across stores, top and new lists.
5
+ Project-URL: Homepage, https://github.com/sepehr071/iran-apps-mcp
6
+ Project-URL: Issues, https://github.com/sepehr071/iran-apps-mcp/issues
7
+ Author-email: Sepehr Radmard <sepehrr80@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: android,app-store,bazaar,cafebazaar,iran,mcp,model-context-protocol,myket
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: curl-cffi>=0.16.3
22
+ Requires-Dist: httpx-curl-cffi>=0.1.5
23
+ Requires-Dist: httpx>=0.27
24
+ Requires-Dist: mcp<3,>=2.2
25
+ Description-Content-Type: text/markdown
26
+
27
+ <!-- mcp-name: io.github.sepehr071/iran-apps-mcp -->
28
+
29
+ # iran-apps-mcp: Cafe Bazaar and Myket MCP server for AI agents
30
+
31
+ **Unofficial, read-only MCP server for the two big Iranian Android app stores, Cafe Bazaar (cafebazaar.ir, کافه بازار) and Myket (myket.ir, مایکت).**<br>
32
+ Search apps and games in both stores, read version, rating, installs and size, compare the same package across the
33
+ stores, and list the best or newest apps per category, from Claude, Cursor or Copilot.
34
+
35
+ [Quick start](#quick-start) · [For AI agents](#for-ai-agents) · [Tools](#tools) · [Notes](#notes) · [فارسی](#فارسی)
36
+
37
+ ## For AI agents
38
+
39
+ - **What:** unofficial MCP server for Cafe Bazaar and Myket. Queries work in Persian and English; prices are in Toman.
40
+ - **Install:** `claude mcp add iran-apps -- uvx iran-apps-mcp` (stdio transport, needs [uv](https://docs.astral.sh/uv/getting-started/installation/) and Python 3.10+).
41
+ - **Auth:** none. Optional `IRAN_APPS_MCP_PROXY` sets an HTTP proxy for requests to both stores.
42
+ - **Access:** read-only and metadata only. No login, reviews, downloads or APK links; every result carries the store page URL.
43
+ - **Tools:** 6, all prefixed `ap_`. Typical sequence: `ap_search` (get the package name) → `ap_compare` or `ap_app` → `ap_similar`.
44
+ - **Use when:** looking up an Android app's version, rating, installs or update date on the Iranian stores; checking whether Myket lags Bazaar; finding top or new apps in a category; finding alternatives to an app.
45
+ - **Do not use when:** the user wants to install or download an app (no links), or needs Google Play data.
46
+ - **Output:** compact JSON. An app is identified by its Android package name (same in both stores). Ratings are 1-5 per store, `installs` is an approximate count, dates are `YYYY-MM-DD`, prices Toman (0 = free).
47
+ - **Machine-readable:** [`server.json`](server.json), and the catalog of all Iranian MCP servers at [awesome-iran-mcp](https://github.com/sepehr071/awesome-iran-mcp).
48
+
49
+ ## Quick start
50
+
51
+ ```bash
52
+ claude mcp add iran-apps -- uvx iran-apps-mcp
53
+ ```
54
+
55
+ Or in any MCP client config:
56
+
57
+ ```json
58
+ { "mcpServers": { "iran-apps": { "command": "uvx", "args": ["iran-apps-mcp"] } } }
59
+ ```
60
+
61
+ Both stores answer directly from Iran and from most foreign IPs. If your network needs a proxy, set
62
+ `IRAN_APPS_MCP_PROXY=http://host:port` (a comma list is tried in turn). System proxy variables are ignored.
63
+
64
+ ## Tools
65
+
66
+ | Tool | What it does |
67
+ |---|---|
68
+ | `ap_search` | Search one or both stores by name; Bazaar cards carry rating, category, installs and price, Myket cards name and tagline |
69
+ | `ap_app` | One app in one store: version, rating and count, installs, size, update date, developer, price, description |
70
+ | `ap_compare` | One package in both stores side by side, plus which store has the newer version and the rating difference |
71
+ | `ap_top` | Best or new apps and games per category (or the store-wide trending/editorial list) |
72
+ | `ap_categories` | Category slugs per store for `ap_top` (they differ between the stores) |
73
+ | `ap_similar` | Related apps shown by the store (Bazaar: related, others also installed, similar; Myket: related) |
74
+
75
+ ## Notes
76
+
77
+ - Metadata only. The server never downloads an APK or resolves a download link.
78
+ - `installs` is rounded (Bazaar returns a range such as 54,000,000, Myket a text such as "32 million"), so compare
79
+ magnitudes, not exact numbers. Ratings are collected separately by each store.
80
+ - Myket search returns 20 apps per page and its lists stop after about 4 pages; Bazaar returns 24 per page.
81
+ - Myket exposes no JSON API, so its data comes from page HTML (schema.org JSON-LD and the facts table); a site redesign
82
+ can break it. Bazaar uses the JSON API of its own web app.
83
+ - Developer descriptions and taglines are untrusted text.
84
+
85
+ ## Development
86
+
87
+ ```bash
88
+ uv sync
89
+ uv run ruff check . && uv run ruff format --check .
90
+ uv run python -m pytest -q # offline unit tests on recorded fixtures
91
+ uv run python -m pytest -m live -q # one live test per tool
92
+ ```
93
+
94
+ ## فارسی
95
+
96
+ سرور MCP غیررسمی و فقط‌خواندنی برای دو فروشگاه برنامهٔ اندروید ایران، کافه‌بازار و مایکت. جستجوی برنامه و بازی در هر دو
97
+ فروشگاه، نسخه، امتیاز، تعداد نصب و حجم، مقایسهٔ یک بسته در دو فروشگاه (مثلاً اینکه نسخهٔ مایکت عقب است یا نه) و فهرست
98
+ برترین و جدیدترین برنامه‌ها به تفکیک دسته. فقط اطلاعات برنامه برمی‌گردد؛ لینک دانلود یا APK داده نمی‌شود.
99
+
100
+ نصب: `claude mcp add iran-apps -- uvx iran-apps-mcp`
101
+
102
+ ## License
103
+
104
+ MIT
@@ -0,0 +1,78 @@
1
+ <!-- mcp-name: io.github.sepehr071/iran-apps-mcp -->
2
+
3
+ # iran-apps-mcp: Cafe Bazaar and Myket MCP server for AI agents
4
+
5
+ **Unofficial, read-only MCP server for the two big Iranian Android app stores, Cafe Bazaar (cafebazaar.ir, کافه بازار) and Myket (myket.ir, مایکت).**<br>
6
+ Search apps and games in both stores, read version, rating, installs and size, compare the same package across the
7
+ stores, and list the best or newest apps per category, from Claude, Cursor or Copilot.
8
+
9
+ [Quick start](#quick-start) · [For AI agents](#for-ai-agents) · [Tools](#tools) · [Notes](#notes) · [فارسی](#فارسی)
10
+
11
+ ## For AI agents
12
+
13
+ - **What:** unofficial MCP server for Cafe Bazaar and Myket. Queries work in Persian and English; prices are in Toman.
14
+ - **Install:** `claude mcp add iran-apps -- uvx iran-apps-mcp` (stdio transport, needs [uv](https://docs.astral.sh/uv/getting-started/installation/) and Python 3.10+).
15
+ - **Auth:** none. Optional `IRAN_APPS_MCP_PROXY` sets an HTTP proxy for requests to both stores.
16
+ - **Access:** read-only and metadata only. No login, reviews, downloads or APK links; every result carries the store page URL.
17
+ - **Tools:** 6, all prefixed `ap_`. Typical sequence: `ap_search` (get the package name) → `ap_compare` or `ap_app` → `ap_similar`.
18
+ - **Use when:** looking up an Android app's version, rating, installs or update date on the Iranian stores; checking whether Myket lags Bazaar; finding top or new apps in a category; finding alternatives to an app.
19
+ - **Do not use when:** the user wants to install or download an app (no links), or needs Google Play data.
20
+ - **Output:** compact JSON. An app is identified by its Android package name (same in both stores). Ratings are 1-5 per store, `installs` is an approximate count, dates are `YYYY-MM-DD`, prices Toman (0 = free).
21
+ - **Machine-readable:** [`server.json`](server.json), and the catalog of all Iranian MCP servers at [awesome-iran-mcp](https://github.com/sepehr071/awesome-iran-mcp).
22
+
23
+ ## Quick start
24
+
25
+ ```bash
26
+ claude mcp add iran-apps -- uvx iran-apps-mcp
27
+ ```
28
+
29
+ Or in any MCP client config:
30
+
31
+ ```json
32
+ { "mcpServers": { "iran-apps": { "command": "uvx", "args": ["iran-apps-mcp"] } } }
33
+ ```
34
+
35
+ Both stores answer directly from Iran and from most foreign IPs. If your network needs a proxy, set
36
+ `IRAN_APPS_MCP_PROXY=http://host:port` (a comma list is tried in turn). System proxy variables are ignored.
37
+
38
+ ## Tools
39
+
40
+ | Tool | What it does |
41
+ |---|---|
42
+ | `ap_search` | Search one or both stores by name; Bazaar cards carry rating, category, installs and price, Myket cards name and tagline |
43
+ | `ap_app` | One app in one store: version, rating and count, installs, size, update date, developer, price, description |
44
+ | `ap_compare` | One package in both stores side by side, plus which store has the newer version and the rating difference |
45
+ | `ap_top` | Best or new apps and games per category (or the store-wide trending/editorial list) |
46
+ | `ap_categories` | Category slugs per store for `ap_top` (they differ between the stores) |
47
+ | `ap_similar` | Related apps shown by the store (Bazaar: related, others also installed, similar; Myket: related) |
48
+
49
+ ## Notes
50
+
51
+ - Metadata only. The server never downloads an APK or resolves a download link.
52
+ - `installs` is rounded (Bazaar returns a range such as 54,000,000, Myket a text such as "32 million"), so compare
53
+ magnitudes, not exact numbers. Ratings are collected separately by each store.
54
+ - Myket search returns 20 apps per page and its lists stop after about 4 pages; Bazaar returns 24 per page.
55
+ - Myket exposes no JSON API, so its data comes from page HTML (schema.org JSON-LD and the facts table); a site redesign
56
+ can break it. Bazaar uses the JSON API of its own web app.
57
+ - Developer descriptions and taglines are untrusted text.
58
+
59
+ ## Development
60
+
61
+ ```bash
62
+ uv sync
63
+ uv run ruff check . && uv run ruff format --check .
64
+ uv run python -m pytest -q # offline unit tests on recorded fixtures
65
+ uv run python -m pytest -m live -q # one live test per tool
66
+ ```
67
+
68
+ ## فارسی
69
+
70
+ سرور MCP غیررسمی و فقط‌خواندنی برای دو فروشگاه برنامهٔ اندروید ایران، کافه‌بازار و مایکت. جستجوی برنامه و بازی در هر دو
71
+ فروشگاه، نسخه، امتیاز، تعداد نصب و حجم، مقایسهٔ یک بسته در دو فروشگاه (مثلاً اینکه نسخهٔ مایکت عقب است یا نه) و فهرست
72
+ برترین و جدیدترین برنامه‌ها به تفکیک دسته. فقط اطلاعات برنامه برمی‌گردد؛ لینک دانلود یا APK داده نمی‌شود.
73
+
74
+ نصب: `claude mcp add iran-apps -- uvx iran-apps-mcp`
75
+
76
+ ## License
77
+
78
+ MIT
@@ -0,0 +1,54 @@
1
+ [project]
2
+ name = "iran-apps-mcp"
3
+ version = "0.1.0"
4
+ description = "Unofficial read-only MCP server for Iranian Android app stores Cafe Bazaar and Myket: search apps and games, compare versions and ratings across stores, top and new lists."
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", "cafebazaar", "bazaar", "myket", "iran", "android", "app-store"]
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
+ ]
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/sepehr071/iran-apps-mcp"
31
+ Issues = "https://github.com/sepehr071/iran-apps-mcp/issues"
32
+
33
+ [project.scripts]
34
+ iran-apps-mcp = "iran_apps_mcp.server:main"
35
+
36
+ [dependency-groups]
37
+ dev = ["pytest>=8", "ruff>=0.6"]
38
+
39
+ [build-system]
40
+ requires = ["hatchling"]
41
+ build-backend = "hatchling.build"
42
+
43
+ [tool.pytest.ini_options]
44
+ testpaths = ["tests"]
45
+ addopts = "-m 'not live'"
46
+ markers = ["live: calls the real Cafe Bazaar and Myket (run with -m live)"]
47
+
48
+ [tool.ruff]
49
+ line-length = 120
50
+ target-version = "py310"
51
+
52
+ [tool.ruff.lint]
53
+ select = ["E", "F", "I", "B", "UP"]
54
+ 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/iran-apps-mcp",
4
+ "title": "Iran Apps",
5
+ "description": "Unofficial read-only Cafe Bazaar and Myket: search apps, compare versions and ratings, top lists.",
6
+ "repository": {
7
+ "url": "https://github.com/sepehr071/iran-apps-mcp",
8
+ "source": "github"
9
+ },
10
+ "websiteUrl": "https://github.com/sepehr071/iran-apps-mcp",
11
+ "version": "0.1.0",
12
+ "packages": [
13
+ {
14
+ "registryType": "pypi",
15
+ "registryBaseUrl": "https://pypi.org",
16
+ "identifier": "iran-apps-mcp",
17
+ "version": "0.1.0",
18
+ "runtimeHint": "uvx",
19
+ "transport": {
20
+ "type": "stdio"
21
+ },
22
+ "environmentVariables": [
23
+ {
24
+ "name": "IRAN_APPS_MCP_PROXY",
25
+ "description": "Optional HTTP proxy URL, or a comma-separated list tried in turn, for cafebazaar.ir and myket.ir; system proxies are ignored.",
26
+ "isRequired": false,
27
+ "isSecret": false
28
+ }
29
+ ]
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,5 @@
1
+ """Unofficial MCP server for the Iranian app stores Cafe Bazaar and Myket."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__ = version("iran-apps-mcp")
@@ -0,0 +1,134 @@
1
+ """Cafe Bazaar (cafebazaar.ir): the JSON behind its web app, `api.cafebazaar.ir/rest-v1/process/<Request>`."""
2
+
3
+ from datetime import datetime, timezone
4
+ from typing import Any
5
+
6
+ from . import http
7
+ from .util import clip, parse_count, slim, text_of
8
+
9
+ SITE = "https://cafebazaar.ir"
10
+ PAGE = 24 # rows per page of search and list replies
11
+
12
+ APP_CATEGORIES = [
13
+ "books-reference", "education", "entertainment", "finance", "food-drink", "health-fitness", "kids-apps",
14
+ "lifestyle", "maps-navigation", "medical", "music-audio", "personalization", "photography", "religious",
15
+ "shopping", "social", "sports", "tools", "travel-local", "weather",
16
+ ] # fmt: skip
17
+ GAME_CATEGORIES = [
18
+ "action", "arcade", "casual", "kids-games", "puzzle", "racing", "simulation", "sports-game", "strategy", "word-trivia",
19
+ ] # fmt: skip
20
+
21
+
22
+ def url(package: str) -> str:
23
+ return f"{SITE}/app/{package}"
24
+
25
+
26
+ def card(info: dict[str, Any]) -> dict[str, Any]:
27
+ """A list/search row's `simpleAppItem.info` as a compact card."""
28
+ pay = info.get("paymentInfo") or {}
29
+ return slim(
30
+ {
31
+ "store": "bazaar",
32
+ "package": info["packageName"],
33
+ "name": info.get("name"),
34
+ "category": info.get("category"),
35
+ "rating": info.get("rate") or None,
36
+ "installs": parse_count(
37
+ f"{info.get('installCountVerbose', '')} {info.get('installCountVerboseLabel', '')}"
38
+ ),
39
+ "price": pay.get("priceString") if pay.get("price") else None,
40
+ "url": url(info["packageName"]),
41
+ }
42
+ )
43
+
44
+
45
+ def cards(reply: dict[str, Any]) -> tuple[list[dict[str, Any]], bool]:
46
+ """(cards, has_more) from a reply that holds `pageBody.rows`; ads are dropped."""
47
+ rows = (reply.get("pageBody") or {}).get("rows") or []
48
+ items = [r["simpleAppItem"] for r in rows if "simpleAppItem" in r]
49
+ return [card(i["info"]) for i in items if not i.get("isAd")], bool(reply.get("hasMore"))
50
+
51
+
52
+ async def search(query: str, page: int) -> tuple[list[dict[str, Any]], bool]:
53
+ reply = await http.bazaar(
54
+ "searchBodyV2Request",
55
+ {"query": query, "entities": "", "language": "fa", "offset": (page - 1) * PAGE, "scope": "app"},
56
+ )
57
+ return cards(reply)
58
+
59
+
60
+ async def listing(path: str, page: int) -> tuple[list[dict[str, Any]], bool]:
61
+ """A vitrin list such as `list~app~automatic~APP_BEST~tools`."""
62
+ reply = await http.bazaar("getPageBodyRequest", {"path": path, "offset": (page - 1) * PAGE})
63
+ return cards(reply)
64
+
65
+
66
+ def list_path(kind: str, category: str) -> str:
67
+ """Path of the "best" or "new" list of a category."""
68
+ return f"list~app~automatic~{'APP_BEST' if kind == 'best' else 'APP_NEW'}~{category}"
69
+
70
+
71
+ def _iso(epoch: str | None) -> str | None:
72
+ return datetime.fromtimestamp(int(epoch), timezone.utc).strftime("%Y-%m-%d") if epoch and epoch.isdigit() else None
73
+
74
+
75
+ async def detail(package: str) -> dict[str, Any]:
76
+ a = await http.bazaar("appDetailsRequest", {"packageName": package, "referrer": ""})
77
+ return parse_detail(a)
78
+
79
+
80
+ def parse_detail(a: dict[str, Any]) -> dict[str, Any]:
81
+ pkg, stats, price = a.get("package") or {}, a.get("stats") or {}, a.get("price") or {}
82
+ size = pkg.get("packageSize")
83
+ return slim(
84
+ {
85
+ "store": "bazaar",
86
+ "package": a["packageName"],
87
+ "name": a.get("name"),
88
+ "version": pkg.get("versionName"),
89
+ "version_code": pkg.get("versionCode"),
90
+ "rating": stats.get("rate") or None,
91
+ "rating_count": stats.get("reviewCount"),
92
+ "rating_histogram": [stats.get(f"rate{i}Count") for i in range(1, 6)] if stats.get("reviewCount") else None,
93
+ "installs": parse_count(stats.get("installCountRange")),
94
+ "size_mb": round(int(size) / 1e6, 1) if size and size.isdigit() else None,
95
+ "updated": _iso(pkg.get("lastUpdatedTimeFromEpoch")),
96
+ "category": a.get("categoryName"),
97
+ "category_slug": a.get("categorySlug"),
98
+ "is_game": a.get("isGame"),
99
+ "developer": a.get("authorName"),
100
+ "price": int(price.get("price") or 0) // 10, # Bazaar sends Rial (20000 = "2000 Tomans")
101
+ "price_text": price.get("priceString"),
102
+ "in_app_purchase": a.get("hasInAppPurchase"),
103
+ "homepage": a.get("homepage"),
104
+ "summary": a.get("shortDescription"),
105
+ "description": clip(text_of(a.get("description") or ""), 1500),
106
+ "changelog": clip(text_of(pkg.get("changeLog") or ""), 600),
107
+ "permissions": len(pkg.get("permissions") or []),
108
+ "icon": a.get("icon"),
109
+ "url": url(a["packageName"]),
110
+ }
111
+ )
112
+
113
+
114
+ async def related(package: str) -> list[dict[str, Any]]:
115
+ """Related-app groups of an app: [{title, apps}]."""
116
+ a = await http.bazaar("appDetailsRequest", {"packageName": package, "referrer": ""})
117
+ groups = []
118
+ for row in (a.get("relatedPage") or {}).get("commonRows") or []:
119
+ apps = [
120
+ slim(
121
+ {
122
+ "store": "bazaar",
123
+ "package": i["packageName"],
124
+ "name": i.get("name"),
125
+ "rating": i.get("rate") or None,
126
+ "developer": i.get("authorName"),
127
+ "url": url(i["packageName"]),
128
+ }
129
+ )
130
+ for i in (row.get("appList") or {}).get("appList") or []
131
+ ]
132
+ if apps:
133
+ groups.append({"title": row.get("title") or "", "apps": apps})
134
+ return groups