Skip to main content
Glama

Ziroom MCP

This is a Ziroom rental MCP service: it supports both stateful listing filtering and session-free scraping of a single detail-page URL. When searching, the Agent makes consecutive tool calls within the same session_id, while the server keeps the browser page, filter state, version number, and rollback checkpoints.

Tools

  • create_search_session: Opens the corresponding Ziroom page for a city.

  • get_filter_schema: Reads the current fields, options, control types, and selected state.

  • search_location: Searches for a residential community, business district, or metro station.

  • select_filter_option: Selects a single-choice or multi-choice tag.

  • set_filter_range: Sets the rent range.

  • set_sort: Sets sorting by price, area, etc.

  • get_results: Returns listing names, URLs, all current conditions, and verification results.

  • get_listing_detail: Returns structured details and a Chinese Markdown report via a /x/{listing-id}.html URL.

  • restore_checkpoint: Restores the complete state from before an operation.

  • reset_filter: Resets a specified field entirely to its default value.

  • close_search_session: Closes the page and releases resources.

Related MCP server: mcp-tw-lvr

Installation

cd C:\path\to\ziroom-mcp
python -m venv .venv
.venv\Scripts\python.exe -m pip install -e ".[test]"

The service gives priority to Chrome or Edge already installed on Windows. If no browser is available, it installs Playwright Chromium:

.venv\Scripts\python.exe -m playwright install chromium

Detail scraping and search share the same Playwright browser process. Each get_listing_detail call creates a separate BrowserContext and closes it immediately after reading, so it does not pollute an existing search session. The price number sprite images are downloaded and decoded through the Playwright request context.

Startup

.venv\Scripts\ziroom-mcp.exe

The service uses stdio by default; logs must not be written to stdout.

Using Streamable HTTP:

$env:ZIROOM_TRANSPORT="streamable-http"
$env:ZIROOM_HOST="127.0.0.1"
$env:ZIROOM_PORT="8000"
.venv\Scripts\ziroom-mcp.exe

The HTTP MCP endpoint is http://127.0.0.1:8000/mcp and uses a JSON response mode compatible with Cloudflare Quick Tunnel.

When going through a reverse proxy that forwards the public Host, additionally set $env:ZIROOM_BEHIND_PROXY="1". Once enabled, keep ZIROOM_HOST=127.0.0.1 to avoid listening directly on the public network interface.

Ziroom currently returns an empty body to headless Chrome, so the service launches a visible browser by default. Enable headless mode only after confirming that the target page supports it:

$env:ZIROOM_HEADLESS="1"
.venv\Scripts\ziroom-mcp.exe

You can also specify the Chrome/Edge executable via ZIROOM_CHROME_PATH.

The same search session always reuses the same browser tab. After filter-link navigation, the service preserves existing query parameters, restores isOpen to 1, and then re-locates the next item; if the site still hides the target link in the DOM, it uses a DOM click as a fallback.

Agent Calling Conventions

When scraping a single detail page, call get_listing_detail directly once; there is no need to create or close a search session:

{
  "url": "https://wh.ziroom.com/x/123456.html",
  "timeout_seconds": 30,
  "retries": 4,
  "include_report": true
}

The return value includes listing_id, url, fetched_at, a structured listing, and optional report_markdown.

When filtering listings, follow this order:

  1. Call create_search_session.

  2. Call get_filter_schema and select only the tags currently returned by the page.

  3. location, area, and metro are mutually exclusive property search methods; keep only one. Build a fallback queue in the order location → area → metro. If the preferred option errors, is not retained, or returns zero results, confirm that the page has been restored before trying the next one.

  4. All modification tools use the same session_id and pass the state_version returned by the previous step.

  5. After each modification, check has_results.

  6. If it is false, call restore_checkpoint with the checkpoint returned this time, and set reason to empty_results.

  7. If it returns skipped=true and reason=page_did_not_retain_option, the page did not retain this tag and the tool has already restored the original state; do not call restore_checkpoint. Instead, refresh the schema and record it as unavailable, or retry a limited number of times according to business rules. Other modification tools correspondingly return reason=page_did_not_retain_change.

  8. Finally call get_results and verify all conditions that should be retained via expected_filters.

  9. After completing, call close_search_session.

