Skip to main content

bama-mcp: unofficial MCP server for bama.ir car ads

bama-mcp: bama.ir MCP server for AI agents

Let your AI agent search the Iranian car market (باما).

An unofficial, read-only MCP server for bama.ir, Iran's biggest car marketplace: search ads by brand, model, city and price, read full ad details, compare prices in Toman, and browse every brand, model and city — all from Claude, Cursor or Copilot.

PyPI Python CI License: MIT


For AI agents

  • What: unofficial MCP server for bama.ir (باما), the Iranian car marketplace. Persian and Finglish queries work; prices in Toman.
  • Install: claude mcp add bama -- uvx bama-mcp (stdio, needs uv and Python 3.10+). Snippets for Claude Desktop, Cursor, VS Code and Hermes below.
  • Auth: none. No API key or account.
  • Access: read-only. No login, no ads posted, nothing is bought or changed.
  • Tools: 5: search_cars, car_details, list_brands, list_models, list_cities. Typical sequence: list_brands -> list_models -> search_cars -> car_details.
  • Use when: the user wants Iranian car ads, prices, comparisons, or "is my car worth X" checks.
  • Do not use when: the user wants to sell/post a car, needs their bama.ir account, or is outside Iran with a VPN on (bama.ir drops foreign IPs at TLS level).
  • Output: compact JSON. Each item carries summary_fa (ready Persian one-liner for tables) and price_fa (۴۱۰ میلیون تومان). price_toman is an int or null (negotiable ads are never 0). Ad code and url pass between tools.

Quick start

The server runs over stdio as uvx bama-mcp (needs uv and Python 3.10+; use the full path to uvx from which uvx if your client cannot find it).

Claude Code

claude mcp add bama -- uvx bama-mcp

Claude Desktop

Settings → Developer → Edit Config, then add:

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

Cursor

Add the same JSON block to ~/.cursor/mcp.json (or .cursor/mcp.json inside a project), or click the button below:

Install in Cursor

In the terminal:

cursor --add-mcp bama -- uvx bama-mcp

VS Code (Copilot agent mode)

Add to .vscode/mcp.json:

{
  "servers": {
    "bama": { "type": "stdio", "command": "uvx", "args": ["bama-mcp"] }
  }
}

Hermes

hermes mcp add bama --command uvx --args bama-mcp

Anything else

It is a standard stdio MCP server: run uvx bama-mcp, or pip install bama-mcp and run bama-mcp.

Then just ask:

  • "پژو ۲۰۶ زیر ۱.۵ میلیارد تو تهران چی هست؟"
  • "ارزان‌ترین پژوهای باما رو جدول بکش"
  • "جزئیات این آگهی باما رو بده: https://bama.ir/car/detail-…"
  • "بین سمند و دنا کدوم ارزون‌تره؟"

What it can do

  • 🔎 Search car ads by brand/model, city (all Iranian provinces and cities), price range and sort order
  • 💸 True prices in Persian: price_fa (۲۸۰ میلیون تومان, ۴.۱ میلیارد تومان, توافقی) plus summary_fa one-liners ready for tables
  • 🧹 Clean results: duplicate ads removed, حواله (installment-slip) ads dropped by default, negotiable ads sink when sorting by price
  • 🏙️ Every city in Iran, by Persian or English name
  • 🔒 Read-only by design: no account, no posting, no contact — the agent finds, you decide

Tools

Tool What it does
search_cars Ads by vehicle (brand/model), city, price_min/price_max (Toman), sort, pagination. One call fetches up to max_pages pages and returns the combined list
car_details One ad in full: price, year, colors, transmission, engine, seller description, photos
list_brands Every brand with Farsi names (پژو -> peugeot)
list_models Models of one brand (peugeot -> 206, 207, پارس, …)
list_cities All provinces and cities, Farsi names

Good to know

  • Prices are in Toman. price_toman is an integer; price_fa is the human-readable Persian form. A negotiable ad shows توافقی, never 0.
  • حواله ads are dropped by default (include_havaleh=false): their price is a down-payment slip, not the car. Pass include_havaleh=true to keep them.
  • City names match Farsi or English (تهران, مشهد, tehran). A province name returns the whole province (تهران includes ورامین and پاکدشت).
  • bama.ir blocks foreign IPs. Run it from an Iranian IP with the VPN off; otherwise the TLS handshake is dropped and the tool answers a clear bama_timeout error. BAMA_MCP_PROXY sets an HTTP proxy that exits in Iran.
  • page_size max is 30 — bama's API rejects larger pages.
  • One call is usually enough. search_cars walks up to max_pages pages (default 10 = 300 ads, cap 20) and returns the combined, de-duplicated list, so the agent does not need to page by hand. With sort=4 (cheapest) plus price_max — or sort=3 plus price_min — it stops as soon as the sorted list passes the bound, which makes the bounded result complete rather than truncated. If truncated is true, continue with page = page + pages_fetched.

