Divar

io.github.sepehr071由 GitHub 帳號 sepehr071 發布v0.3.0更新於 Nov 7, 2026

Unofficial read-only Divar: search Iran's classified ads, cheapest and best-value ads, price checks.

概覽

AI 產生的概覽

非官方、唯讀的 MCP 伺服器,讓助理搜尋伊朗 Divar 分類廣告,並判斷開價是否合理。

可以做什麼
  • 查詢城市、街區、相鄰街區、地點與分類樹,並把波斯語自然語言請求轉成搜尋參數
  • 依城市、分類、文字、價格、品牌與分類篩選條件搜尋及計數廣告,支援游標翻頁與匯出 CSV 或 JSON lines
  • 為廣告排序:最便宜、預算內最划算、低於中位數的撿便宜,以及依街區與依日的價格統計
  • 對照相似廣告評估某個價格,並把 2 到 6 則廣告並排比較
  • 讀取完整廣告、相似廣告、賣家與經銷商頁面,以及地圖某點附近的廣告
  • 監控搜尋的新廣告,並在本機保存每日中位價趨勢
適用情境
適合需要尋找、比價或監控伊朗 Divar 租售屋、二手車、手機、家具、徵才等廣告的情況,或詢問某城市某類商品的價格水準。不適合刊登廣告、聯絡賣家或取得電話號碼,這些都需要登入 Divar。
執行需求
透過 uvx(或 pip install)以 stdio 在本機執行,需要 uv 與 Python 3.10 以上。不需帳號或 API 金鑰。選用環境變數 DIVAR_MCP_PROXY 可設定 HTTP 代理或逗號分隔的代理清單,系統代理設定會被忽略;選用 DIVAR_MCP_STATE 指定儲存的監控與價格歷史檔案位置。需要能連線 divar.ir 的網路。
安裝前請注意
非官方,與 Divar 無關聯;它讀取公開網頁端點,端點可能隨時變動。它為唯讀,無法登入、刊登廣告、聊天或顯示賣家電話。dv_watch 與 dv_price_trend 只會寫入本機狀態檔。價格是賣家填寫的開價(單位托曼),並非成交價,部分為佔位價格。請維持較低的請求頻率。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Divar,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

divar-mcp: Divar MCP server for AI agents

Let your AI agent search Divar (دیوار) ads in any Iranian city, and tell it whether a price is fair.
An unofficial, read-only MCP server for Divar, Iran's largest classifieds site (homes, cars, phones, jobs, services).
Search, read ads, compare, find the cheapest and best-value ads, appraise prices and browse the map from Claude, Cursor or Copilot. Prices are in Toman.

[PyPI] [Python] [CI] [MCP Registry] [License: MIT]

[Install in VS Code]

For AI agents · Why · What it can do · Quick start · Tools · How it works · Good to know · FAQ · Configuration · فارسی · Development


