
Zabbix API MCP
io.github.shigechika由 GitHub 帳號 shigechika 發布v0.14.0更新於 Oct 24, 2026
MCP server for the Zabbix API — daily brief, problems, hosts, items
概覽
面向 Zabbix API 的 MCP 伺服器,讓助理取得每日維運簡報、作用中告警、主機、監控項目數值與維護視窗。
- 可以做什麼
- 檢查連線狀態、Zabbix 與 API 版本以及已設定的簡報分類
- 產生每日簡報:作用中告警、維護中的主機以及站台自訂分類
- 依嚴重程度與標籤查詢作用中告警,依角色、標籤或主機群組列出主機
- 讀取某台主機目前的監控項目數值,列出維護視窗
- 確認告警並附加訊息、建立維護視窗(寫入工具,可關閉)
- 適用情境
- 適合網路維運團隊讓助理分流 Zabbix 告警、產生晨間巡檢摘要,或在排查時查詢主機與監控項目數值,而不必開啟 Zabbix 前端。
- 執行需求
- 以 Python 套件(pip 或 uv)在本機透過 stdio 執行。需要 ZABBIX_URL,以及 ZABBIX_API_TOKEN 或 ZABBIX_USER 加 ZABBIX_PASSWORD 其中之一;可選 ZABBIX_CATEGORIES_INI、ZABBIX_BRIEF_RECENT_HOURS、ZABBIX_BRIEF_PROBLEM_LIMIT 與 ZABBIX_READ_ONLY。Zabbix API 使用者需對查詢的主機群組有讀取權限,使用寫入工具還需確認權限或維護寫入權限。需要能連線到 Zabbix 伺服器的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Zabbix API MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
zapi-mcp
English | 日本語
MCP (Model Context Protocol) server for the Zabbix API.
Built for network operations: a single daily_brief call summarizes active
problems plus site-specific categories (DHCP pool usage, SNAT session usage,
core-network problems, …), and individual tools query problems, hosts, and item
values. Organization-specific tags live in a config file, not the code, so the
server stays generic.
Version-adaptive auth: works against Zabbix 6.0 LTS (user + auth field) and
forward-compatible with 6.4 / 7.0 (username + Authorization: Bearer).
Documentation: https://shigechika.github.io/zapi-mcp/
Features
Setup
Or from source:
Configuration
Set the following environment variables:
The API user needs read permission for the host groups you query, plus
acknowledge permission if you use acknowledge_problem, maintenance-write
permission if you use set_maintenance, and maintenance-read permission
(usually included by default) for get_maintenance_windows and the
daily_brief "In Maintenance" section.
Authenticate with either ZABBIX_API_TOKEN or ZABBIX_USER + ZABBIX_PASSWORD. When a
token is set, a leftover ZABBIX_USER is ignored; a token together with both
ZABBIX_USER and ZABBIX_PASSWORD is a configuration error. A token needs no login and
keeps a password out of the client configuration; it can be given an expiry and
revoked on its own on Zabbix's API tokens page.
Active problems in daily_brief
Problems are grouped by severity and listed newest-first, each annotated with
its age (e.g. 3h ago). Problems older than the recent window
(ZABBIX_BRIEF_RECENT_HOURS, default 24h) are folded to a single
… and N older (stale; oldest …) line — so a backlog of alerts that Zabbix
keeps active because their recovery is never auto-confirmed (ICMP ping down, RDP
down, …) doesn't bury what just happened. Section headers carry the true total
and show showing N of TOTAL when the fetch is capped, never a silent truncation.
Maintenance windows in daily_brief
Right after Active Problems, daily_brief lists hosts covered by a
maintenance window that's active now, plus any window starting later today —
so a planned outage isn't mistaken for a new incident by whatever else is
watching those hosts. The ## In Maintenance section is omitted entirely
when there's nothing to show (no news is no maintenance). Windows starting
tomorrow or later, and expired windows, aren't included here; call
get_maintenance_windows (optionally with include_expired=True) for the
full picture.
Categories for daily_brief (optional)
daily_brief always lists active problems. To add site-specific sections —
DHCP pool exhaustion, SNAT session usage, core-network problems — point
ZABBIX_CATEGORIES_INI at an INI file. Each [section] is one category:
tag(required): host tag identifying the category. Withtag_value, the tag must equal it (Equal); without, any host carrying the tag matches (Exists).item_key/item_key_search: when either is set, the section reports current item values sorted high-to-low.item_keymatches the key exactly; useitem_key_searchfor keys that embed an id (e.g..usagecatchespool.node0.usage). When neither is set, it reports active problems for the tag.threshold: optional; values at or above it are flagged.
See categories.ini.example. When the variable is
unset or the file is missing, daily_brief reports active problems only.
Write operations
Two tools change state. Everything else only reads.
acknowledge_problem needs acknowledge permission on the API user;
set_maintenance needs maintenance-write permission. Leave either off and
the server stays read-only for that one tool: the call fails against the
Zabbix API and every other tool keeps working, so an API user can be handed
to an AI assistant for investigation without granting it any ability to change Zabbix
configuration. Grant the permission only when acknowledging alerts or opening
maintenance windows through the assistant is part of the job.
To keep the write tools away from the model altogether, set
ZABBIX_READ_ONLY=true: the two tools are not registered, so a client never
sees them, and they refuse to run if called anyway. This lets one Zabbix user
serve both a read-only and a write-enabled MCP client. Every tool also carries
MCP tool annotations (readOnlyHint, destructiveHint, idempotentHint), so a
client can tell read and write tools apart.
Usage
Claude Code (plugin)
This repository doubles as a single-plugin marketplace, so Claude Code can install the server for you:
The plugin launches uvx zapi-mcp and reads the same environment variables
described in Configuration; export them before starting
Claude Code. ZABBIX_CATEGORIES_INI may stay unset.
uvx must be on the PATH of the process that runs Claude Code — a login
shell usually has it, but a GUI-launched app may not; install
uv system-wide if the plugin fails to start.
Claude Code (manual)
Add to .mcp.json:
Claude Desktop
Add to claude_desktop_config.json:
Codex
Any other MCP client that launches stdio servers works the same way: give it
zapi-mcp as the command and set the ZABBIX_* variables in its environment.
Direct Execution
CLI Options
--check exit codes: 0 success, 1 config error, 2 auth/connection error.
--brief exit codes: 0 success, 1 a section failed (auth, the active-problems
fetch, or category loading — see the embedded Error: line in the output).
Development
Live smoke test
pytest checks logic against fixtures; it cannot tell you that a tool has
stopped returning real data. scripts/smoke_test.py runs every registered
tool against the configured Zabbix and fails on empty, malformed or error
answers:
- Read-only.
acknowledge_problemandset_maintenanceare skipped by name — an acknowledgement is visible to every operator and cannot be quietly undone, andset_maintenanceopens a real maintenance window that suppresses alerts — and a test enforces that. The report prints tool names and statuses only, never payloads; server-authored error text is redacted too, since Zabbix quotes the host it was asked about.--tracebackstill shows the full text on the operator's own terminal. - Arguments that would identify real hosts, groups or tag values are
discovered at run time, never written into
scripts/smoke_probes.py. Two tests enforce that: one refuses those parameters as literals, the other bans anything address-shaped (mail address, URL, hostname, IPv4, IPv6) anywhere in the file. - An empty answer is a real observation here — a monitoring system with nothing wrong is the goal — so probes assert the envelope the tool must produce rather than a row count.
- CI enforces the cheap half: a tool registered without a probe spec fails the
build (
tests/test_smoke_probes.py), so adding a tool forces the question "how would we know it works?". scripts/smoke_harness.pyis the engine and holds no Zabbix knowledge: it is kept identical across the servers that share it, so fix engine bugs once and sync the file rather than patching this copy.
Releasing
Releases are automated with release-please.
Merging Conventional Commits (feat:, fix:, …)
to main keeps a release PR open with the next version and changelog. Merging
that PR tags vX.Y.Z and publishes a GitHub Release, whose release: published
event triggers the release workflow to build and publish to PyPI and the MCP
Registry. release-please owns the version in zapi_mcp/__init__.py and
server.json (do not bump them by hand).
[!IMPORTANT] The release-please workflow should be given a repository secret
RELEASE_PLEASE_TOKEN(a PAT withcontents: write+pull-requests: write). The defaultGITHUB_TOKENcannot create the Release that triggers the downstreamreleaseworkflow (GitHub blocks workflow runs triggered byGITHUB_TOKEN), so without the PAT nothing gets published. The workflow falls back toGITHUB_TOKENwhen the secret is unset so PR CI keeps working on forks.
Roadmap
- Streamable HTTP transport + OAuth2 for remote / mobile use
- Visual rendering of key metrics
License
MIT
來源:README.md,提交 67e5402
工具
0版本歷史
4- v0.14.0最新Oct 18, 2026
- v0.13.0Oct 14, 2026
- v0.12.0Sep 29, 2026
- v0.11.0Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分