Zabbix
STDIO全面的Zabbix API集成监控管理工具
全面的Zabbix API集成监控管理工具
A comprehensive Model Context Protocol (MCP) server for Zabbix integration using FastMCP and python-zabbix-utils. This server provides complete access to Zabbix API functionality through MCP-compatible tools.
host_get - Retrieve hosts with advanced filteringhost_create - Create new hosts with interfaces and templateshost_update - Update existing host configurationshost_delete - Remove hosts from monitoringhostgroup_get - Retrieve host groupshostgroup_create - Create new host groupshostgroup_update - Modify existing host groupshostgroup_delete - Remove host groupsitem_get - Retrieve monitoring items with filteringitem_create - Create new monitoring itemsitem_update - Update existing itemsitem_delete - Remove monitoring itemstrigger_get - Retrieve triggers and alertstrigger_create - Create new triggerstrigger_update - Modify existing triggerstrigger_delete - Remove triggerstemplate_get - Retrieve monitoring templatestemplate_create - Create new templatestemplate_update - Update existing templatestemplate_delete - Remove templatesproblem_get - Retrieve current problems and issuesevent_get - Get historical eventsevent_acknowledge - Acknowledge events and problemshistory_get - Access historical monitoring datatrend_get - Retrieve trend data and statisticsuser_get - Retrieve user accountsuser_create - Create new usersuser_update - Update user informationuser_delete - Remove user accountsproxy_get - Retrieve Zabbix proxies with filteringproxy_create - Create new proxiesproxy_update - Update existing proxiesproxy_delete - Remove proxiesmaintenance_get - Retrieve maintenance periodsmaintenance_create - Schedule maintenance windowsmaintenance_update - Modify maintenance periodsmaintenance_delete - Remove maintenance schedulesgraph_get - Retrieve graph configurationsdiscoveryrule_get - Get discovery rulesitemprototype_get - Retrieve item prototypesconfiguration_export - Export Zabbix configurationsconfiguration_import - Import configurationsapiinfo_version - Get API version informationClone the repository:
git clone https://github.com/mpeirone/zabbix-mcp-server.git cd zabbix-mcp-server
Install dependencies:
uv sync
Configure environment variables:
cp config/.env.example .env # Edit .env with your Zabbix server details
Test the installation:
uv run python scripts/test_server.py
ZABBIX_URL - Your Zabbix server API endpoint (e.g., https://zabbix.example.com)Method 1: API Token (Recommended)
ZABBIX_TOKEN - Your Zabbix API tokenMethod 2: Username/Password
ZABBIX_USER - Your Zabbix usernameZABBIX_PASSWORD - Your Zabbix passwordREAD_ONLY - Set to true, 1, or yes to enable read-only mode (only GET operations allowed)VERIFY_SSL - Enable/disable SSL certificate verification (default: true)ZABBIX_MCP_TRANSPORT - Transport type: stdio (default) or streamable-httpHTTP Transport Configuration (only used when ZABBIX_MCP_TRANSPORT=streamable-http):
ZABBIX_MCP_HOST - Server host (default: 127.0.0.1)ZABBIX_MCP_PORT - Server port (default: 8000)ZABBIX_MCP_STATELESS_HTTP - Stateless mode (default: false)AUTH_TYPE - Must be set to no-auth for streamable-http transportWith startup script (recommended):
uv run python scripts/start_server.py
Direct execution:
uv run python src/zabbix_mcp_server.py
The server supports two transport methods:
Standard input/output transport for MCP clients like Claude Desktop:
# Set in .env or environment ZABBIX_MCP_TRANSPORT=stdio
HTTP-based transport for web integrations:
# Set in .env or environment ZABBIX_MCP_TRANSPORT=streamable-http ZABBIX_MCP_HOST=127.0.0.1 ZABBIX_MCP_PORT=8000 ZABBIX_MCP_STATELESS_HTTP=false AUTH_TYPE=no-auth
Note: When using streamable-http transport, AUTH_TYPE must be set to no-auth.
Run test suite:
uv run python scripts/test_server.py
When READ_ONLY=true, the server will only expose GET operations (retrieve data) and block all create, update, and delete operations. This is useful for:
Get all hosts:
host_get()
Get hosts in specific group:
host_get(groupids=["1"])
Create a new host:
host_create( host="server-01", groups=[{"groupid": "1"}], interfaces=[{ "type": 1, "main": 1, "useip": 1, "ip": "192.168.1.100", "dns": "", "port": "10050" }] )
Get recent problems:
problem_get(recent=True, limit=10)
Get history data:
history_get( itemids=["12345"], time_from=1640995200, limit=100 )
Get all proxies:
proxy_get()
Create a new active proxy:
proxy_create( host="proxy-01", status=5, description="Main datacenter proxy" )
This server is designed to work with MCP-compatible clients like Claude Desktop. See MCP_SETUP.md for detailed integration instructions.
Configure environment:
cp config/.env.example .env # Edit .env with your settings
Run with Docker Compose:
docker compose up -d
docker build -t zabbix-mcp-server .
zabbix-mcp-server/
├── src/
│   └── zabbix_mcp_server.py    # Main server implementation
├── scripts/
│   ├── start_server.py         # Startup script with validation
│   └── test_server.py          # Test script
├── config/
│   ├── .env.example           # Environment configuration template
│   └── mcp.json               # MCP client configuration example
├── pyproject.toml             # Python project configuration
├── requirements.txt           # Dependencies
├── Dockerfile                 # Docker configuration
├── docker-compose.yml         # Docker Compose setup
├── README.md                  # This file
├── MCP_SETUP.md              # MCP integration guide
├── CONTRIBUTING.md           # Contribution guidelines
├── CHANGELOG.md              # Version history
└── LICENSE                   # MIT license
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)# Test server functionality uv run python scripts/test_server.py # Test with Docker docker-compose exec zabbix-mcp python scripts/test_server.py
The server includes comprehensive error handling:
Connection Failed:
ZABBIX_URL is correct and accessiblePermission Denied:
Tool Not Found:
uv syncSet environment variable for detailed logging:
export DEBUG=1 uv run python scripts/start_server.py
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for the Zabbix and MCP communities