Skip to content

Commit 883b0e4

Browse files
committed
Bump version to 4.0.8 and update README, docs, and changelog
- Add CHANGELOG entry for v4.0.8 documenting all 17 audit fixes - Update README: 48 tools (was 29), security middleware, updated project structure - Update docs/api/README: add active response, verification, and rollback tool categories - Update docs/configuration.md: fix stale stdio/binary references to Docker commands - Update docs/security/README.md: reflect auth on all endpoints, security middleware - Update docs/ADVANCED_FEATURES.md: add middleware section, fix retry scope description - Update docs/OPERATIONS.md: fix endpoint table for authenticated root and custom metrics - Update MCP_COMPLIANCE_VERIFICATION.md: 48 tools (was 29) - Bump version to 4.0.8 in pyproject.toml and __init__.py
1 parent a838c5b commit 883b0e4

File tree

10 files changed

+138
-66
lines changed

10 files changed

+138
-66
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.0.8] - 2026-02-26
9+
10+
### Fixed
11+
- **Auth bypass on root endpoint**: The `/` MCP endpoint was missing authentication, allowing unauthenticated access to all tools when `AUTH_MODE=bearer`
12+
- **`_run_sync` RuntimeError catch**: Method raised RuntimeError as a safety guard but then caught its own exception in the `except` block, silently falling through
13+
- **`__contains__` async bug**: `SessionManager.__contains__` was defined as `async def` but Python's `in` operator doesn't `await`, always returning a truthy coroutine object
14+
- **`/auth/token` bypassing auth_manager**: Token endpoint compared raw API key strings instead of using `auth_manager.validate_api_key()` with proper format checks and constant-time hash comparison
15+
- **`search_security_events` ignoring query**: The `query` parameter was validated but never passed to the indexer, returning unfiltered results
16+
- **`cleanup_expired` signature mismatch**: `SessionManager.cleanup_expired()` didn't accept `timeout_minutes` parameter, causing TypeError when called from `HealthRecovery._recover_memory_pressure`
17+
- **Monitoring middleware not registered**: `setup_monitoring_middleware()` was defined but never registered on the FastAPI app, so no request tracking or correlation IDs were applied
18+
- **Prometheus `/metrics` empty**: `generate_latest()` was called without the custom `REGISTRY`, returning empty default registry instead of actual metrics
19+
20+
### Added
21+
- Security middleware now registered on the FastAPI app, adding security headers (X-Content-Type-Options, X-Frame-Options, etc.) to all responses
22+
- `"12h"` added to `VALID_TIME_RANGES` and `"1d": 24` added to `_TIME_RANGE_HOURS` for consistent time range support
23+
- `"pending"` added to agent status enum in tool schema to match `VALID_AGENT_STATUSES`
24+
- Max size guard on `_initialized_sessions` dict to prevent unbounded memory growth (capped at 10,000 entries)
25+
- 23 new test cases covering audit fixes (33 total tests, up from 10)
26+
27+
### Changed
28+
- `MCPResponse` now overrides Pydantic v2 `model_dump()` instead of deprecated v1 `dict()` method
29+
- `get_alerts` in `WazuhIndexerClient` refactored to use `_search()` helper for consistent retry logic
30+
- `analyze_security_threat`, `check_ioc_reputation`, and `check_blocked_ip` use recursive dict search instead of O(n) `json.dumps()` per alert
31+
- `_search()` in `WazuhIndexerClient` now accepts optional `sort` parameter
32+
33+
### Removed
34+
- Dead `create_auth_endpoints()` function, `TokenRequest`/`TokenResponse` classes, and unused `HTTPException` import from `auth.py`
35+
836
## [4.0.7] - 2026-02-25
937

1038
### Added

MCP_COMPLIANCE_VERIFICATION.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ This document verifies that the Wazuh MCP Remote Server fully complies with the
8686
|-------------|--------|----------------|
8787
| **JSON-RPC 2.0** | ✅ COMPLIANT | Full JSON-RPC 2.0 compliance |
8888
| **Session management** | ✅ COMPLIANT | MCPSession class with state tracking |
89-
| **Tool registration** | ✅ COMPLIANT | 29 tools properly registered |
89+
| **Tool registration** | ✅ COMPLIANT | 48 tools properly registered |
9090
| **Error handling** | ✅ COMPLIANT | Standard MCP error codes |
9191
| **Capability negotiation** | ✅ COMPLIANT | Server capabilities exposed |
9292