For AI agents

  • What: unofficial MCP server (model context protocol) for Divar (دیوار, divar.ir), Iran's classifieds site. Persian queries work best; Arabic letter variants (ي/ك) are folded.
  • Install: uvx divar-mcp or claude mcp add divar -- uvx divar-mcp. Transport: stdio. Needs uv (Python 3.10+).
  • Auth: none, no API key or account. Optional DIVAR_MCP_PROXY (HTTP proxy URL, or a comma-separated list); system proxy settings are ignored.
  • Access: read-only on Divar. It cannot log in, post, chat, bookmark or reveal a seller's phone number, so no confirmation is needed before calling a tool. Only dv_watch and dv_price_trend write, and only to a local file of your own searches.
  • Tools: 31, all prefixed dv_. Start with dv_search, dv_post, dv_cheapest, dv_best_for_budget, dv_market.
  • Typical sequence: dv_cities / dv_categories -> dv_filters -> dv_search -> dv_post -> dv_similar / dv_appraise / dv_compare.
  • Also: resources divar://cities, divar://categories, divar://category-filters/{slug}; prompts compare_ads, best_under_budget, appraise_listing, watch_market.
  • Units: prices in Toman (Divar's own unit, nothing is converted). price for a sale; deposit + rent for a rental (rent 0 with full_deposit means رهن کامل); no price means negotiable.
  • Use when: the user wants to find, price-check or monitor Divar ads (flats to buy or rent, used cars, phones, furniture, jobs...), or asks what something costs in a city.
  • Do not use when: the user wants to post an ad, message a seller or get a phone number (login-only on Divar), or needs a market other than Divar.
  • Output: compact JSON ad cards. Pass token between tools and next_cursor back as cursor.
  • Machine-readable: server.json and the iran-mcp catalog (TOOLS.md, servers.json, llms.txt).

Why

Divar is where Iranians buy and sell flats, cars and phones, but answering "what is a fair price for a 2-bedroom flat in Vanak?" means scrolling through dozens of ads and ignoring the fake prices. With divar-mcp an agent fetches the ads, drops placeholder prices, computes the median and quartiles of the asking prices, and tells you which ads are well below them.

You: Find the best 2-bedroom flat to rent in Vanak with a deposit under 1 billion Toman.

Agent: calls dv_parse_query -> dv_best_for_budget -> dv_post

It lists the best-value ads against the median of the ads that fit, with the reasons for each score, then opens the one you pick.

What it can do

  • Search ads in one or several cities by category, text, neighbourhood, price (and deposit for rentals), brand and model, photo, freshness and every other filter of the category; merge several pages with duplicates removed; continue with a cursor
  • Read a full ad: price in Toman, specs, features, description, all images, map position, seller type, placeholder-price detection
  • Find value: cheapest ads (junk prices skipped), best value and most-for-the-budget, ads priced well below the median, side-by-side comparison showing only the differences, similar ads
  • Judge a price: fair-price appraisal with percentile and confidence, market statistics by district and by day
  • Monitor: poll dv_new_since with the last timestamp to see only new ads; keep saved searches and a daily median price trend locally; export results as CSV or JSON lines
  • Use the map: ads around a GPS point or landmark with distances; neighbourhoods, neighbours, borders, address of a point
  • Look at sellers and dealers: how many ads a seller has, the business card and its ads

Example prompts:

  • "Cheapest used Peugeot 206 in Tehran, and is it priced fairly compared with similar ads?"
  • "Find apartments to rent near Vanak under 8 billion Toman and compare the top three."
  • "Show new iPhone 15 ads in Mashhad since this morning."
  • "What is the median price per square metre for apartments for sale in Gisha?"
  • ارزان‌ترین آپارتمان ۲ خوابه اجاره‌ای در ونک با ودیعه زیر ۱ میلیارد کدام است؟
  • قیمت این ماشین نسبت به آگهی‌های مشابه گران است یا ارزان؟
  • آگهی‌های جدید گوشی آیفون ۱۵ در مشهد را از امروز صبح نشان بده.

Quick start

You need uv. No API key or account.

Claude Code
bash
claude mcp add divar -- uvx divar-mcp
Claude Desktop

Settings → Developer → Edit Config, then add:

json
{  "mcpServers": {    "divar": { "command": "uvx", "args": ["divar-mcp"] }  }}
Cursor

Add the Claude Desktop block above to ~/.cursor/mcp.json (or .cursor/mcp.json in a project).

VS Code (Copilot agent mode)

Click Install in VS Code above, or add to .vscode/mcp.json:

json
{  "servers": {    "divar": { "type": "stdio", "command": "uvx", "args": ["divar-mcp"] }  }}
Codex CLI
bash
codex mcp add divar -- uvx divar-mcp

Or in ~/.codex/config.toml:

toml
[mcp_servers.divar]command = "uvx"args = ["divar-mcp"]
Gemini CLI

Add to ~/.gemini/settings.json:

json
{  "mcpServers": {    "divar": { "command": "uvx", "args": ["divar-mcp"] }  }}
Windsurf

Add the Claude Desktop block to ~/.codeium/windsurf/mcp_config.json.

Anything else

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

Tools

An ad card has token, title, price (sale) or deposit + rent (rent 0 with full_deposit means رهن کامل), info (mileage, condition...), district, seller (agency label), age_h (hours since the last bump), photos, image (thumbnail URL, only from dv_search with thumbnails), chat, tag (paid promotion), url, and suspect_price when the price looks like a placeholder. Absent flags mean false. Default page size is 10 to 20 ads.

All tools start with dv_ and are annotated read-only, except dv_watch and dv_price_trend, which write only to a local file.

Find places and categories

ToolWhat it does
dv_citiesCity ids for a name (1,177 cities); no query lists the biggest cities
dv_districtsNeighbourhoods of a city with ids, centre and main streets
dv_neighboursNeighbourhoods adjacent to a district (Divar's list plus the nearest ones by distance)
dv_locateCity, neighbourhood and street address of a GPS point
dv_place_searchMap autocomplete: landmark or street to coordinates
dv_place_mappingConvert old Divar place ids to current ones
dv_categoriesThe 236-node category tree; search by name, list children
dv_filtersEvery filter of a category: key, type, label, unit, options
dv_filter_optionsBrand and model keys (161 car brands), districts and other option lists, with typed search
dv_suggestThe search box's suggestions and category guesses for some text
dv_parse_queryA plain Persian request ("آپارتمان اجاره ونک زیر ۸ میلیارد") to dv_search arguments: city, neighbourhoods, price bounds, area (80 متری), category
dv_boundaryNeighbourhood borders of a city (GeoJSON): the city box, or one neighbourhood's polygon

Search and price

ToolWhat it does
dv_searchSearch ads with city, category, text, districts, price, brand, photo, freshness and any category filter; multi-page merge, client-side age and keyword filters, cursor paging
dv_countHow many ads match a search (capped at 10,000)
dv_cheapestThe cheapest ads of a search; placeholder prices and far-below-median outliers skipped
dv_best_for_budgetWithin a budget: best value with an explainable deal_score (and reasons) against the median of the ads that fit (price per m2 for property for sale), and the most you can get; bait / co-op / loan titles are skipped
dv_find_dealsAds priced well below the median of a search, no budget needed; junk prices and bait titles removed
dv_marketPrice statistics (min, quartiles, median, max) plus breakdown by district and by day
dv_appraiseIs an ad's price (or a price you give) high or low versus similar ads (same area first, then the whole city): percentile, verdict ("insufficient comparables" when the call is extreme but thin), confidence
dv_new_sinceAds published after a timestamp: poll with the returned latest to watch a search
dv_exportThe ads of a search as CSV or JSON lines
dv_nearbyMap ads around a point (category required), nearest first, with coordinates, distance and total price
dv_watchSaved searches: create, then check to get only the ads newer than the last check (local file)
dv_price_trendOne median asking price per day for a search, kept locally, with change since the previous day
dv_statusIs Divar reachable, latency, caches, saved watches and the tool list

One ad and its seller

ToolWhat it does
dv_postFull ad: price, specs, features, description, images, map position, seller type, flags
dv_postsUp to 10 ads in one call, compact
dv_compare2 to 6 ads side by side: prices and only the specs that differ
dv_similarAds like this one (same brand and area, widening step by step)
dv_sellerA seller's personal and business ad counts, business card (or "personal seller") and other ads (only business sellers' ads are listed, the first 11)
dv_dealerA business's public page: name, member since, first 11 ads

How it works

text
  AI agent  (Claude, Cursor, Copilot, ...)      │      │  MCP over stdio      ▼  divar-mcp  (runs on your machine)      │      │  HTTPS      └──────▶  api.divar.ir   ads, categories, places, map

divar-mcp runs locally and calls the same JSON gateway the divar.ir web app uses. It has no hosted server in between and no API key. Every POST it sends is a read-only query. Requests go out through a Chrome-impersonating client (TLS/HTTP2 fingerprint and headers), at most 2 at a time with a small random delay, and a failed call is retried up to twice. Divar's list answers are widget JSON; the server turns them into compact ad cards and computes rankings and statistics from the asking prices it fetched.

Good to know

  • Prices are Toman. Divar's prices are Toman already; nothing is converted. A missing price means negotiable (توافقی), never 0. Rentals have deposit (ودیعه) and rent (اجاره); rent 0 with full_deposit is رهن کامل.
  • Asking prices. Everything is what sellers typed, not what deals close at. Some sellers type junk (1,111,111 or a deposit as a car price): suspect_price flags placeholders, and rankings and statistics skip them and prices under a tenth of the median.
  • Province scope. city: "استان مشهد" (or province:مشهد) searches the whole province of that city; districts and boundaries need a city.
  • Order. Divar's API only returns newest first; the first 1-3 rows can be paid promotions with older dates. dv_search sort and the price tools sort the ads fetched in the call, not the whole market. Paging is a time cursor (next_cursor -> cursor).
  • Freshness. age_h is the time since the last bump (نردبان), not since publication; only the ad page has the real publish time.
  • Filters. dv_filters lists the keys of a category; filters a category lacks are reported in ignored, not silently dropped. Web URL slugs (car) work next to API slugs (light).
  • Map positions of most ads are fuzzed by about 500 m (approximate_location).
  • No phone numbers. Divar shows them only to logged-in users; this server never logs in. Use url to open the ad.
  • Large prices. Detail prices come from the ad's price rows; Divar's raw number elsewhere in the ad is float-rounded for large values.
  • Not available: a Divar price valuation from the site itself, sort by price on Divar's side, paging through all of a dealer's ads, anything behind login.
  • Rate limits: none was seen in testing, but keep calls modest.
  • Bot check: if Divar ever serves a challenge page, install divar-mcp[browser] and run patchright install chromium; the server then clears it once with a headless browser. Without it, the call fails with a message saying so.

FAQ

Is there a Divar API or MCP server for AI agents?

Yes: this unofficial MCP server wraps the public JSON API the Divar website itself uses, so Claude, Cursor or Copilot can search ads, read details and compare prices. Divar's official Kenar API is for partners (OAuth and an API key) and is not used here.

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.

Can it message a seller, post an ad or get a phone number?

No. Those need a Divar login and are deliberately left out.

Can it alert me when a matching ad appears?

It does not push. dv_new_since returns only ads newer than a timestamp, and dv_watch remembers that timestamp for a saved search (in ~/.divar-mcp/state.json, or DIVAR_MCP_STATE), so a scheduler (cron, a Claude Code loop) can call dv_watch with action: "check".

Are prices in Rial or Toman?

Toman. Divar's API already uses Toman, so nothing is converted.

How do I use it with Claude, Cursor or Copilot?

Add the server with claude mcp add divar -- uvx divar-mcp, or use the matching config in Quick start, then ask in plain language, in Persian or English.

Does it work for cars, phones and jobs, not only homes?

Yes. dv_categories lists the 236-node category tree and dv_filters shows the filters of each category (brand and model, mileage, price and so on), so the same search tools work across categories.

How do I debug what the agent sees?
bash
npx @modelcontextprotocol/inspector uvx divar-mcp

Configuration

VariableDefaultMeaning
DIVAR_MCP_PROXYunsetOptional HTTP proxy URL for requests to divar.ir, or a comma-separated list: one is used until it gets blocked or fails to connect, then the next. System proxy settings are ignored
DIVAR_MCP_STATE~/.divar-mcp/state.jsonFile for saved watches and price history (used by dv_watch and dv_price_trend)

فارسی: سرور MCP دیوار

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

چه کارهایی می‌کند

  • جستجوی آگهی بر اساس شهر، محله، دسته، متن، قیمت (و ودیعه برای اجاره)، برند و مدل و فیلترهای هر دسته.
  • ارزان‌ترین آگهی‌ها و آگهی‌های زیر قیمت بازار، با حذف قیمت‌های الکی.
  • ارزیابی قیمت: گران یا ارزان بودن قیمت یک آگهی نسبت به آگهی‌های مشابه، همراه با آمار قیمت (میانه و چارک‌ها).
  • مقایسه آگهی‌ها و پیدا کردن آگهی‌های مشابه.
  • آگهی‌های اطراف یک نقطه روی نقشه، محله‌ها و مرز محله‌ها.
  • پایش آگهی‌های جدید و ذخیره جستجو و روند قیمت روی سیستم خودتان.

نکته‌ها

  • فقط خواندنی است: ورود به حساب، ثبت آگهی، گفتگو با فروشنده و نمایش شماره تلفن فروشنده را انجام نمی‌دهد. کلید API یا حساب کاربری لازم نیست و روی سیستم خود شما اجرا می‌شود.
  • همه قیمت‌ها به تومان است؛ قیمت نداشتن یعنی توافقی. قیمت‌ها همان چیزی است که فروشنده نوشته، نه قیمت نهایی معامله.
  • پرسش فارسی بهترین نتیجه را می‌دهد.
  • اگر لازم بود پراکسی بگذارید، متغیر DIVAR_MCP_PROXY را تنظیم کنید.

نصب (اول uv را نصب کنید). در Claude Code:

bash
claude mcp add divar -- uvx divar-mcp

در Claude Desktop، Cursor و بقیه برنامه‌ها همان تنظیم بخش Quick start را بگذارید.

نمونه پرسش‌ها

  • «ارزان‌ترین آپارتمان ۲ خوابه اجاره‌ای در ونک با ودیعه زیر ۱ میلیارد کدام است؟»
  • «قیمت این آگهی خودرو نسبت به آگهی‌های مشابه چطور است؟»
  • «آگهی‌های جدید گوشی در مشهد را از امروز صبح نشان بده.»
  • «میانه قیمت هر متر آپارتمان برای فروش در یک محله چقدر است؟»

Development

bash
git clone https://github.com/sepehr071/divar-mcp && cd divar-mcpuv syncuv run ruff check . && uv run ruff format --check .uv run python -m pytest -q            # offline, recorded fixturesuv run python -m pytest -m live -q    # real API, one test per tooluv build

Tools live in src/divar_mcp/ (places.py, catalog.py, search.py, post.py, market.py, watch.py, meta.py); each is a typed async function with a docstring that tells the agent when to use it. Issues and PRs are welcome.

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

Related servers

Disclaimer

Unofficial and not affiliated with or endorsed by Divar. It reads public data through the endpoints of the divar.ir web app, which can change without notice. Everything it returns is asking prices typed by sellers, not advice. Keep request rates low.

If this saves you clicks, a star helps others find it.

Author

[Sepehr Radmard: open-source MCP servers for the Iranian web. LinkedIn: linkedin.com/in/sepehr-radmard]

Built and maintained by Sepehr Radmard (سپهر رادمرد). Connect on LinkedIn or follow @sepehr071 on GitHub for more MCP servers for Iranian websites, all listed in iran-mcp. If this saves you time, a star on the repo helps other people find it.

License

MIT

來源:README.md,提交 91cf8d3

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

7
  1. v0.3.0最新Nov 7, 2026
  2. v0.2.4Nov 3, 2026
  3. v0.2.3Nov 3, 2026
  4. v0.2.2Oct 23, 2026
  5. v0.2.1Oct 22, 2026
  6. v0.2.0Oct 18, 2026
  7. v0.1.0Oct 17, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分