FAQ

Is it official, safe and free? It is unofficial, open source (MIT) and free. It is read-only, needs no account or API key, and runs on your machine with no hosted server in between.

It times out / errors immediately. bama.ir drops foreign IPs at the TLS level. Turn the VPN off, or set BAMA_MCP_PROXY to a proxy that exits in Iran.

The model filter returns brand-level results. Known limitation (v0.1): vehicle=peugeot,207 currently behaves like vehicle=peugeot — bama expects a different value format. Brand search is exact. City and price filters work.

car_details says pass the full URL. Correct: pass the url field from search_cars, not the ad code alone.

What are summary_fa and price_fa for? Ready-made Persian strings so the agent can render a table or sentence without reformatting numbers.

فارسی: سرور MCP باما

سرور bama-mcp یک ابزار غیررسمی و فقط‌خواندنی برای باما (bama.ir) است. به دستیار هوش مصنوعی شما (Claude، Cursor، Copilot و ...) اجازه می‌دهد آگهی‌های خودرو را بر اساس برند، مدل، شهر و قیمت جستجو کند، جزئیات کامل هر آگهی را بخواند و همه برندها و شهرهای ایران را ببیند.

  • فقط خواندنی است: وارد حساب نمی‌شوید، آگهی ثبت نمی‌شود و هیچ چیزی خرید یا تغییر داده نمی‌شود.
  • قیمت‌ها به تومان است و به صورت فارسی (۲۸۰ میلیون تومان) نمایش داده می‌شود.
  • روی سیستم خود شما اجرا می‌شود و به هیچ سرور واسطی داده نمی‌فرستد.

نصب در Claude Code:

claude mcp add bama -- uvx bama-mcp

برای Claude Desktop، Cursor، VS Code و Hermes هم نمونه تنظیمات در بالای همین صفحه (بخش Quick start) آمده است.

بعد بپرسید: «پژو ۲۰۶ زیر ۱.۵ میلیارد تو تهران چی هست؟»

نکته: سرور باید روی سیستمی با IP ایران و بدون VPN اجرا شود، چون باما درخواست‌های خارجی را در سطح TLS مسدود می‌کند.

Development

git clone https://github.com/Amrzas/bama-mcp && cd bama-mcp
uv sync --group dev
uv run pytest                # offline, against recorded responses
uv run pytest -m live        # real bama.ir API (needs an Iranian IP)
uv run ruff check src tests

Tools live in src/bama_mcp/ (server.py, pure helpers in format.py, catalog lookups in catalog.py, shared client in http.py). Issues and PRs are welcome, especially new tools and fixes for API changes.

Releases: bump the version in pyproject.toml and server.json, then push a v* tag. GitHub Actions tests, publishes to PyPI and creates the GitHub Release.

Disclaimer

Unofficial; not affiliated with Bama. Read-only access to the data of public pages. Keep request rates low. If this saves you clicks, a star helps others find it.

License

MIT

Metadata

Release files for bama-mcp 0.1.0

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

Source distribution (sdist)

Source distribution for bama-mcp 0.1.0
File Size Uploaded Provenance
bama_mcp-0.1.0.tar.gz 434.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 447.3 kB

Release files / bama_mcp-0.1.0.tar.gz

Download URL bama_mcp-0.1.0.tar.gz
Size 434.7 kB
Tags Source
SHA-256 checksum
How to use checksums
caf1ceda944eaba21c68db160a2d39453538163bcfdd3d22794f7f73d751b052
BLAKE2b-256 checksum
How to use checksums
4996989b02dcb11e884b8d72260316d42c8b3c12565525aedebfd4aaf7906ac1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

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

PyPI Publish Attestation

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

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

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

Download URL bama_mcp-0.1.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7331fbb379f4953a08e1eafd3fa33e9aa8f758f2d29d372186352e9e73d60d4
BLAKE2b-256 checksum
How to use checksums
22edd91e713a03c9f5e3bb35a521d33f905ed5b5c4c540f0c52fd9d2bae1116f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

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

PyPI Publish Attestation

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

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for bama-mcp 0.1.0

Provenance

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

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bama_mcp-0.1.0.tar.gz

PyPI Publish Attestation

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

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

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

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