@@ -98,7 +98,7 @@ This document verifies that the Wazuh MCP Remote Server fully complies with the
9898
|--------|--------|----------------|
9999
| **initialize** | ✅ COMPLIANT | Session creation with capability negotiation |
100100
| **ping** | ✅ COMPLIANT | Returns empty `{}` per spec |
101-
| **tools/list** | ✅ COMPLIANT | 29 tools with pagination support |
101+
| **tools/list** | ✅ COMPLIANT | 48 tools with pagination support |
102102
| **tools/call** | ✅ COMPLIANT | Tool execution with error handling |
103103
| **prompts/list** | ✅ COMPLIANT | 4 security prompts with pagination |
104104
| **prompts/get** | ✅ COMPLIANT | Prompt content with argument substitution |
@@ -219,7 +219,7 @@ curl -X POST http://localhost:3000/mcp \
219219
-H "MCP-Session-Id: <session-id>" \
220220
-H "Content-Type: application/json" \
221221
-d '{"jsonrpc":"2.0","method":"tools/list","id":"2"}'
222-
# Expected: JSON-RPC response with 29 tools
222+
# Expected: JSON-RPC response with 48 tools
223223

224224
# Test GET with SSE (requires Accept header)
225225
curl -H "Authorization: Bearer <token>" \

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
**Production-ready MCP server connecting AI assistants to Wazuh SIEM.**
99

10-
> **Version 4.0.7** | Wazuh 4.8.0 - 4.14.3 | [Full Changelog](CHANGELOG.md)
10+
> **Version 4.0.8** | Wazuh 4.8.0 - 4.14.3 | [Full Changelog](CHANGELOG.md)
1111
1212
---
1313

@@ -58,13 +58,13 @@ Agentic SOC: Alert → AI triages → Seconds later → Response ready for a
5858
| Category | Capabilities |
5959
|----------|-------------|
6060
| **MCP Protocol** | 100% compliant with MCP 2025-11-25, Streamable HTTP + Legacy SSE |
61-
| **Security Tools** | 29 specialized tools for alerts, agents, vulnerabilities, compliance |
61+
| **Security Tools** | 48 specialized tools for alerts, agents, vulnerabilities, compliance, active response |
6262
| **Authentication** | OAuth 2.0 with DCR, Bearer tokens (JWT), or authless mode |
63-
| **Production Ready** | Circuit breakers, rate limiting, graceful shutdown, Prometheus metrics |
63+
| **Production Ready** | Circuit breakers, rate limiting, security & monitoring middleware, Prometheus metrics |
6464
| **Deployment** | Docker containerized, multi-platform (AMD64/ARM64), serverless-ready |
6565
| **Token Efficiency** | Compact output mode reduces responses by ~66% |
6666

67-
### 29 Security Tools
67+
### 48 Security Tools
6868

6969
| Category | Tools |
7070
|----------|-------|
@@ -73,6 +73,9 @@ Agentic SOC: Alert → AI triages → Seconds later → Response ready for a
7373
| **Vulnerabilities** (3) | `get_wazuh_vulnerabilities`, `get_wazuh_critical_vulnerabilities`, `get_wazuh_vulnerability_summary` |
7474
| **Security Analysis** (7) | `search_security_events`, `analyze_security_threat`, `check_ioc_reputation`, `perform_risk_assessment`, `get_top_security_threats`, `generate_security_report`, `run_compliance_check` |
7575
| **System** (10) | `get_wazuh_statistics`, `get_wazuh_weekly_stats`, `get_wazuh_cluster_health`, `get_wazuh_cluster_nodes`, `get_wazuh_rules_summary`, `get_wazuh_remoted_stats`, `get_wazuh_log_collector_stats`, `search_wazuh_manager_logs`, `get_wazuh_manager_error_logs`, `validate_wazuh_connection` |
76+
| **Active Response** (9) | `wazuh_block_ip`, `wazuh_isolate_host`, `wazuh_kill_process`, `wazuh_disable_user`, `wazuh_quarantine_file`, `wazuh_active_response`, `wazuh_firewall_drop`, `wazuh_host_deny`, `wazuh_restart` |
77+
| **Verification** (5) | `wazuh_check_blocked_ip`, `wazuh_check_agent_isolation`, `wazuh_check_process`, `wazuh_check_user_status`, `wazuh_check_file_quarantine` |
78+
| **Rollback** (5) | `wazuh_unisolate_host`, `wazuh_enable_user`, `wazuh_restore_file`, `wazuh_firewall_allow`, `wazuh_host_allow` |
7679

