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. - hostget - Retrieve hosts with advanced filtering - hostcreate - Create new hosts with interfaces and templates - hostupdate - Update existing host configurations - hostdelete - Remove hosts
Add this skill
npx mdskills install mpeirone/zabbix-mcp-serverComprehensive MCP server exposing extensive Zabbix API operations with clear documentation and setup
1# Zabbix MCP Server23[](https://opensource.org/licenses/MIT)4[](https://www.python.org/downloads/)56A 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.78<a href="https://glama.ai/mcp/servers/@mpeirone/zabbix-mcp-server">9 <img width="380" height="200" src="https://glama.ai/mcp/servers/@mpeirone/zabbix-mcp-server/badge" alt="zabbix-mcp-server MCP server" />10</a>1112## Features1314### ๐ Host Management15- `host_get` - Retrieve hosts with advanced filtering16- `host_create` - Create new hosts with interfaces and templates17- `host_update` - Update existing host configurations18- `host_delete` - Remove hosts from monitoring1920### ๐ฅ Host Group Management21- `hostgroup_get` - Retrieve host groups22- `hostgroup_create` - Create new host groups23- `hostgroup_update` - Modify existing host groups24- `hostgroup_delete` - Remove host groups2526### ๐ Item Management27- `item_get` - Retrieve monitoring items with filtering28- `item_create` - Create new monitoring items29- `item_update` - Update existing items30- `item_delete` - Remove monitoring items3132### โ ๏ธ Trigger Management33- `trigger_get` - Retrieve triggers and alerts34- `trigger_create` - Create new triggers35- `trigger_update` - Modify existing triggers36- `trigger_delete` - Remove triggers3738### ๐ Template Management39- `template_get` - Retrieve monitoring templates40- `template_create` - Create new templates41- `template_update` - Update existing templates42- `template_delete` - Remove templates4344### ๐จ Problem & Event Management45- `problem_get` - Retrieve current problems and issues46- `event_get` - Get historical events47- `event_acknowledge` - Acknowledge events and problems4849### ๐ Data Retrieval50- `history_get` - Access historical monitoring data51- `trend_get` - Retrieve trend data and statistics5253### ๐ค User Management54- `user_get` - Retrieve user accounts55- `user_create` - Create new users56- `user_update` - Update user information57- `user_delete` - Remove user accounts5859### ๐ Proxy Management60- `proxy_get` - Retrieve Zabbix proxies with filtering61- `proxy_create` - Create new proxies62- `proxy_update` - Update existing proxies63- `proxy_delete` - Remove proxies6465### ๐ง Maintenance Management66- `maintenance_get` - Retrieve maintenance periods67- `maintenance_create` - Schedule maintenance windows68- `maintenance_update` - Modify maintenance periods69- `maintenance_delete` - Remove maintenance schedules7071### ๐ Additional Features72- `graph_get` - Retrieve graph configurations73- `discoveryrule_get` - Get discovery rules74- `itemprototype_get` - Retrieve item prototypes75- `configuration_export` - Export Zabbix configurations76- `configuration_import` - Import configurations77- `apiinfo_version` - Get API version information7879## Installation8081### Prerequisites8283- Python 3.10 or higher84- [uv](https://docs.astral.sh/uv/) package manager85- Access to a Zabbix server with API enabled8687### Quick Start88891. **Clone the repository:**90 ```bash91 git clone https://github.com/mpeirone/zabbix-mcp-server.git92 cd zabbix-mcp-server93 ```94952. **Install dependencies:**96 ```bash97 uv sync98 ```991003. **Configure environment variables:**101 ```bash102 cp config/.env.example .env103 # Edit .env with your Zabbix server details104 ```1051064. **Test the installation:**107 ```bash108 uv run python scripts/test_server.py109 ```110111## Configuration112113### Required Environment Variables114115- `ZABBIX_URL` - Your Zabbix server API endpoint (e.g., `https://zabbix.example.com`)116117### Authentication (choose one method)118119**Method 1: API Token (Recommended)**120- `ZABBIX_TOKEN` - Your Zabbix API token121122**Method 2: Username/Password**123- `ZABBIX_USER` - Your Zabbix username124- `ZABBIX_PASSWORD` - Your Zabbix password125126### Optional Configuration127128- `READ_ONLY` - Set to `true`, `1`, or `yes` to enable read-only mode (only GET operations allowed)129- `VERIFY_SSL` - Enable/disable SSL certificate verification (default: `true`)130131### Transport Configuration132133- `ZABBIX_MCP_TRANSPORT` - Transport type: `stdio` (default) or `streamable-http`134135**HTTP Transport Configuration** (only used when `ZABBIX_MCP_TRANSPORT=streamable-http`):136- `ZABBIX_MCP_HOST` - Server host (default: `127.0.0.1`)137- `ZABBIX_MCP_PORT` - Server port (default: `8000`)138- `ZABBIX_MCP_STATELESS_HTTP` - Stateless mode (default: `false`)139- `AUTH_TYPE` - Must be set to `no-auth` for streamable-http transport140141## Usage142143### Running the Server144145**With startup script (recommended):**146```bash147uv run python scripts/start_server.py148```149150**Direct execution:**151```bash152uv run python src/zabbix_mcp_server.py153```154155### Transport Options156157The server supports two transport methods:158159#### STDIO Transport (Default)160Standard input/output transport for MCP clients like Claude Desktop:161```bash162# Set in .env or environment163ZABBIX_MCP_TRANSPORT=stdio164```165166#### HTTP Transport167HTTP-based transport for web integrations:168```bash169# Set in .env or environment170ZABBIX_MCP_TRANSPORT=streamable-http171ZABBIX_MCP_HOST=127.0.0.1172ZABBIX_MCP_PORT=8000173ZABBIX_MCP_STATELESS_HTTP=false174AUTH_TYPE=no-auth175```176177**Note:** When using `streamable-http` transport, `AUTH_TYPE` must be set to `no-auth`.178179### Testing180181**Run test suite:**182```bash183uv run python scripts/test_server.py184```185186### Read-Only Mode187188When `READ_ONLY=true`, the server will only expose GET operations (retrieve data) and block all create, update, and delete operations. This is useful for:189190- ๐ Monitoring dashboards191- ๐ Read-only integrations192- ๐ Security-conscious environments193- ๐ก๏ธ Preventing accidental modifications194195### Example Tool Calls196197**Get all hosts:**198```python199host_get()200```201202**Get hosts in specific group:**203```python204host_get(groupids=["1"])205```206207**Create a new host:**208```python209host_create(210 host="server-01",211 groups=[{"groupid": "1"}],212 interfaces=[{213 "type": 1,214 "main": 1,215 "useip": 1,216 "ip": "192.168.1.100",217 "dns": "",218 "port": "10050"219 }]220)221```222223**Get recent problems:**224```python225problem_get(recent=True, limit=10)226```227228**Get history data:**229```python230history_get(231 itemids=["12345"],232 time_from=1640995200,233 limit=100234)235```236237**Get all proxies:**238```python239proxy_get()240```241242**Create a new active proxy:**243```python244proxy_create(245 host="proxy-01",246 status=5,247 description="Main datacenter proxy"248)249```250251## MCP Integration252253This server is designed to work with MCP-compatible clients like Claude Desktop. See [MCP_SETUP.md](MCP_SETUP.md) for detailed integration instructions.254255## Docker Support256257### Using Docker Compose2582591. **Configure environment:**260 ```bash261 cp config/.env.example .env262 # Edit .env with your settings263 ```2642652. **Run with Docker Compose:**266 ```bash267 docker compose up -d268 ```269270### Building Docker Image271272```bash273docker build -t zabbix-mcp-server .274```275276## Development277278### Project Structure279280```281zabbix-mcp-server/282โโโ src/283โ โโโ zabbix_mcp_server.py # Main server implementation284โโโ scripts/285โ โโโ start_server.py # Startup script with validation286โ โโโ test_server.py # Test script287โโโ config/288โ โโโ .env.example # Environment configuration template289โ โโโ mcp.json # MCP client configuration example290โโโ pyproject.toml # Python project configuration291โโโ requirements.txt # Dependencies292โโโ Dockerfile # Docker configuration293โโโ docker-compose.yml # Docker Compose setup294โโโ README.md # This file295โโโ MCP_SETUP.md # MCP integration guide296โโโ CONTRIBUTING.md # Contribution guidelines297โโโ CHANGELOG.md # Version history298โโโ LICENSE # MIT license299```300301### Contributing3023031. Fork the repository3042. Create a feature branch (`git checkout -b feature/amazing-feature`)3053. Commit your changes (`git commit -m 'Add amazing feature'`)3064. Push to the branch (`git push origin feature/amazing-feature`)3075. Open a Pull Request308309### Running Tests310311```bash312# Test server functionality313uv run python scripts/test_server.py314315# Test with Docker316docker-compose exec zabbix-mcp python scripts/test_server.py317```318319## Error Handling320321The server includes comprehensive error handling:322323- โ Authentication errors are clearly reported324- ๐ Read-only mode violations are blocked with descriptive messages325- โ๏ธ Invalid parameters are validated326- ๐ Network and API errors are properly formatted327- ๐ Detailed logging for troubleshooting328329## Security Considerations330331- ๐ Use API tokens instead of username/password when possible332- ๐ Enable read-only mode for monitoring-only use cases333- ๐ก๏ธ Secure your environment variables334- ๐ Use HTTPS for Zabbix server connections335- ๐ Regularly rotate API tokens336- ๐ Store configuration files securely337338## Troubleshooting339340### Common Issues341342**Connection Failed:**343- Verify `ZABBIX_URL` is correct and accessible344- Check authentication credentials345- Ensure Zabbix API is enabled346347**Permission Denied:**348- Verify user has sufficient Zabbix permissions349- Check if read-only mode is enabled when trying to modify data350351**Tool Not Found:**352- Ensure all dependencies are installed: `uv sync`353- Verify Python version compatibility (3.10+)354355### Debug Mode356357Set environment variable for detailed logging:358```bash359export DEBUG=1360uv run python scripts/start_server.py361```362363## Dependencies364365- [FastMCP](https://github.com/jlowin/fastmcp) - MCP server framework366- [python-zabbix-utils](https://github.com/zabbix/python-zabbix-utils) - Official Zabbix Python library367368## License369370This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.371372## Acknowledgments373374- [Zabbix](https://www.zabbix.com/) for the monitoring platform375- [Model Context Protocol](https://modelcontextprotocol.io/) for the integration standard376- [FastMCP](https://github.com/jlowin/fastmcp) for the server framework377378## Support379380- ๐ [Documentation](README.md)381- ๐ [Issue Tracker](https://github.com/mpeirone/zabbix-mcp-server/issues)382- ๐ฌ [Discussions](https://github.com/mpeirone/zabbix-mcp-server/discussions)383384---385386**Made with โค๏ธ for the Zabbix and MCP communities**
Full transparency โ inspect the skill content before installing.