
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 分