7780
---
7881

@@ -185,26 +188,28 @@ curl http://localhost:3000/health
185188

186189
```
187190
src/wazuh_mcp_server/
188-
├── server.py # MCP server with 29 tools
189-
├── config.py # Configuration management
190-
├── auth.py # JWT authentication
191+
├── server.py # MCP server with 48 tools (Streamable HTTP + SSE)
192+
├── config.py # Configuration management with validation
193+
├── config_validator.py # Startup configuration validation
194+
├── auth.py # JWT & API key authentication
191195
├── oauth.py # OAuth 2.0 with DCR
192-
├── security.py # Rate limiting, CORS
193-
├── monitoring.py # Prometheus metrics
194-
├── resilience.py # Circuit breakers, retries
195-
├── session_store.py # Pluggable sessions
196+
├── security.py # Rate limiting, CORS, input validation, security middleware
197+
├── monitoring.py # Prometheus metrics, request tracking middleware
198+
├── resilience.py # Circuit breakers, retries, graceful shutdown
199+
├── session_store.py # Pluggable sessions (in-memory + Redis)
196200
└── api/
197-
├── wazuh_client.py # Wazuh Manager API
198-
└── wazuh_indexer.py # Wazuh Indexer API
201+
├── wazuh_client.py # Wazuh Manager API client
202+
└── wazuh_indexer.py # Wazuh Indexer API client (alerts + vulnerabilities)
199203
```
200204

201205
---
202206

203207
## Security
204208

205-
- **Authentication**: JWT tokens, OAuth 2.0 with DCR
209+
- **Authentication**: JWT tokens, OAuth 2.0 with DCR, all endpoints protected
210+
- **Security Middleware**: Automatic security headers (X-Content-Type-Options, X-Frame-Options, CSP)
206211
- **Rate Limiting**: Per-client request throttling
207-
- **Input Validation**: SQL injection and XSS protection
212+
- **Input Validation**: Comprehensive parameter validation with SQL injection and XSS protection
208213
- **Container Security**: Non-root user, read-only filesystem
209214

