Wazuh MCP服务器
   ](https://github.com/gensecaihq/Wazuh-MCP-Server)
与您的SIEM交谈。 查询警报、追踪威胁、检查漏洞,并在整个Wazuh部署中触发主动响应——通过与任何人工智能助手的自然对话。
v4.2.1 |48个安全工具| Wazuh 4.8.0–4.14.4| 更新日志
______________________________________________________________________
这有什么作用
您的Wazuh SIEM每天生成数千个警报、漏洞发现和代理事件。调查它们意味着处理仪表盘、编写API查询以及在工具之间手动关联数据。
此MCP服务器将该工作流转换为对话:
You: "Show me critical alerts from the last hour"
AI: [calls get_wazuh_alerts] Found 3 critical alerts:
1. SSH brute force from 10.0.1.45 → agent-003 (Rule 5712, Level 10)
2. Rootkit detection on agent-007 (Rule 510, Level 12)
3. FIM change /etc/shadow on agent-001 (Rule 550, Level 10)
You: "Block that source IP on agent-003"
AI: [calls wazuh_block_ip] Blocked 10.0.1.45 via firewall-drop on agent-003.
You: "Which agents have unpatched critical CVEs?"
AI: [calls get_critical_vulnerabilities] 3 agents with critical vulnerabilities...它与 克劳德桌面, 打开WebUI+Ollama (完全局部,气隙), mcphost或任何符合MCP的客户端。
______________________________________________________________________
适用于云和本地LLM
这是一个标准的MCP工具服务器。它不在乎你使用什么LLM——它只是执行工具并返回结果。
| 模式 | LLM | 客户端 | 数据离开您的网络? |
|---|---|---|---|
| 云 | 克劳德、GPT等。 | Claude Desktop,任何MCP客户端 | 是(对LLM提供商) |
| 本地 | Llama、Qwen、Mistral通过Ollama | Open WebUI、mcphost、IBM/mcp-cli | 不是的,它是完全气密的。 |
适用于无法将SIEM数据发送到云API的安全团队 (合规性、空气间隙网络、数据主权),Ollama的本地模式将所有内容都保留在本地。两种模式共存-相同的服务器,相同的工具,相同的API。
快速入门:使用mcphost的本地LLM
# 1. Start the MCP server
docker compose up -d
# 2. Install mcphost (Go binary, no dependencies)
go install github.com/mark3labs/mcphost@latest
# 3. Configure
cat > ~/.mcphost.yml 详细设置: [克劳德集成指南](docs/CLAUDE_INTEGRATION.md)
______________________________________________________________________
## 安全
此服务器位于LLM和SIEM之间。安全不是可选的。
|层|它做什么|
|-------|-------------|
| **基于角色的访问控制** |按工具范围执行。需要14种主动响应工具 `wazuh:write`只读令牌可以查询,但永远不会触发操作。默认情况下,无身份验证模式是只读的。 |
| **审计日志** |每个破坏性工具调用(阻止IP、隔离主机、终止进程)都会记录客户端ID、会话、时间戳和完整参数。 |
| **输出消毒** |警报中的凭据、令牌和API密钥 `full_log` 字段在到达LLM之前被编辑。通过AI响应防止凭证泄漏。 |
| **输入验证** |每个参数都经过验证:正则表达式代理ID, `ipaddress` 用于IP的模块,用于主动响应的shell元字符块,Elasticsearch Query DSL(无字符串插值)。 |
| **速率限制** |每个客户端滑动窗口,块持续时间逐渐增加(10秒→ 5min). |
| **断路器** |Wazuh API故障触发故障持续60秒,自动复位。HALF_OPEN状态下的单次试验。 |
| **原木消毒** |全局过滤器从所有服务器日志中编辑密码、令牌和机密。 |
| **集装箱硬化** |非root用户、只读文件系统, `CAP_DROP ALL`, `no-new-privileges`. |
Generate a secure API key
python -c "import secrets; print('wazuh_' + secrets.token_urlsafe(32))"
______________________________________________________________________
## 配置
### 必需
|变量|描述|
|----------|-------------|
| `WAZUH_HOST` |Wazuh Manager主机名或IP|
| `WAZUH_USER` |API用户名|
| `WAZUH_PASS` |API密码|
### 可选的
|变量|默认值|描述|
|----------|---------|-------------|
| `WAZUH_PORT` | `55000` |API端口管理器|
| `MCP_HOST` | `0.0.0.0` |服务器绑定地址|
| `MCP_PORT` | `3000` |服务器端口|
| `AUTH_MODE` | `bearer` | `oauth`, `bearer`,或 `none` |
| `AUTH_SECRET_KEY` |自动生成|JWT签名密钥|
| `AUTHLESS_ALLOW_WRITE` | `false` |允许在无授权模式下进行主动响应|
| `ALLOWED_ORIGINS` | `https://claude.ai` |CORS起源(逗号分隔)|
| `REDIS_URL` |--|用于多实例会话存储的Redis URL|
### Wazuh Indexer(用于警报搜索+漏洞)
|变量|默认值|描述|
|----------|---------|-------------|
| `WAZUH_INDEXER_HOST` |--|索引器主机名|
| `WAZUH_INDEXER_PORT` | `9200` |索引器端口|
| `WAZUH_INDEXER_USER` |--|索引器用户名|
| `WAZUH_INDEXER_PASS` |--|索引器密码|
> 完整参考: [配置指南](docs/configuration.md)
______________________________________________________________________
## API终点
|端点|方法|描述|
|----------|--------|-------------|
| `/mcp` |POST/GET/DELETE | MCP流式HTTP(推荐)|
| `/sse` |GET|旧服务器发送事件|
| `/health` |GET |健康检查(无需身份验证)|
| `/metrics` |GET |普罗米修斯指标|
| `/auth/token` |POST|JWT的Exchange API密钥|
| `/docs` |GET|OpenAPI文档|
______________________________________________________________________
## 建筑
src/wazuh_mcp_server/ ├── server.py # MCP protocol + 48 tool handlers ├── config.py # Environment-based configuration ├── auth.py # JWT + API key authentication ├── oauth.py # OAuth 2.0 with Dynamic Client Registration ├── security.py # Rate limiting, CORS, input validation ├── monitoring.py # Prometheus metrics, structured logging ├── resilience.py # Circuit breakers, retries, graceful shutdown ├── session_store.py # Pluggable sessions (in-memory + Redis) └── api/ ├── wazuh_client.py # Wazuh Manager REST API client └── wazuh_indexer.py # Wazuh Indexer (Elasticsearch) client
______________________________________________________________________
## 更进一步:自主代理SOC
将此MCP服务器与 [**Wazuh OpenClaw自动驾驶仪**](https://github.com/gensecaihq/Wazuh-Openclaw-Autopilot) 建立一个完全自主的安全运营中心。
虽然该服务器为您提供了对Wazuh的会话访问,但OpenClaw部署了AI代理 **昼夜不停地工作** --在没有人为干预的情况下,对警报进行分类、关联事件并推荐应对措施。
Manual SOC: Alert → Analyst reviews → Hours → Response Agentic SOC: Alert → AI triages → Seconds → Response ready for approval
[**探索OpenClaw自动驾驶仪**](https://github.com/gensecaihq/Wazuh-Openclaw-Autopilot)
______________________________________________________________________
## 文档
|指南|说明|
|-------|-------------|
| [克劳德集成](docs/CLAUDE_INTEGRATION.md) |Claude桌面设置和身份验证|
| [配置](docs/configuration.md) |完整配置参考|
| [高级功能](docs/ADVANCED_FEATURES.md) |HA、无服务器、紧凑模式|
| [API文档](docs/api/) |根据工具文档|
| [安全](docs/security/) |安全强化指南|
| [故障排除](docs/TROUBLESHOOTING.md) |常见问题和解决方案|
| [运营](docs/OPERATIONS.md) |部署、监控、维护|
______________________________________________________________________
## 贡献
______________________________________________________________________
## 许可证
[麻省理工学院](LICENSE)
______________________________________________________________________
## 致谢
- [瓦祖](https://wazuh.com/) --开源安全平台
- [模型上下文协议](https://modelcontextprotocol.io/) --AI工具集成标准
- [奥拉玛](https://ollama.com/) --本地LLM推理
- [打开WebUI](https://github.com/open-webui/open-webui) --自托管AI聊天界面
- [mcphost](https://github.com/mark3labs/mcphost) --支持LLM的MCP CLI主机
______________________________________________________________________
Contributors
### 贡献者
|头像|用户名|贡献|
|--------|----------|---------------|
| | [@进展缓慢](https://github.com/alokemajumder) |代码、问题、讨论|
| | [@发电机组开发](https://github.com/gensecai-dev) |代码,讨论|
| | [@aiunmukto](https://github.com/aiunmukto) |代码、PR|
| | [@卡里布桑](https://github.com/Karibusan) |代码、问题、PR|
| | [@lwsinclair](https://github.com/lwsinclair) |代码、PR|
| | [@泰勒沃尔顿](https://github.com/taylorwalton) |PR|
| | [@米尔克韦88](https://github.com/MilkyWay88) |PR|
| | [@kanylbullen](https://github.com/kanylbullen) |代码、PR|
| | [@Uberkarhu](https://github.com/Uberkarhu) |问题|
| | [@cbassonbgroup](https://github.com/cbassonbgroup) |问题|
| | [@cybersentinel-06](https://github.com/cybersentinel-06) |问题|
| | [@达乌德·阿尔沙德](https://github.com/daod-arshad) |问题|
| | [@妈妈](https://github.com/mamema) |问题|
| | [@马尔柯利努克斯46](https://github.com/marcolinux46) |问题|
| | [@马修·范德里](https://github.com/matveevandrey) |问题|
| | [@朋克眼](https://github.com/punkpeye) |问题|
| | [@托尼柳9189](https://github.com/tonyliu9189) |问题|
| | [@Vasanth120v](https://github.com/Vasanth120v) |讨论|
| | [@ GNIX45](https://github.com/gnix45) |讨论|
| | [@1987年圣诞节](https://github.com/melmasry1987) |讨论|
> 由自动更新

