
Zigbee2mqtt Mcp
io.github.alexpfau由 GitHub 帳號 alexpfau 發布v0.7.0更新於 Oct 24, 2026
Administer a Zigbee2MQTT estate: health, mesh diagnostics, OTA, pairing, device management.
概覽
讓助理透過 MQTT 管理 Zigbee2MQTT 網路:網狀健康、鏈路品質、配對、綁定、回報設定與韌體更新。
- 可以做什麼
- 直接與 Zigbee2MQTT 的 MQTT 橋接 API 通訊,因此無論是否使用 Home Assistant 都能運作。讀取類工具涵蓋代理連線狀態、橋接資訊、裝置清單與詳情、全網健康報告、含孤立節點偵測的網狀拓撲、群組、橋接日誌,以及協調器記憶體檢查。寫入類工具分層開放:safe 模式增加配對、裝置選項、重新命名、設定、interview、綁定、回報、群組與狀態設定;full 模式再加入裝置移除、OTA 刷寫、Touchlink 與橋接重啟。
- 適用情境
- 當你需要裝置控制之下的那一層時使用:弱鏈路、反覆重新入網的裝置、電量將盡的電池、interview 狀態、OTA 可用性、permit_join 視窗、綁定與回報間隔。如果只是要讓助理開關 Home Assistant 已曝露的燈,則不需要它。
- 執行需求
- 透過 npx 以 stdio 在本機執行;需要 Node.js 22 或更新版本,並能連線到 Zigbee2MQTT 所用的 MQTT 代理。必須提供 Z2M_MQTT_URL,且應指向代理而非 Zigbee2MQTT 前端埠。選用:代理需要驗證時使用 Z2M_MQTT_USERNAME 與 Z2M_MQTT_PASSWORD,與 mqtt.base_topic 一致的 Z2M_BASE_TOPIC,TLS 素材路徑,以及 Z2M_WRITE_MODE。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Zigbee2mqtt Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
zigbee2mqtt-mcp
[CI] [npm version] [License: MIT] [zigbee2mqtt-mcp MCP server] [Zigbee2MQTT MCP on mcprush]
A Model Context Protocol server for administering a Zigbee2MQTT estate.
Most Zigbee integrations already let an assistant turn a light on. This one is for the layer underneath: mesh health, weak links, devices that keep rejoining, stale batteries, firmware updates, pairing, binding, reporting intervals and device options — the things you normally open the Zigbee2MQTT frontend for.
It talks directly to the Zigbee2MQTT MQTT bridge API, so it works regardless of whether you use Home Assistant, Node-RED, openHAB or nothing at all. Tested against Zigbee2MQTT 2.x; several tools depend on bridge endpoints that only exist there, including bridge/health, device/binds/clear and the OTA scheduling topics.
Why this exists
If you already run Home Assistant, your Zigbee devices are exposed there and an assistant can control them. What Home Assistant does not expose is the bridge itself: link quality, mesh topology, interview state, OTA availability, permit_join, device options, bindings and reporting configuration. This server fills exactly that gap.
Design
- No database. Zigbee2MQTT publishes its bridge topics as retained messages, so a fresh subscription yields a complete picture in a few hundred milliseconds. The server keeps only the latest payload per topic in memory.
- No daemon. Pure stdio. It starts and dies with the MCP session.
- Correlated requests. Every
bridge/request/*carries atransactionid and is matched to itsbridge/response/*, so concurrent calls cannot cross wires. - Tiered writes. Destructive operations are gated behind a write mode and an explicit
confirmargument.
Install
Requires Node.js 22 or newer and network access to the MQTT broker that Zigbee2MQTT uses.
VS Code / GitHub Copilot
Add to your MCP configuration:
Claude Desktop
Point
Z2M_MQTT_URLat your MQTT broker, not at the Zigbee2MQTT frontend port. If Zigbee2MQTT'sconfiguration.yamlsaysmqtt.server: mqtt://192.168.1.10:1883, use that value verbatim.
Behind a corporate npm proxy? If
npm config get registryis nothttps://registry.npmjs.org/, your proxy's upstream feed may not carry this package. Add an explicit override to the args rather than changing your global registry:"args": ["-y", "--registry", "https://registry.npmjs.org/", "zigbee2mqtt-mcp"]
Configuration
Write modes
Tools above the active tier are not registered at all, so a model cannot reach for them.
Irreversible tools (z2m_remove_device, z2m_ota_update, z2m_touchlink, z2m_restart_bridge, z2m_set_bridge_options) additionally require confirm: true on every call. Three safe tools reduce state rather than only adding to it, so they are annotated destructive: z2m_rename_device, z2m_manage_group and z2m_bind. Their reducing actions also require confirm: true — z2m_manage_group (remove, remove_all_members) and z2m_bind (clear). z2m_rename_device is annotated destructive because it breaks anything referencing the old name, but stays unconfirmed since renaming back restores it.
Every tool also advertises MCP tool annotations so a client can decide what may run without prompting:
Annotations describe the tool, not the tier: a safe tool can still be destructive. The tier decides what is registered, the annotation tells the client what to ask about.
Opt in to the destructive tier only when you want it:
Tools
Read
Safe writes
z2m_check_updates, z2m_permit_join, z2m_set_device_options, z2m_rename_device, z2m_configure_device, z2m_interview_device, z2m_set_state, z2m_manage_group, z2m_bind, z2m_configure_reporting
Full writes
z2m_remove_device, z2m_ota_update, z2m_restart_bridge, z2m_set_bridge_options, z2m_touchlink
Data availability caveats
Some fields depend on your Zigbee2MQTT configuration. The server detects what is available and tells you rather than silently returning nothing.
Security notes
- The broker URL may carry credentials (
mqtt://user:pass@host). They are redacted everywhere the URL is echoed back to a model or written to a log, and error text from the MQTT client is scrubbed before it leaves the process. Zigbee2MQTT logs its own broker URL at startup, so lines relayed byz2m_get_logsare scrubbed too. safemode can actuate anything on the mesh viaz2m_set_state, including locks, valves and sirens. Useoffif that matters.z2m_permit_joinopens the network to any nearby Zigbee device for the duration of the window. It is insafebecause it is routine and reversible, but it is a security boundary.
Example prompts
- "Is my Zigbee network healthy?"
- "Which devices have the weakest signal?"
- "Which batteries need replacing?"
- "Any firmware updates available?"
- "Open the network for pairing via the kitchen router for two minutes."
- "This sensor stopped reporting temperature — fix it."
- "Bind the hallway remote to the hallway light so it works if the bridge is down."
Development
Note that an MCP server may receive requests concurrently. When testing ordering,
await each response before sending the next, as roundtrip.mjs does — piping
several requests at once will produce misleading results.
The unit tests cover health classification, capability detection, topic routing,
write-mode gating and configuration parsing. They are broker-free by design, so
anything that needs a live mesh belongs in scripts/ instead.
A passing suite only proves the tests ran, so scripts/mutate.mjs breaks the
source one change at a time and checks the suite notices each one:
A surviving mutant marks behavior nothing actually tests, and exits non-zero. Add a mutant alongside any fix worth keeping fixed.
Releases are tag-driven: npm version <patch|minor|major> then
git push --follow-tags. CI publishes to npm with provenance, rewrites
server.json's version from the tag and publishes to the MCP Registry, then
creates the GitHub release. The version committed in server.json is therefore
not authoritative — the tag is.
Safety
This server can remove devices from your network and flash firmware. Both are irreversible and OTA failures can brick hardware. Those tools live in the full tier, which is not enabled by default — you must opt in with Z2M_WRITE_MODE=full. Broker credentials are read from the environment and never logged.
Status
Early release. Developed and tested against a 50-device EmberZNet estate on Zigbee2MQTT 2.12.x. Other adapters (Texas Instruments, deCONZ/ConBee, zStack), TLS and WebSocket brokers, and large estates are unverified. Bug reports and pull requests are very welcome — please include your adapter type and Zigbee2MQTT version from z2m_bridge_info.
License
MIT
來源:README.md,提交 3957aa6
工具
0版本歷史
1- v0.7.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分