210215
```bash

docs/ADVANCED_FEATURES.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ The server includes production-grade HA features for maximum reliability.
1717

1818
- Exponential backoff with jitter
1919
- 3 retry attempts with 1-10 second delays
20-
- Applies to all Wazuh API calls
21-
- Handles transient network failures
20+
- Applies to all Wazuh API and Indexer calls (including alert queries)
21+
- Only retries transient errors (5xx, connection errors) — not 400/401/404
2222

2323
### Graceful Shutdown
2424

@@ -29,6 +29,15 @@ The server includes production-grade HA features for maximum reliability.
2929

3030
**Implementation:** Automatically applied to all Wazuh API calls - no configuration required.
3131

32+
### Security & Monitoring Middleware
33+
34+
Two middleware layers are automatically registered on all HTTP requests:
35+
36+
- **Monitoring Middleware**: Tracks request counts, active connections, response durations, and adds correlation IDs to every request
37+
- **Security Middleware**: Adds security headers to all responses (X-Content-Type-Options, X-Frame-Options, Content-Security-Policy, X-XSS-Protection, Referrer-Policy)
38+
39+
Prometheus metrics are available at `/metrics` using a custom collector registry for accurate reporting.
40+
3241
---
3342

3443
## Serverless Ready

docs/OPERATIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ docker compose up -d
178178

179179
| Endpoint | Method | Description |
180180
|----------|--------|-------------|
181-
| `/mcp` | GET/POST | **Recommended** - Streamable HTTP (2025-11-25) |
181+
| `/mcp` | GET/POST/DELETE | **Recommended** - Streamable HTTP (MCP 2025-11-25) |
182182
| `/sse` | GET | Legacy SSE endpoint |
183-
| `/` | POST | JSON-RPC 2.0 endpoint |
183+
| `/` | GET/POST | JSON-RPC 2.0 endpoint (authenticated) |
184184
| `/health` | GET | Health check |
185-
| `/metrics` | GET | Prometheus metrics |
185+
| `/metrics` | GET | Prometheus metrics (custom registry) |
186186
| `/docs` | GET | OpenAPI documentation |
187187

188188
### Authentication Endpoints

docs/api/README.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FastMCP Tools API Reference
22

3-
Complete reference for all 29 FastMCP tools available in Wazuh MCP Server v2.1.0.
3+
Complete reference for all 48 tools available in Wazuh MCP Server v4.0.8.
44

55
## 🛠️ Tool Categories
66

@@ -29,17 +29,18 @@ Identify and analyze security vulnerabilities across your environment.
2929
- **get_wazuh_critical_vulnerabilities** - Critical vulnerabilities only
3030
- **get_wazuh_vulnerability_summary** - Vulnerability statistics and trends
3131

32-
### 🔍 [Security Analysis](security.md) (6 tools)
32+
### 🔍 [Security Analysis](security-analysis.md) (7 tools)
3333
AI-powered security analysis and threat intelligence capabilities.
3434

35+
- **search_security_events** - Advanced security event search with query filtering
3536
- **analyze_security_threat** - AI-powered threat analysis
3637
- **check_ioc_reputation** - IoC reputation checking
3738
- **perform_risk_assessment** - Comprehensive risk analysis
3839
- **get_top_security_threats** - Top threats by severity
3940
- **generate_security_report** - Automated security reporting
4041
- **run_compliance_check** - Compliance framework validation
4142

42-
### 📊 [System Monitoring](monitoring.md) (10 tools)
43+
### 📊 [System Monitoring](system-monitoring.md) (10 tools)
4344
Monitor system health, performance, and operational metrics.
4445

4546
- **get_wazuh_statistics** - Comprehensive system statistics
@@ -53,6 +54,37 @@ Monitor system health, performance, and operational metrics.
5354
- **get_wazuh_manager_error_logs** - Error log retrieval
5455
- **validate_wazuh_connection** - Connection validation
5556

57+
### ⚡ Active Response (9 tools)
58+
Execute active response actions on Wazuh agents.
59+
60+
- **wazuh_block_ip** - Block IP address via active response
61+
- **wazuh_isolate_host** - Isolate a host from the network
62+
- **wazuh_kill_process** - Kill a running process on an agent
63+
- **wazuh_disable_user** - Disable a user account
64+
- **wazuh_quarantine_file** - Quarantine a suspicious file
65+
- **wazuh_active_response** - Send custom active response command
66+
- **wazuh_firewall_drop** - Add firewall drop rule
67+
- **wazuh_host_deny** - Add host deny rule
68+
- **wazuh_restart** - Restart Wazuh agent
69+
70+
### ✅ Verification (5 tools)
71+
Verify the status of active response actions.
72+
73+
- **wazuh_check_blocked_ip** - Verify IP is blocked
74+
- **wazuh_check_agent_isolation** - Verify agent isolation status
75+
- **wazuh_check_process** - Check if process is running
76+
- **wazuh_check_user_status** - Check user account status
77+
- **wazuh_check_file_quarantine** - Check file quarantine status
78+
79+
### ↩️ Rollback (5 tools)
80+
Reverse active response actions.
81+
82+
- **wazuh_unisolate_host** - Remove host isolation
83+
- **wazuh_enable_user** - Re-enable a disabled user
84+
- **wazuh_restore_file** - Restore a quarantined file
85+
- **wazuh_firewall_allow** - Remove firewall drop rule
86+
- **wazuh_host_allow** - Remove host deny rule
87+
5688
## 🎯 Quick Examples
5789

5890
### Basic Usage
@@ -109,7 +141,7 @@ All tools return JSON responses with consistent structure:
109141
"metadata": {
110142
"query_time": "2024-01-01T12:00:00Z",
111143
"api_source": "wazuh_server",
112-
"version": "2.1.0"
144+
"version": "4.0.8"
113145
}
114146
}
115147
```

docs/configuration.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Configuration Guide
22

3-
Complete configuration reference for Wazuh MCP Server v2.1.0.
3+
Complete configuration reference for Wazuh MCP Server v4.0.8.
44

