Wazuh MCP Server
Enables AI assistants to query Wazuh security alerts, investigate hosts, detect brute-force attempts, and generate security summaries by connecting to a Wazuh manager.
README
Wazuh MCP Server
A Python-based Model Context Protocol (MCP) server that exposes Wazuh security alerts and agent data to Claude Desktop and other AI assistants.
What This Does
This server connects to your Wazuh manager and provides Claude with 4 security tools:
| Tool | Purpose | Example |
|---|---|---|
| critical_alerts | Get critical security events | "Show all critical alerts from today" |
| investigate_host | Deep dive into a specific system | "Investigate host web-server-01" |
| brute_force_detection | Find login attack attempts | "Which user failed authentication 20 times?" |
| security_summary | High-level overview | "Give me a security summary" |
Quick Start (5 minutes)
1. Prerequisites
- Python 3.8+
- Wazuh manager running and accessible
- Claude Desktop installed
- Wazuh manager credentials (default:
wazuh/wazuh)
2. Setup
# Clone or download this project
cd wazuh-mcp-server
# Run setup script
chmod +x setup.sh
./setup.sh
# Edit configuration
nano .env
# Update WAZUH_HOST to your Wazuh manager IP
3. Test Connection
# Activate environment
source venv/bin/activate
# Run connection test
python3 test_connection.py
You should see:
✓ Connected successfully!
✓ Found 5 agent(s)
✓ Found 23 alert(s)
✅ All tests passed!
4. Connect to Claude Desktop
Edit ~/.claude/claude_desktop_config.json:
macOS/Linux:
nano ~/.claude/claude_desktop_config.json
Windows:
notepad %APPDATA%\Claude\claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"wazuh": {
"command": "/absolute/path/to/venv/bin/python",
"args": ["/absolute/path/to/wazuh_mcp_server/server.py"],
"env": {
"WAZUH_HOST": "YOUR_WAZUH_IP",
"WAZUH_USER": "wazuh",
"WAZUH_PASS": "wazuh"
}
}
}
}
Get absolute paths:
# Python path
which python3
# /Users/yourname/wazuh-mcp-server/venv/bin/python3
# Server path
pwd
# /Users/yourname/wazuh-mcp-server
5. Restart Claude Desktop
Close and reopen Claude Desktop. You should see "Wazuh Security Tools" in the Tools panel.
6. Try It Out
In Claude Desktop, try:
Show all critical alerts from the last 24 hours
Which hosts are experiencing high alert rates?
Investigate the database server
Detect any brute force attempts
Project Structure
wazuh-mcp-server/
├── server.py # Main MCP server (FastMCP)
├── wazuh_client.py # Wazuh API client
├── requirements.txt # Python dependencies
├── .env.example # Configuration template
├── setup.sh # Automated setup script
├── test_connection.py # Connection verification
└── README.md # This file
Configuration
Edit .env to customize:
WAZUH_HOST=192.168.1.100 # Your Wazuh manager IP
WAZUH_USER=wazuh # API username
WAZUH_PASS=wazuh # API password
Troubleshooting
"Connection refused" or "Network error"
# Check Wazuh manager is running
ssh user@wazuh-ip
sudo systemctl status wazuh-manager
# Verify API port is open
curl -k https://YOUR_WAZUH_IP:55000/security/user/authenticate \
-u wazuh:wazuh
Claude Desktop doesn't show the tools
-
Check config syntax:
python3 -c "import json; json.load(open(expanduser('~/.claude/claude_desktop_config.json')))" # Should return no errors -
Check absolute paths:
- Don't use
~/or.in the config - Use full paths like
/Users/name/...
- Don't use
-
Check logs:
tail -f ~/Library/Logs/Claude/mcp-server.log # macOS # or check Windows Event Viewer for Claude Desktop -
Restart Claude Desktop:
- Close completely
- Reopen
- Wait 5 seconds for MCP to connect
"Authentication failed"
# Verify credentials by testing directly
curl -k https://WAZUH_IP:55000/security/user/authenticate \
-u wazuh:wazuh -X GET
# If 401: wrong credentials
# If 404: endpoint doesn't exist (Wazuh version issue)
# If timeout: firewall blocking
Advanced
Custom Wazuh Queries
The wazuh_client.py supports arbitrary queries:
from wazuh_client import WazuhClient
wazuh = WazuhClient("192.168.1.100")
# Search by rule group
alerts = wazuh.search_logs("rule.group=auth_failure")
# Search by agent
alerts = wazuh.search_logs("agent.name=web-server")
# Search by source IP
alerts = wazuh.search_logs("data.srcip=192.168.1.50")
# Search by user
alerts = wazuh.search_logs("data.user=root")
Adding More Tools
Edit server.py and add a new @app.tool():
@app.tool()
async def my_new_tool(param1: str) -> str:
"""
Tool description shown to Claude.
Args:
param1: Parameter description
Returns:
JSON string with results
"""
# Your code here
return json.dumps({"result": "..."})
Production Considerations
- ✅ Use SSL certificates (not self-signed)
- ✅ Store credentials in HashiCorp Vault or AWS Secrets
- ✅ Rate limit MCP server to prevent abuse
- ✅ Enable audit logging on Wazuh API
- ✅ Create dedicated read-only API user
- ✅ Use network segmentation to isolate Wazuh
Security Notes
⚠️ For Development/Learning:
- Default credentials are
wazuh/wazuh - SSL verification disabled (dev mode)
- Credentials in plaintext in
.env
For Production:
- Change Wazuh credentials immediately
- Use proper SSL certificates
- Store credentials in secure vault
- Create read-only API user with minimal permissions
- Audit all API access
- Network firewall rules to restrict access
API Reference
WazuhClient Methods
# Get alerts
wazuh.get_alerts(level=7, hours=24, limit=100, agent_id=None)
# Get all agents
wazuh.get_agents()
# Get agent details
wazuh.get_agent_details(agent_id="001")
# Search alerts
wazuh.search_logs(query="rule.id=100001", hours=24, limit=50)
# Get alert groups
wazuh.get_alert_groups(hours=24)
Learning Resources
Support
For issues:
- Run
test_connection.pyto diagnose - Check Wazuh logs:
tail -f /var/ossec/logs/ossec.log - Review Claude Desktop logs
- Verify network connectivity between your machine and Wazuh manager
License
MIT
Changelog
v1.0.0 (2026-01-02)
- Initial release
- 4 core tools: critical_alerts, investigate_host, brute_force_detection, security_summary
- Full Wazuh API client
- Claude Desktop integration
- Comprehensive setup guide
Built for learning and security automation 🔍
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。