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 filtering -
host_create- Create new hosts with interfaces and templates -
host_update- Update existing host configurations -
host_delete- Remove hosts from monitoring
-
hostgroup_get- Retrieve host groups -
hostgroup_create- Create new host groups -
hostgroup_update- Modify existing host groups -
hostgroup_delete- Remove host groups
-
item_get- Retrieve monitoring items with filtering -
item_create- Create new monitoring items -
item_update- Update existing items -
item_delete- Remove monitoring items
-
trigger_get- Retrieve triggers and alerts -
trigger_create- Create new triggers -
trigger_update- Modify existing triggers -
trigger_delete- Remove triggers
-
template_get- Retrieve monitoring templates -
template_create- Create new templates -
template_update- Update existing templates -
template_delete- Remove templates
-
problem_get- Retrieve current problems and issues -
event_get- Get historical events -
event_acknowledge- Acknowledge events and problems
-
history_get- Access historical monitoring data -
trend_get- Retrieve trend data and statistics
-
user_get- Retrieve user accounts -
user_create- Create new users -
user_update- Update user information -
user_delete- Remove user accounts
-
maintenance_get- Retrieve maintenance periods -
maintenance_create- Schedule maintenance windows -
maintenance_update- Modify maintenance periods -
maintenance_delete- Remove maintenance schedules
-
graph_get- Retrieve graph configurations -
discoveryrule_get- Get discovery rules -
itemprototype_get- Retrieve item prototypes -
configuration_export- Export Zabbix configurations -
configuration_import- Import configurations -
apiinfo_version- Get API version information
- Python 3.10 or higher
- uv package manager
- Access to a Zabbix server with API enabled
-
Clone 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 token
Method 2: Username/Password
-
ZABBIX_USER- Your Zabbix username -
ZABBIX_PASSWORD- Your Zabbix password
-
READ_ONLY- Set totrue,1, oryesto enable read-only mode (only GET operations allowed)
With startup script (recommended):
uv run python scripts/start_server.pyDirect execution:
uv run python src/zabbix_mcp_server.pyRun test suite:
uv run python scripts/test_server.pyWhen READ_ONLY=true, the server will only expose GET operations (retrieve data) and block all create, update, and delete operations. This is useful for:
- 📊 Monitoring dashboards
- 🔍 Read-only integrations
- 🔒 Security-conscious environments
- 🛡️ Preventing accidental modifications
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
)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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Test server functionality
uv run python scripts/test_server.py
# Test with Docker
docker-compose exec zabbix-mcp python scripts/test_server.pyThe server includes comprehensive error handling:
- ✅ Authentication errors are clearly reported
- 🔒 Read-only mode violations are blocked with descriptive messages
- ✔️ Invalid parameters are validated
- 🌐 Network and API errors are properly formatted
- 📝 Detailed logging for troubleshooting
- 🔑 Use API tokens instead of username/password when possible
- 🔒 Enable read-only mode for monitoring-only use cases
- 🛡️ Secure your environment variables
- 🔐 Use HTTPS for Zabbix server connections
- 🔄 Regularly rotate API tokens
- 📁 Store configuration files securely
Connection Failed:
- Verify
ZABBIX_URLis correct and accessible - Check authentication credentials
- Ensure Zabbix API is enabled
Permission Denied:
- Verify user has sufficient Zabbix permissions
- Check if read-only mode is enabled when trying to modify data
Tool Not Found:
- Ensure all dependencies are installed:
uv sync - Verify Python version compatibility (3.10+)
Set environment variable for detailed logging:
export DEBUG=1
uv run python scripts/start_server.py- FastMCP - MCP server framework
- python-zabbix-utils - Official Zabbix Python library
This project is licensed under the MIT License - see the LICENSE file for details.
- Zabbix for the monitoring platform
- Model Context Protocol for the integration standard
- FastMCP for the server framework
Made with ❤️ for the Zabbix and MCP communities