55
## 📋 Configuration Overview
66

@@ -33,7 +33,7 @@ WAZUH_USER=wazuh
3333
WAZUH_PASS=changeme
3434

3535
# Transport Configuration
36-
MCP_TRANSPORT=stdio
36+
MCP_TRANSPORT=streamable-http
3737
```
3838

3939
## 💡 Complete Configuration Reference
@@ -126,9 +126,9 @@ CACHE_MAX_SIZE=1000 # Maximum cache entries
126126

127127
```bash
128128
# Transport Settings
129-
MCP_TRANSPORT=stdio # Transport type (stdio only)
129+
MCP_TRANSPORT=streamable-http # Transport type (streamable-http)
130130
MCP_SERVER_NAME=Wazuh MCP Server # Server name
131-
MCP_SERVER_VERSION=2.1.0 # Server version
131+
MCP_SERVER_VERSION=4.0.8 # Server version
132132

133133
# Tool Configuration
134134
ENABLE_SECURITY_TOOLS=true # Enable security analysis tools
@@ -261,26 +261,24 @@ CLIENT_KEY_PATH=/etc/wazuh-mcp/client.key
261261

262262
## 🎯 Configuration Validation
263263

264-
### Health Check Command
264+
### Health Check
265265

266266
```bash
267267
# Validate configuration
268-
./bin/wazuh-mcp-server --health-check
268+
curl -s http://localhost:3000/health | jq .
269269

270-
# Validate with detailed output
271-
./bin/wazuh-mcp-server --health-check --verbose
270+
# Check with verbose output
271+
curl -v http://localhost:3000/health
272272
```
273273

274-
### Configuration Test Script
274+
### Configuration Test
275275

276276
```bash
277-
# Test configuration
278-
python tools/validate_setup.py
277+
# Test configuration via health endpoint
278+
curl -s http://localhost:3000/health | jq .
279279

280-
# Test specific components
281-
python tools/validate_setup.py --test-connection
282-
python tools/validate_setup.py --test-ssl
283-
python tools/validate_setup.py --test-auth
280+
# Verify imports
281+
PYTHONPATH=src python -c "from wazuh_mcp_server.server import app; print('OK')"
284282
```
285283

286284
## 📝 Configuration Examples
@@ -294,7 +292,7 @@ WAZUH_PORT=55000
294292
WAZUH_USER=wazuh-api
295293
WAZUH_PASS=secure-password
296294
VERIFY_SSL=false
297-
MCP_TRANSPORT=stdio
295+
MCP_TRANSPORT=streamable-http
298296
LOG_LEVEL=INFO
299297
```
300298

@@ -347,10 +345,7 @@ Configuration precedence (highest to lowest):
347345
```bash
348346
# Override via environment variable
349347
export WAZUH_HOST=new-server.com
350-
./bin/wazuh-mcp-server --stdio
351-
352-
# Override via command line (if supported)
353-
./bin/wazuh-mcp-server --wazuh-host=new-server.com --stdio
348+
docker compose up -d
354349
```
355350

356351
### Configuration Reloading
@@ -359,8 +354,7 @@ Currently, configuration changes require server restart:
359354

360355
```bash
361356
# After changing .env file
362-
pkill -f wazuh-mcp-server
363-
./bin/wazuh-mcp-server --stdio
357+
docker compose restart wazuh-mcp-remote-server
364358
```
365359

366360
## 🐛 Troubleshooting Configuration
@@ -480,10 +474,10 @@ For detailed instructions, see the [Claude Desktop Integration](../README.md#-cl
480474

481475
For configuration issues:
482476

483-
1. **Check [Troubleshooting Guide](troubleshooting/README.md)**
484-
2. **Run health check**: `./bin/wazuh-mcp-server --health-check`
485-
3. **Validate setup**: `python tools/validate_setup.py`
486-
4. **Check logs**: `tail -f logs/wazuh-mcp-server.log`
477+
1. **Check [Troubleshooting Guide](TROUBLESHOOTING.md)**
478+
2. **Run health check**: `curl http://localhost:3000/health`
479+
3. **Check Prometheus metrics**: `curl http://localhost:3000/metrics`
480+
4. **Check logs**: `docker compose logs -f wazuh-mcp-remote-server`
487481

488482
---
489483

0 commit comments

Comments
 (0)