Expected filter conflicts are not returned as tool errors. When the current page has no option, the option has already been applied, the page did not retain a change, or there is a location/area/metro conflict, the modification tool returns skipped=true and state_changed=false, keeping the original state_version and all selected conditions. The Agent should record the reason and continue to the next item. Real version conflicts, invalid sessions, site failures, and internal errors are still returned as tool errors.

Testing

All MCP tools have offline protocol-layer tests:

.venv\Scripts\python.exe -m pytest -m "not live" -v

The tests also start a stdio server subprocess that uses a fake web backend to verify MCP initialization, tool discovery, and tool invocation. ZIROOM_BACKEND=fake is for automated testing only.

Real-webpage smoke tests:

$env:ZIROOM_LIVE_TEST="1"
.venv\Scripts\python.exe -m pytest -m live -v

Available Tools

11 tools
close_search_sessionB

关闭搜索会话并释放对应的浏览器页面。

Inputs: session_id (required). Returns: object

create_search_sessionC

为支持的城市创建连续的自如浏览器搜索会话。

Inputs: city (required). Returns: object

get_filter_schemaB

读取当前页面的筛选字段、可选标签、已选值和状态版本。

Inputs: session_id (required). Returns: object

get_listing_detailA

抓取单个自如详情页 URL,返回结构化字段和可选中文 Markdown 报告。

Inputs: url (required), retries, include_report, timeout_seconds. Returns: object

get_resultsD

返回房源名称、URL、当前全部条件及最终条件验证结果。

Inputs: session_id (required), limit, expected_filters. Returns: object

reset_filterC

将指定字段整体恢复为默认值,不影响其他已选字段。

Inputs: field_id (required), session_id (required), expected_version. Returns: object

restore_checkpointC

恢复某次筛选操作前的完整状态;零结果时 reason 使用 empty_results。

Inputs: checkpoint (required), session_id (required), reason, expected_version. Returns: object

search_locationC

搜索一个小区、商圈或地铁站;多个用户答案应由 Agent 先选择一个。

Inputs: keyword (required), session_id (required), expected_version. Returns: object

select_filter_optionC

选择当前标签;页面未保留时返回 skipped=true,而不是工具错误。

Inputs: option (required), field_id (required), session_id (required), expected_version. Returns: object

set_filter_rangeB

设置租金等范围字段;当前页面实现支持 field_id=rent。

Inputs: field_id (required), session_id (required), maximum, minimum, +1 more. Returns: object

set_sortC

设置结果排序方式,例如价格或面积。

Inputs: option (required), session_id (required), expected_version. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 11 tools

    Disambiguation5/5

    每个工具都有明确的职责:会话管理(创建/关闭)、搜索(位置、筛选选项、范围、排序)、结果获取、详情抓取、状态恢复/重置。工具之间没有明显重叠,边界清晰,代理可以准确选择所需工具。

    Naming Consistency5/5

    所有工具名称均采用一致的动词_名词的snake_case模式,如create_search_session、get_filter_schema、select_filter_option等,命名风格统一,可预测性强。

    Tool Count5/5

    11个工具完整覆盖了浏览器搜索会话的整个生命周期,从创建、配置、执行到关闭,每个工具都有其存在的价值,数量合理,既不冗余也不单薄。

    Completeness4/5

    覆盖了搜索流程的主要环节:会话管理、位置搜索、筛选和排序、结果获取、详情查看、状态恢复和重置。缺少一些如取消特定筛选选项之类的边缘操作,但核心工作流完整,代理可以正常完成任务。

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server for searching and querying detailed housing listings in Taiwan, enabling AI to find properties with filters like city, district, room count, price, and age.
      2
      16 PyPI
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for querying Taiwan's real estate transaction registry via web scraping of the Ministry of the Interior's official portal. Enables natural language queries for real estate sales, rentals, and pre-sale housing data.
      1
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A remote MCP server that wraps the StreetEasy GraphQL API to enable LLM agents to search and parse NYC rental listings.
      4
      1
      MIT