Skip to content
Back to search

mcp-server-wazuh

MCP Server for Wazuh SIEM

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/gbrigandi--mcp-server-wazuh/badge.svg)](/listings/gbrigandi--mcp-server-wazuh)

HTML

<a href="/listings/gbrigandi--mcp-server-wazuh"><img src="/api/listings/gbrigandi--mcp-server-wazuh/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Option 1: Download Pre-built Binary (Recommended)

1. **Download the Binary:** * Go to the [Releases page](https://github.com/gbrigandi/mcp-server-wazuh/releases) of the `mcp-server-wazuh` GitHub repository. * Download the appropriate binary for your operating system (e.g., `mcp-server-wazuh-linux-amd64`, `mcp-server-wazuh-macos-amd64`, `mcp-server-wazuh-macos-arm64`, `mcp-server-wazuh-windows-amd64.exe`). * Make the downloaded binary executable (e.g., `chmod +x mcp-server-wazuh-linux-amd64`). * (Optional) Rename it to something simpler like `mcp-server-wazuh` and move it to a directory in your system's `PATH` for easier access.

Option 2: Docker

1. **Pull the Docker Image:** ```bash docker pull ghcr.io/gbrigandi/mcp-server-wazuh:latest ```

Option 3: Build from Source

1. **Prerequisites:** * Install Rust: [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)

2. **Build:** ```bash git clone https://github.com/gbrigandi/mcp-server-wazuh.git cd mcp-server-wazuh

# Build with stdio transport only (default) cargo build --release

# Build with HTTP transport support cargo build --release --features http ``` The binary will be available at `target/release/mcp-server-wazuh`.

Configure Your LLM Client

The method for configuring your LLM client will vary depending on the client itself. For clients that support MCP (Model Context Protocol), you will typically need to point the client to the path of the `mcp-server-wazuh` executable.

**Example for Claude Desktop:**

Configure your `claude_desktop_config.json` file:

{
  "mcpServers": {
    "wazuh": {
      "command": "/path/to/mcp-server-wazuh",
      "args": [],
      "env": {
        "WAZUH_API_HOST": "your_wazuh_manager_api_host",
        "WAZUH_API_PORT": "55000",
        "WAZUH_API_USERNAME": "your_wazuh_api_user",
        "WAZUH_API_PASSWORD": "your_wazuh_api_password",
        "WAZUH_INDEXER_HOST": "your_wazuh_indexer_host",
        "WAZUH_INDEXER_PORT": "9200",
        "WAZUH_INDEXER_USERNAME": "your_wazuh_indexer_user",
        "WAZUH_INDEXER_PASSWORD": "your_wazuh_indexer_password",
        "WAZUH_VERIFY_SSL": "false",
        "WAZUH_TEST_PROTOCOL": "https",
        "RUST_LOG": "info"
      }
    }
  }
}

Replace `/path/to/mcp-server-wazuh` with the actual path to your binary and configure the environment variables as detailed in the [Configuration](#configuration) section.

Once configured, your LLM client should be able to launch and communicate with the `mcp-server-wazuh` to access Wazuh security data.

If using Docker, create a `.env` file with your Wazuh configuration:

WAZUH_API_HOST=your_wazuh_manager_api_host
WAZUH_API_PORT=55000
WAZUH_API_USERNAME=your_wazuh_api_user
WAZUH_API_PASSWORD=your_wazuh_api_password
WAZUH_INDEXER_HOST=your_wazuh_indexer_host
WAZUH_INDEXER_PORT=9200
WAZUH_INDEXER_USERNAME=your_wazuh_indexer_user
WAZUH_INDEXER_PASSWORD=your_wazuh_indexer_password
WAZUH_VERIFY_SSL=false
WAZUH_TEST_PROTOCOL=https
RUST_LOG=info

Configure your `claude_desktop_config.json` file:

{
  "mcpServers": {
    "wazuh": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "--env-file", "/path/to/your/.env",
        "ghcr.io/gbrigandi/mcp-server-wazuh:latest"
      ]
    }
  }
}

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 542 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Wazuh MCP Server - Talk to your SIEM
  2. A Rust-based server designed to bridge the gap between a Wazuh Security Information and Event Management (SIEM) system and applications requiring contextual security data, specifically tailored for the Claude Desktop Integration using the Model Context Protocol (MCP).
  3. ## Overview
  4. Modern AI assistants like Claude can benefit significantly from real-time context about the user's security environment. The Wazuh MCP Server bridges this gap by providing comprehensive access to Wazuh SIEM data through natural language interactions.
  5. This server transforms complex Wazuh API responses into MCP-compatible format, enabling AI assistants to access:
  6. - **Security Alerts & Events** from the Wazuh Indexer for threat detection and incident response
  7. - **Agent Management & Monitoring** including health status, system processes, and network ports
  8. - **Vulnerability Assessment** data for risk management and patch prioritization
  9. - **Security Rules & Configuration** for detection optimization and compliance validation
  10. - **System Statistics & Performance** metrics for operational monitoring and audit trails
  11. - **Log Analysis & Forensics** capabilities for incident investigation and compliance reporting
  12. - **Cluster Health & Management** for infrastructure reliability and availability requirements
  13. - **Compliance Monitoring & Gap Analysis** for regulatory frameworks like PCI-DSS, HIPAA, SOX, and GDPR
  14. Rather than requiring manual API calls or complex queries, security teams can now ask natural language questions like "Show me critical vulnerabilities on web servers," "What processes are running on agent 001?" or "Are we meeting PCI-DSS logging requirements?" and receive structured, actionable data from their Wazuh deployment.
  15. This approach is particularly valuable for compliance teams who need to quickly assess security posture, identify gaps in monitoring coverage, validate rule effectiveness, and generate evidence for audit requirements across distributed infrastructure.
  16. ![](media/wazuh-alerts-1.png)
  17. ## Example Use Cases
  18. The Wazuh MCP Server provides direct access to Wazuh security data through natural language interactions, enabling several practical use cases:
  19. ### Security Alert Analysis
  20. * **Alert Triage and Investigation:** Query recent security alerts with `get_wazuh_alert_summary` to quickly identify and prioritize threats requiring immediate attention.
  21. * **Alert Pattern Recognition:** Analyze alert trends and patterns to identify recurring security issues or potential attack campaigns.
  22. ### Vulnerability Management
  23. * **Agent Vulnerability Assessment:** Use `get_wazuh_vulnerability_summary` and `get_wazuh_critical_vulnerabilities` to assess security posture of specific agents and prioritize patching efforts.
  24. * **Risk-Based Vulnerability Prioritization:** Correlate vulnerability data with agent criticality and exposure to focus remediation efforts.
  25. ### System Monitoring and Forensics
  26. * **Process Analysis:** Investigate running processes on agents using `get_wazuh_agent_processes` for threat hunting and system analysis.
  27. * **Network Security Assessment:** Monitor open ports and network services with `get_wazuh_agent_ports` to identify potential attack vectors.
  28. * **Agent Health Monitoring:** Track agent status and connectivity using `get_wazuh_running_agents` to ensure comprehensive security coverage.
  29. ### Security Operations Intelligence
  30. * **Rule Effectiveness Analysis:** Review and analyze security detection rules with `get_wazuh_rules_summary` to optimize detection capabilities.
  31. * **Manager Performance Monitoring:** Track system performance and statistics using tools like `get_wazuh_weekly_stats`, `get_wazuh_remoted_stats`, and `get_wazuh_log_collector_stats`.
  32. * **Cluster Health Management:** Monitor Wazuh cluster status with `get_wazuh_cluster_health` and `get_wazuh_cluster_nodes` for operational reliability.
  33. ### Incident Response and Forensics
  34. * **Log Analysis:** Search and analyze manager logs using `search_wazuh_manager_logs` and `get_wazuh_manager_error_logs` for incident investigation.
  35. * **Agent-Specific Investigation:** Combine multiple tools to build comprehensive profiles of specific agents during security incidents.
  36. * **Natural Language Security Queries:** Ask complex security questions in natural language and receive structured data from multiple Wazuh components.
  37. ### Operational Efficiency
  38. * **Automated Reporting:** Generate security reports and summaries through conversational interfaces without manual API calls.
  39. * **Cross-Component Analysis:** Correlate data from both Wazuh Indexer (alerts) and Wazuh Manager (agents, rules, vulnerabilities) for comprehensive security insights.
  40. * **Multilingual Security Operations:** Access Wazuh data and receive insights in multiple languages for global security teams.
  41. ### Threat Intelligence Gathering and Response
  42. For enhanced threat intelligence and incident response capabilities, the Wazuh MCP Server can be combined with complementary security MCP servers:
  43. | Server | Description |
  44. |--------|-------------|
  45. | **[Cortex MCP Server](https://github.com/gbrigandi/mcp-server-cortex/)** | Artifact analysis and IOC enrichment via 140+ analyzers |
  46. | **[TheHive MCP Server](https://github.com/gbrigandi/mcp-server-thehive/)** | Case management and incident response orchestration |
  47. | **[MISP MCP Server](https://github.com/gbrigandi/mcp-server-misp/)** | Threat intelligence sharing and IOC lookup |
  48. **Enhanced Capabilities with Cortex Integration:**
  49. * **Artifact Analysis:** Automatically analyze suspicious files, URLs, domains, and IP addresses found in Wazuh alerts using Cortex's 140+ analyzers
  50. * **IOC Enrichment:** Enrich indicators of compromise (IOCs) from Wazuh alerts with threat intelligence from multiple sources including VirusTotal, Shodan, MISP, and more
  51. * **Automated Threat Hunting:** Combine Wazuh's detection capabilities with Cortex's analysis engines to automatically investigate and classify threats
  52. * **Multi-Source Intelligence:** Leverage analyzers for reputation checks, malware analysis, domain analysis, and behavioral analysis
  53. * **Response Orchestration:** Use analysis results to inform automated response actions and alert prioritization
  54. **Enhanced Capabilities with TheHive Integration:**
  55. * **Case Creation:** Automatically create cases in TheHive from Wazuh alerts for structured incident tracking
  56. * **Alert Correlation:** Link related Wazuh alerts to existing cases for comprehensive incident timelines
  57. * **Task Management:** Create and track investigation tasks based on alert severity and type
  58. * **Observable Management:** Extract and manage IOCs as observables within case investigations
  59. * **Collaboration:** Enable security team collaboration on incidents detected by Wazuh
  60. **Enhanced Capabilities with MISP Integration:**
  61. * **IOC Lookup:** Check if indicators from Wazuh alerts are known in your threat intelligence database
  62. * **Threat Context:** Retrieve event context, threat actor attribution, and MITRE ATT&CK mappings for IOCs
  63. * **False Positive Reduction:** Validate IOCs against MISP warninglists to reduce false positives
  64. * **Sighting Tracking:** Record and query sighting history to assess IOC prevalence
  65. * **Galaxy Exploration:** Access threat actor profiles, malware families, and attack patterns
  66. **Example Workflow:**
  67. 1. Wazuh detects a suspicious file hash or network connection in an alert
  68. 2. The AI assistant queries the MISP MCP Server to check if the IOC is known in threat intelligence
  69. 3. If unknown, the Cortex MCP Server analyzes the artifact using multiple analyzers
  70. 4. Results from VirusTotal, hybrid analysis, domain reputation, and other sources are correlated
  71. 5. A case is created in TheHive via the TheHive MCP Server to track the investigation
  72. 6. The combined intelligence provides context for incident response decisions
  73. 7. Findings can be used to update Wazuh rules or trigger additional monitoring
  74. ## Requirements
  75. - An MCP (Model Context Protocol) compatible LLM client (e.g., Claude Desktop)
  76. - A running Wazuh server (v4.12 recommended) with the API enabled and accessible.
  77. - Network connectivity between this server and the Wazuh API (if API interaction is used).
  78. ## Installation
  79. ### Option 1: Download Pre-built Binary (Recommended)
  80. 1. **Download the Binary:**
  81. * Go to the [Releases page](https://github.com/gbrigandi/mcp-server-wazuh/releases) of the `mcp-server-wazuh` GitHub repository.
  82. * Download the appropriate binary for your operating system (e.g., `mcp-server-wazuh-linux-amd64`, `mcp-server-wazuh-macos-amd64`, `mcp-server-wazuh-macos-arm64`, `mcp-server-wazuh-windows-amd64.exe`).
  83. * Make the downloaded binary executable (e.g., `chmod +x mcp-server-wazuh-linux-amd64`).
  84. * (Optional) Rename it to something simpler like `mcp-server-wazuh` and move it to a directory in your system's `PATH` for easier access.
  85. ### Option 2: Docker
  86. 1. **Pull the Docker Image:**
  87. ```bash
  88. docker pull ghcr.io/gbrigandi/mcp-server-wazuh:latest
  89. ```
  90. ### Option 3: Build from Source
  91. 1. **Prerequisites:**
  92. * Install Rust: [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)
  93. 2. **Build:**
  94. ```bash
  95. git clone https://github.com/gbrigandi/mcp-server-wazuh.git
  96. cd mcp-server-wazuh
  97. # Build with stdio transport only (default)
  98. cargo build --release
  99. # Build with HTTP transport support
  100. cargo build --release --features http
  101. ```
  102. The binary will be available at `target/release/mcp-server-wazuh`.
  103. ### Configure Your LLM Client
  104. The method for configuring your LLM client will vary depending on the client itself. For clients that support MCP (Model Context Protocol), you will typically need to point the client to the path of the `mcp-server-wazuh` executable.
  105. **Example for Claude Desktop:**
  106. Configure your `claude_desktop_config.json` file:
  107. ```json
  108. {
  109. "mcpServers": {
  110. "wazuh": {
  111. "command": "/path/to/mcp-server-wazuh",
  112. "args": [],
  113. "env": {
  114. "WAZUH_API_HOST": "your_wazuh_manager_api_host",
  115. "WAZUH_API_PORT": "55000",
  116. "WAZUH_API_USERNAME": "your_wazuh_api_user",
  117. "WAZUH_API_PASSWORD": "your_wazuh_api_password",
  118. "WAZUH_INDEXER_HOST": "your_wazuh_indexer_host",
  119. "WAZUH_INDEXER_PORT": "9200",
  120. "WAZUH_INDEXER_USERNAME": "your_wazuh_indexer_user",
  121. "WAZUH_INDEXER_PASSWORD": "your_wazuh_indexer_password",
  122. "WAZUH_VERIFY_SSL": "false",
  123. "WAZUH_TEST_PROTOCOL": "https",
  124. "RUST_LOG": "info"
  125. }
  126. }
  127. }
  128. }
  129. ```
  130. Replace `/path/to/mcp-server-wazuh` with the actual path to your binary and configure the environment variables as detailed in the [Configuration](#configuration) section.
  131. Once configured, your LLM client should be able to launch and communicate with the `mcp-server-wazuh` to access Wazuh security data.
  132. If using Docker, create a `.env` file with your Wazuh configuration:
  133. ```bash
  134. WAZUH_API_HOST=your_wazuh_manager_api_host
  135. WAZUH_API_PORT=55000
  136. WAZUH_API_USERNAME=your_wazuh_api_user
  137. WAZUH_API_PASSWORD=your_wazuh_api_password
  138. WAZUH_INDEXER_HOST=your_wazuh_indexer_host
  139. WAZUH_INDEXER_PORT=9200
  140. WAZUH_INDEXER_USERNAME=your_wazuh_indexer_user
  141. WAZUH_INDEXER_PASSWORD=your_wazuh_indexer_password
  142. WAZUH_VERIFY_SSL=false
  143. WAZUH_TEST_PROTOCOL=https
  144. RUST_LOG=info
  145. ```
  146. Configure your `claude_desktop_config.json` file:
  147. ```
  148. {
  149. "mcpServers": {
  150. "wazuh": {
  151. "command": "docker",
  152. "args": [
  153. "run", "--rm", "-i",
  154. "--env-file", "/path/to/your/.env",
  155. "ghcr.io/gbrigandi/mcp-server-wazuh:latest"
  156. ]
  157. }
  158. }
  159. }
  160. ```
  161. ## Configuration
  162. Configuration is managed through environment variables. A `.env` file can be placed in the project root for local development.
  163. | Variable | Description | Default | Required |
  164. | ------------------------ | ------------------------------------------------------------------------------ | ----------- | -------- |
  165. | `WAZUH_API_HOST` | Hostname or IP address of the Wazuh Manager API server. | `localhost` | Yes |
  166. | `WAZUH_API_PORT` | Port number for the Wazuh Manager API. | `55000` | Yes |
  167. | `WAZUH_API_USERNAME` | Username for Wazuh Manager API authentication. | `wazuh` | Yes |
  168. | `WAZUH_API_PASSWORD` | Password for Wazuh Manager API authentication. | `wazuh` | Yes |
  169. | `WAZUH_INDEXER_HOST` | Hostname or IP address of the Wazuh Indexer API server. | `localhost` | Yes |
  170. | `WAZUH_INDEXER_PORT` | Port number for the Wazuh Indexer API. | `9200` | Yes |
  171. | `WAZUH_INDEXER_USERNAME` | Username for Wazuh Indexer API authentication. | `admin` | Yes |
  172. | `WAZUH_INDEXER_PASSWORD` | Password for Wazuh Indexer API authentication. | `admin` | Yes |
  173. | `WAZUH_VERIFY_SSL` | Set to `true` to verify SSL certificates for Wazuh API and Indexer connections. | `false` | No |
  174. | `WAZUH_TEST_PROTOCOL` | Protocol for Wazuh connections (e.g., "http", "https"). Overrides client default. | `https` | No |
  175. | `RUST_LOG` | Log level (e.g., `info`, `debug`, `trace`). | `info` | No |
  176. **Note on `WAZUH_VERIFY_SSL`:** For production environments, it is strongly recommended to set `WAZUH_VERIFY_SSL=true` and ensure proper certificate validation for both Wazuh Manager API and Wazuh Indexer connections. Setting it to `false` disables certificate checks, which is insecure.
  177. The "Required: Yes" indicates that these variables are essential for the server to connect to the respective Wazuh components. While defaults are provided, they are unlikely to match a production or non-local setup.
  178. ## Building
  179. ### Prerequisites
  180. - Install Rust: [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)
  181. - Install Docker and Docker Compose (optional, for containerized deployment): [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/)
  182. ### Local Development
  183. 1. **Clone the repository:**
  184. ```bash
  185. git clone https://github.com/gbrigandi/mcp-server-wazuh.git
  186. cd mcp-server-wazuh
  187. ```
  188. 2. **Configure (if using Wazuh API):**
  189. - Copy the example environment file: `cp .env.example .env`
  190. - Edit the `.env` file with your specific Wazuh API details (e.g. `WAZUH_API_HOST`, `WAZUH_API_PORT`).
  191. 3. **Build:**
  192. ```bash
  193. # Build with default features (stdio transport only)
  194. cargo build
  195. # Build with HTTP transport support
  196. cargo build --features http
  197. ```
  198. 4. **Run:**
  199. ```bash
  200. # Run with stdio transport (default)
  201. cargo run
  202. # Run with HTTP transport (requires --features http during build)
  203. cargo run --features http -- --transport http
  204. # Or use the run script (which might set up stdio mode):
  205. # ./run.sh
  206. ```
  207. ## Transport Modes
  208. The Wazuh MCP Server supports two transport modes for communication with MCP clients:
  209. ### stdio Transport (Default)
  210. The stdio transport is the default mode, ideal for local integrations where the MCP client launches the server as a child process. Communication occurs via stdin/stdout using JSON-RPC 2.0 messages.
  211. ```bash
  212. # Run with stdio transport (default)
  213. mcp-server-wazuh
  214. # Explicit stdio transport
  215. mcp-server-wazuh --transport stdio
  216. ```
  217. ### Streamable HTTP Transport
  218. The HTTP transport enables remote server deployment, allowing MCP clients to connect over the network. This mode implements the MCP Streamable HTTP specification with Server-Sent Events (SSE) support.
  219. ```bash
  220. # Run with HTTP transport on default address (127.0.0.1:8080)
  221. mcp-server-wazuh --transport http
  222. # Run with custom host and port
  223. mcp-server-wazuh --transport http --host 0.0.0.0 --port 3000
  224. ```
  225. **HTTP Transport Features:**
  226. - Single `/mcp` endpoint for all MCP communication
  227. - POST requests with JSON-RPC messages
  228. - Server-Sent Events (SSE) for streaming responses
  229. - Session management with `MCP-Session-Id` header
  230. - Protocol version: `2025-06-18` (MCP spec supported by rmcp 0.10)
  231. **Security Note:** By default, HTTP transport binds to `127.0.0.1` (localhost only). When binding to `0.0.0.0` for remote access, ensure proper network security measures (firewall rules, reverse proxy with TLS, etc.) are in place.
  232. ### CLI Arguments
  233. | Argument | Description | Default |
  234. |----------|-------------|---------|
  235. | `--transport` | Transport mode: `stdio` or `http` | `stdio` |
  236. | `--host` | HTTP server bind address (only for http transport) | `127.0.0.1` |
  237. | `--port` | HTTP server port (only for http transport) | `8080` |
  238. ## Architecture
  239. The server is built using the [rmcp](https://crates.io/crates/rmcp) framework (v0.10+) and facilitates communication between MCP clients (e.g., Claude Desktop, IDE extensions) and the Wazuh MCP Server. The server supports both stdio and Streamable HTTP transports and interacts with the Wazuh Indexer and Wazuh Manager APIs to fetch security alerts and other data.
  240. ```mermaid
  241. sequenceDiagram
  242. participant ClientApp as Client Application (e.g., IDE Extension / Claude Desktop)
  243. participant WazuhMCPServer as Wazuh MCP Server (this application)
  244. participant WazuhAPI as Wazuh API
  245. ClientApp->>+WazuhMCPServer: (stdio) MCP Initialize
  246. WazuhMCPServer-->>-ClientApp: (stdout) MCP Initialized
  247. ClientApp->>+WazuhMCPServer: (stdio) MCP Request (tools/list)
  248. WazuhMCPServer->>WazuhMCPServer: Parse MCP Request
  249. WazuhMCPServer->>WazuhMCPServer: Process internally
  250. WazuhMCPServer-->>-ClientApp: (stdout) MCP Response (available tools)
  251. ClientApp->>+WazuhMCPServer: (stdio) MCP Request (tools/call for wazuhAlerts)
  252. WazuhMCPServer->>WazuhMCPServer: Parse MCP Request
  253. WazuhMCPServer->>+WazuhAPI: Request Wazuh Alerts (with WAZUH_API_USERNAME, WAZUH_API_PASSWORD)
  254. WazuhAPI-->>-WazuhMCPServer: Wazuh Alert Data (JSON)
  255. WazuhMCPServer->>WazuhMCPServer: Transform Wazuh Alerts to MCP Format
  256. WazuhMCPServer-->>-ClientApp: (stdout) MCP Response (alerts)
  257. ```
  258. **Data Flow (stdio focus):**
  259. 1. An application (e.g., an IDE extension, a CLI tool) launches the Wazuh MCP Server as a child process.
  260. 2. The application sends MCP-formatted requests (commands) to the server's `stdin`.
  261. 3. The Wazuh MCP Server reads the command from `stdin`.
  262. 4. **Processing:**
  263. * The server parses the MCP command.
  264. * If the command requires fetching data from Wazuh (e.g., "get latest alerts"):
  265. * The server connects to the Wazuh API (authenticating if necessary using configured credentials like `WAZUH_API_USERNAME`, `WAZUH_API_PASSWORD`).
  266. * It fetches the required data (e.g., security alerts).
  267. * The server's transformation logic processes each alert, mapping Wazuh fields to MCP format.
  268. * If the command is internal (e.g., a status check specific to the MCP server), it processes it directly.
  269. 5. The server sends an MCP-formatted JSON response (e.g., transformed alerts, command acknowledgment, or error messages) to the application via its `stdout`.
  270. 6. The application reads and processes the MCP response from the server's `stdout`.
  271. This stdio interaction allows for tight integration with local development tools or other applications that can manage child processes. An optional HTTP endpoint (`/mcp`) may also be available for clients that prefer polling.
  272. The server communicates via `stdin` and `stdout` using JSON-RPC 2.0 messages, adhering to the Model Context Protocol (MCP).
  273. Example interaction flow:
  274. 1. **Client Application (e.g., IDE extension) starts the `mcp-server-wazuh` process.**
  275. 2. **Client sends `initialize` request to server's `stdin`:**
  276. ```json
  277. {
  278. "jsonrpc": "2.0",
  279. "id": 0,
  280. "method": "initialize",
  281. "params": {
  282. "protocolVersion": "2025-06-18",
  283. "capabilities": {
  284. "sampling": {},
  285. "roots": { "listChanged": true }
  286. },
  287. "clientInfo": {
  288. "name": "mcp-inspector",
  289. "version": "0.11.0"
  290. }
  291. }
  292. }
  293. ```
  294. 3. **Server sends `initialize` response to client via `stdout`:**
  295. ```json
  296. {
  297. "jsonrpc": "2.0",
  298. "id": 1,
  299. "result": {
  300. "protocolVersion": "2025-06-18",
  301. "capabilities": {
  302. "prompts": {},
  303. "resources": {},
  304. "tools": {}
  305. },
  306. "serverInfo": {
  307. "name": "mcp-server-wazuh",
  308. "version": "0.3.0"
  309. },
  310. "instructions": "This server provides tools to interact with a Wazuh SIEM instance for security monitoring and analysis.\nAvailable tools:\n- 'get_wazuh_alert_summary': Retrieves a summary of Wazuh security alerts. Optionally takes 'limit' parameter to control the number of alerts returned (defaults to 100)."
  311. }
  312. }
  313. ```
  314. 4. **Client sends `notifications/initialized` to server's `stdin`:**
  315. (This is a notification, so `id` is omitted by the client.)
  316. ```json
  317. {
  318. "jsonrpc": "2.0",
  319. "method": "notifications/initialized"
  320. }
  321. ```
  322. 5. **Client requests available tools by sending `tools/list` to server's `stdin`:**
  323. ```json
  324. {
  325. "jsonrpc": "2.0",
  326. "id": 1,
  327. "method": "tools/list",
  328. "params": {}
  329. }
  330. ```
  331. 6. **Server responds with the list of tools to client via `stdout`:**
  332. ```json
  333. {
  334. "jsonrpc": "2.0",
  335. "id": 2,
  336. "result": {
  337. "tools": [
  338. {
  339. "name": "get_wazuh_alert_summary",
  340. "description": "Retrieves a summary of Wazuh security alerts. Returns formatted alert information including ID, timestamp, and description.",
  341. "inputSchema": {
  342. "$schema": "http://json-schema.org/draft-07/schema#",
  343. "properties": {
  344. "limit": {
  345. "description": "Maximum number of alerts to retrieve (default: 100)",
  346. "format": "uint32",
  347. "minimum": 0.0,
  348. "type": ["integer", "null"]
  349. }
  350. },
  351. "title": "GetAlertSummaryParams",
  352. "type": "object"
  353. }
  354. }
  355. ]
  356. }
  357. }
  358. ```
  359. 7. **Client calls the `get_wazuh_alert_summary` tool by sending `tools/call` to server's `stdin`:**
  360. ```json
  361. {
  362. "jsonrpc": "2.0",
  363. "id": 3,
  364. "method": "tools/call",
  365. "params": {
  366. "name": "get_wazuh_alert_summary",
  367. "arguments": {
  368. "limit": 5
  369. }
  370. }
  371. }
  372. ```
  373. 8. **Server receives on `stdin`, processes the `get_wazuh_alert_summary` call (which involves querying the Wazuh Indexer API and transforming the data).**
  374. 9. **Server sends `tools/call` response with formatted alerts to client via `stdout`:**
  375. ```json
  376. {
  377. "jsonrpc": "2.0",
  378. "id": 3,
  379. "result": {
  380. "content": [
  381. {
  382. "type": "text",
  383. "text": "Alert ID: 1747091815.1212763\nTime: 2024-01-15T10:30:45.123Z\nAgent: web-server-01\nLevel: 7\nDescription: Attached USB Storage"
  384. },
  385. {
  386. "type": "text",
  387. "text": "Alert ID: 1747066333.1207112\nTime: 2024-01-15T10:25:12.456Z\nAgent: database-server\nLevel: 5\nDescription: New dpkg (Debian Package) installed."
  388. }
  389. ],
  390. "isError": false
  391. }
  392. }
  393. ```
  394. **Or, if no alerts are found:**
  395. ```json
  396. {
  397. "jsonrpc": "2.0",
  398. "id": 3,
  399. "result": {
  400. "content": [
  401. {
  402. "type": "text",
  403. "text": "No Wazuh alerts found."
  404. }
  405. ],
  406. "isError": false
  407. }
  408. }
  409. ```
  410. **Or, if there's an error connecting to Wazuh:**
  411. ```json
  412. {
  413. "jsonrpc": "2.0",
  414. "id": 3,
  415. "result": {
  416. "content": [
  417. {
  418. "type": "text",
  419. "text": "Error retrieving alerts from Wazuh: HTTP request error: connection refused"
  420. }
  421. ],
  422. "isError": true
  423. }
  424. }
  425. ```
  426. ## Development & Testing
  427. - **Code Style:** Uses standard Rust formatting (`cargo fmt`).
  428. - **Linting:** Uses Clippy (`cargo clippy`).
  429. - **Testing:** Contains unit tests for transformation logic and integration tests. For stdio, tests might involve piping input/output to a test harness. For HTTP, tests use a mock Wazuh API server (`httpmock`) and a test MCP client.
  430. ```bash
  431. # Run all tests
  432. cargo test
  433. # Run specific integration test (example for HTTP tests)
  434. # cargo test --test integration_test
  435. # Run tests with detailed logging
  436. RUST_LOG=debug cargo test
  437. ```
  438. - See `tests/README.md` for more details on running tests and using the test client CLI.
  439. ## License
  440. This project is licensed under the [MIT License](LICENSE).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.