wazuh-mcp 2.1.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -592
- package/dist/{chunk-JDIXLCOH.js → chunk-3YIRVVWE.js} +1106 -205
- package/dist/chunk-3YIRVVWE.js.map +1 -0
- package/dist/cli.d.ts +3 -2
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{indexer-client-DYVRA6rG.d.ts → indexer-client-CAyg0lws.d.ts} +136 -12
- package/dist/mcp-bin.d.ts +1 -1
- package/dist/mcp-bin.js +3 -2
- package/dist/mcp-bin.js.map +1 -1
- package/dist/mcp-http-DE7Q2DUW.js +251 -0
- package/dist/mcp-http-DE7Q2DUW.js.map +1 -0
- package/package.json +14 -4
- package/dist/chunk-JDIXLCOH.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,638 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="docs/assets/wazuh-mcp-social-preview.jpg" alt="wazuh-mcp banner" width="900">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<p align="center">
|
|
6
|
-
<a href="https://lidless.dev"><img src="docs/assets/marks/wazuh-mcp-circle.png" width="48" alt="Lidless Labs"></a>
|
|
7
|
-
</p>
|
|
8
|
-
|
|
9
|
-
<h1 align="center">wazuh-mcp</h1>
|
|
10
|
-
|
|
11
|
-
<p align="center">
|
|
12
|
-
<strong>A read-only Wazuh SIEM/XDR control CLI and MCP adapter for alerts, agents, vulnerabilities, rules, and more.</strong>
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
<p align="center">
|
|
16
|
-
<strong>Website:</strong> <a href="https://lidless.dev/wazuh-mcp">lidless.dev/wazuh-mcp</a>
|
|
17
|
-
</p>
|
|
18
|
-
|
|
19
|
-
<p align="center">
|
|
20
|
-
<img src="https://shieldcn.dev/github/ci/lidless-labs/wazuh-mcp.svg?branch=main&workflow=ci.yml" alt="CI status">
|
|
21
|
-
<img src="https://shieldcn.dev/npm/wazuh-mcp.svg" alt="npm version">
|
|
22
|
-
<img src="https://shieldcn.dev/badge/MCP-server-8A2BE2.svg" alt="MCP server">
|
|
23
|
-
<img src="https://shieldcn.dev/badge/license-MIT-green.svg" alt="MIT License">
|
|
24
|
-
<img src="https://shieldcn.dev/badge/Wazuh-SIEM%2FXDR-3385ff.svg" alt="Wazuh SIEM/XDR">
|
|
25
|
-
<img src="https://shieldcn.dev/badge/MITRE_ATT%26CK-mapped-0f766e.svg" alt="MITRE ATT&CK mapped">
|
|
26
|
-
</p>
|
|
27
|
-
|
|
28
|
-
wazuhctrl is a read-only control CLI for the [Wazuh](https://wazuh.com/) SIEM/XDR platform. The same package ships `wazuh-mcp`, a [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) adapter that exposes your Wazuh manager and Wazuh Indexer as MCP tools so Claude, Claude Code, or any MCP-compatible client can investigate alerts, triage agents, and pull vulnerability inventory in plain language. It is read-only by design and security-first: TLS verification is on by default, sensitive fields (agent IPs, full logs, file hashes, command lines) are hidden unless you opt in per call, and attacker-controlled SIEM text is wrapped in untrusted-data markers to blunt prompt injection against the calling model.
|
|
1
|
+
# wazuh-mcp
|
|
29
2
|
|
|
30
3
|
## What it does
|
|
31
4
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Installation
|
|
35
|
-
|
|
36
|
-
The quickstart below runs the published npm package with `npx`, which is the recommended path. To work from source instead:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
git clone https://github.com/lidless-labs/wazuh-mcp.git
|
|
40
|
-
cd wazuh-mcp
|
|
41
|
-
npm install
|
|
42
|
-
npm run build
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Quickstart
|
|
46
|
-
|
|
47
|
-
The quickstart runs the published npm package with `npx` under two dedicated accounts: a Wazuh API user with the built-in `readonly` role and a Wazuh Indexer user whose custom role reads only the alert and vulnerability indices. Create both with [Least-privilege setup](#least-privilege-setup) first. Do not point the server at the `wazuh-wui` API administrator or the indexer `admin` superuser.
|
|
48
|
-
|
|
49
|
-
Put the settings in a file that only you can read:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
mkdir -p -m 700 ~/.config/wazuh-mcp
|
|
53
|
-
touch ~/.config/wazuh-mcp/env
|
|
54
|
-
chmod 600 ~/.config/wazuh-mcp/env
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Then fill it in with your editor:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
WAZUH_URL=https://your-wazuh-manager:55000
|
|
61
|
-
WAZUH_USERNAME=wazuh-mcp-api
|
|
62
|
-
WAZUH_PASSWORD='the-api-user-password'
|
|
63
|
-
WAZUH_CA_FILE=/path/to/root-ca.pem
|
|
64
|
-
WAZUH_INDEXER_URL=https://your-wazuh-indexer:9200
|
|
65
|
-
WAZUH_INDEXER_USERNAME=wazuh-mcp-indexer
|
|
66
|
-
WAZUH_INDEXER_PASSWORD='the-indexer-user-password'
|
|
67
|
-
WAZUH_INDEXER_CA_FILE=/path/to/root-ca.pem
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The wrapper below reads this file as shell code, so keep each password in single quotes. Write a single quote inside a password as `'\''`, or choose a password without one.
|
|
71
|
-
|
|
72
|
-
To run without the indexer, leave out all four `WAZUH_INDEXER_*` lines. The agent, rule, decoder, and version tools still work, and the alert and vulnerability tools return a configuration message instead of failing. If you keep `WAZUH_INDEXER_URL`, you also need `WAZUH_INDEXER_USERNAME` and `WAZUH_INDEXER_PASSWORD`, or the server stops at startup. `WAZUH_INDEXER_CA_FILE` stays optional. [TLS verification](#tls-verification) explains which CA file to use.
|
|
73
|
-
|
|
74
|
-
Save this wrapper as `~/.local/bin/wazuh-mcp-env`. It loads the file and then runs the command that follows it, so no password appears in client config:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
mkdir -p ~/.local/bin
|
|
78
|
-
cat > ~/.local/bin/wazuh-mcp-env <<'EOF'
|
|
79
|
-
#!/bin/sh
|
|
80
|
-
# Load wazuh-mcp settings from a 0600 file, then run the given command.
|
|
81
|
-
set -eu
|
|
82
|
-
set -a
|
|
83
|
-
. "${WAZUH_MCP_ENV_FILE:-$HOME/.config/wazuh-mcp/env}"
|
|
84
|
-
set +a
|
|
85
|
-
exec "$@"
|
|
86
|
-
EOF
|
|
87
|
-
chmod 755 ~/.local/bin/wazuh-mcp-env
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Check both logins, TLS, and the indexer role from a shell before you wire up a client:
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
~/.local/bin/wazuh-mcp-env npx -y --package wazuh-mcp wazuhctrl diagnostics
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
It prints `diagnostics status=` and one line per check, and it exits 1 when a check reports an error. It does not check the API user's role, because logging in and reading the API version need no permission. wazuh-mcp 2.0.0 and earlier print nothing and exit 0 here because of a bin-symlink bug (see the [CHANGELOG](CHANGELOG.md)), so no output means the check did not run. In that case, wire up the client and ask it to run `diagnose_wazuh_connection`, which runs the same checks.
|
|
97
|
-
|
|
98
|
-
Then register the wrapper as the server command. Most MCP clients start the command without a shell, so use the full path to the wrapper instead of `~`:
|
|
99
|
-
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"mcpServers": {
|
|
103
|
-
"wazuh": {
|
|
104
|
-
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
105
|
-
"args": ["npx", "-y", "wazuh-mcp"]
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Drop that into your MCP client's server config (see [Usage](#usage) for the exact file per client), restart the client, and ask it something like *"list the active Wazuh agents"* or *"search alerts for brute force in the last 24 hours."* If your client expands environment variables in its config, you can reference variables from the client's own environment instead of using the wrapper. On macOS and Linux, never paste a literal password into client config. The wrapper does not run on Windows, and [Usage](#usage) covers that case.
|
|
112
|
-
|
|
113
|
-
Prefer a global install?
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
npm install -g wazuh-mcp
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Then use `"args": ["wazuh-mcp"]` instead of the npx invocation above.
|
|
120
|
-
|
|
121
|
-
## Least-privilege setup
|
|
122
|
-
|
|
123
|
-
wazuh-mcp only reads, so neither account needs write or administrator rights. The permissions below were checked against Wazuh 4.14.8: the `readonly` API role covered every manager tool, and the indexer role covered the alert and vulnerability tools plus both index checks in `diagnose_wazuh_connection`. The commands run once as an administrator, need `curl` and `jq`, and read passwords with `read -rs` (bash or zsh) so they stay out of shell history. The administrator password passed to `curl -u` and the API token passed with `-H` can still appear briefly in the process list, so run the commands on a host where no other user can see your processes.
|
|
124
|
-
|
|
125
|
-
### TLS verification
|
|
126
|
-
|
|
127
|
-
Keep `WAZUH_VERIFY_SSL` and `WAZUH_INDEXER_VERIFY_SSL` at their default of `true`. Instead of turning verification off, point `WAZUH_CA_FILE` and `WAZUH_INDEXER_CA_FILE` at the root CA that signed your Wazuh certificates. On the Docker deployment that file is `wazuh-docker/single-node/config/wazuh_indexer_ssl_certs/root-ca.pem` (`multi-node/` for a cluster). The host in each URL must be a name or address listed in that service's certificate. The single-node Docker certificates are issued for `wazuh.indexer` and `wazuh.manager`, so either reach the services by those names, for example through `/etc/hosts` entries, or regenerate the certificates with your host names in `config/certs.yml`.
|
|
128
|
-
|
|
129
|
-
On a Linux host, Docker creates that directory as root, and the certificate generator sets it to mode 0500 and the files in it to 0400. Only root can read the files from the host, even if your account has user ID 1000, which owns most of them. Copy the CA to a file you own, and use the copy for both settings and for `CA_FILE` in the setup commands below:
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
mkdir -p -m 700 ~/.config/wazuh-mcp
|
|
133
|
-
sudo cat wazuh-docker/single-node/config/wazuh_indexer_ssl_certs/root-ca.pem > ~/.config/wazuh-mcp/root-ca.pem
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
<!-- content-guard: allow localhost-bare -->
|
|
137
|
-
On the Docker deployment the indexer certificate is already signed by that CA. The manager API certificate is not: unless you supply one, the API generates a self-signed certificate for `localhost` at startup, and that certificate fails verification against `root-ca.pem`. Replace it with a certificate signed by the root CA, saved as `server.crt` and `server.key` in the manager's `/var/ossec/api/configuration/ssl/`, and restart the manager. The same `root-ca.pem` then works for `WAZUH_CA_FILE`. The setup commands below verify TLS the same way, so do this step first.
|
|
138
|
-
|
|
139
|
-
On single-node Docker, the certificate generator already created a manager certificate signed by the root CA, `wazuh.manager.pem` and its key `wazuh.manager-key.pem`, and the manager container mounts them as `/etc/ssl/filebeat.pem` and `/etc/ssl/filebeat.key`. The API directory is on a Docker volume inside the container, so copy them there and restart the Wazuh daemons inside the container, from `wazuh-docker/single-node`:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
docker compose exec wazuh.manager sh -c 'cp /etc/ssl/filebeat.pem /var/ossec/api/configuration/ssl/server.crt && cp /etc/ssl/filebeat.key /var/ossec/api/configuration/ssl/server.key'
|
|
143
|
-
docker compose exec wazuh.manager /var/ossec/bin/wazuh-control restart
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
The API makes the `wazuh` user the owner of both files when it starts, and the copies stay on the volume across restarts.
|
|
147
|
-
|
|
148
|
-
On a package install, the root CA is `/etc/filebeat/certs/root-ca.pem` on the server node, and `filebeat.pem` and `filebeat-key.pem` in that directory are a server certificate signed by it. That directory is readable only by root, so copy those files with `sudo`.
|
|
149
|
-
|
|
150
|
-
### Wazuh API user with the `readonly` role
|
|
151
|
-
|
|
152
|
-
The built-in `readonly` role reads agents, groups, rules, decoders, SCA, FIM, rootcheck, syscollector inventory, and manager and cluster status, configuration, and logs. That covers every manager tool. It also reads CDB lists, CIS-CAT results, MITRE data, and the API configuration, which no tool uses, and it changes nothing. It has no `security:*` permissions, so it cannot read or change other users, roles, policies, or the security configuration. Like every API user, it can still read its own account and policies at `/security/users/me` and `/security/users/me/policies`. New API users start with `allow_run_as` disabled, which is what this server needs. Sign in once as an existing API administrator (`wazuh` or `wazuh-wui`) to create the user:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
WAZUH_URL=https://your-wazuh-manager:55000
|
|
156
|
-
CA_FILE=/path/to/root-ca.pem
|
|
157
|
-
API_ADMIN=wazuh-wui
|
|
158
|
-
|
|
159
|
-
printf 'Password for %s: ' "$API_ADMIN"; read -rs API_ADMIN_PASSWORD; echo
|
|
160
|
-
printf 'Password for the new wazuh-mcp-api user: '; read -rs NEW_PASSWORD; echo
|
|
161
|
-
export NEW_PASSWORD
|
|
162
|
-
|
|
163
|
-
TOKEN=$(curl -sS --cacert "$CA_FILE" -u "$API_ADMIN:$API_ADMIN_PASSWORD" \
|
|
164
|
-
-X POST "$WAZUH_URL/security/user/authenticate?raw=true")
|
|
165
|
-
|
|
166
|
-
USER_ID=$(jq -n '{username: "wazuh-mcp-api", password: env.NEW_PASSWORD}' |
|
|
167
|
-
curl -sS --cacert "$CA_FILE" -X POST "$WAZUH_URL/security/users" \
|
|
168
|
-
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" --data-binary @- |
|
|
169
|
-
jq -r '.data.affected_items[0].id')
|
|
170
|
-
|
|
171
|
-
ROLE_ID=$(curl -sS --cacert "$CA_FILE" "$WAZUH_URL/security/roles" \
|
|
172
|
-
-H "Authorization: Bearer $TOKEN" |
|
|
173
|
-
jq -r '.data.affected_items[] | select(.name == "readonly") | .id')
|
|
174
|
-
|
|
175
|
-
echo "user id: $USER_ID, readonly role id: $ROLE_ID"
|
|
176
|
-
|
|
177
|
-
curl -sS --cacert "$CA_FILE" -X POST \
|
|
178
|
-
"$WAZUH_URL/security/users/$USER_ID/roles?role_ids=$ROLE_ID" \
|
|
179
|
-
-H "Authorization: Bearer $TOKEN"
|
|
180
|
-
|
|
181
|
-
unset API_ADMIN_PASSWORD NEW_PASSWORD TOKEN
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Both IDs must be numbers. If the user ID prints as `null`, run the `POST /security/users` request again without the final `jq` to see the API message. The usual causes are a password that breaks the rules (8 to 64 characters with an uppercase letter, a lowercase letter, a number, and a symbol), a `wazuh-mcp-api` user left over from an earlier run, or a wrong administrator password. The last request answers with `All roles were linked to user wazuh-mcp-api`.
|
|
185
|
-
|
|
186
|
-
### Wazuh Indexer user and role
|
|
187
|
-
|
|
188
|
-
The server sends `GET /` for cluster info, which needs the cluster permission `cluster:monitor/main`. Its `HEAD` index checks and `_search` queries go to `wazuh-alerts-*` and `wazuh-states-vulnerabilities*`. The vulnerability indices themselves are named `wazuh-states-vulnerabilities-` plus a suffix, so the role pattern below covers them. The role is read-only and limited to those two index families. Wazuh's documented read-only recipe (`cluster_composite_ops_ro` plus `read` on `*`) can search, but it gets HTTP 403 on both index checks in `diagnose_wazuh_connection` and can read every index. These commands use the indexer security REST API as the `admin` user:
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
INDEXER_URL=https://your-wazuh-indexer:9200
|
|
192
|
-
CA_FILE=/path/to/root-ca.pem
|
|
193
|
-
|
|
194
|
-
printf 'Password for the indexer admin user: '; read -rs INDEXER_ADMIN_PASSWORD; echo
|
|
195
|
-
printf 'Password for the new wazuh-mcp-indexer user: '; read -rs NEW_PASSWORD; echo
|
|
196
|
-
export NEW_PASSWORD
|
|
197
|
-
|
|
198
|
-
curl -sS --cacert "$CA_FILE" -u "admin:$INDEXER_ADMIN_PASSWORD" -X PUT \
|
|
199
|
-
"$INDEXER_URL/_plugins/_security/api/roles/wazuh_mcp_read" \
|
|
200
|
-
-H "Content-Type: application/json" -d '{
|
|
201
|
-
"cluster_permissions": ["cluster:monitor/main"],
|
|
202
|
-
"index_permissions": [{
|
|
203
|
-
"index_patterns": ["wazuh-alerts-*", "wazuh-states-vulnerabilities-*"],
|
|
204
|
-
"allowed_actions": ["read", "indices:admin/get"]
|
|
205
|
-
}]
|
|
206
|
-
}'
|
|
207
|
-
|
|
208
|
-
jq -n '{password: env.NEW_PASSWORD}' |
|
|
209
|
-
curl -sS --cacert "$CA_FILE" -u "admin:$INDEXER_ADMIN_PASSWORD" -X PUT \
|
|
210
|
-
"$INDEXER_URL/_plugins/_security/api/internalusers/wazuh-mcp-indexer" \
|
|
211
|
-
-H "Content-Type: application/json" --data-binary @-
|
|
212
|
-
|
|
213
|
-
curl -sS --cacert "$CA_FILE" -u "admin:$INDEXER_ADMIN_PASSWORD" -X PUT \
|
|
214
|
-
"$INDEXER_URL/_plugins/_security/api/rolesmapping/wazuh_mcp_read" \
|
|
215
|
-
-H "Content-Type: application/json" -d '{"users": ["wazuh-mcp-indexer"]}'
|
|
216
|
-
|
|
217
|
-
unset INDEXER_ADMIN_PASSWORD NEW_PASSWORD
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Each request answers with `"status":"CREATED"` the first time and `"status":"OK"` on a rerun. The indexer rejects a weak password, or one too close to the user name, with `"status":"error"`, so check that the `internalusers` request printed `CREATED` or `OK` before you continue. To do the same in the Wazuh dashboard, open **Indexer management** > **Security**, create the user under **Internal users**, create a role with the permissions above under **Roles**, and add the user on that role's **Mapped users** tab.
|
|
221
|
-
|
|
222
|
-
The `wazuh_mcp_read` role only reads, but it is not the only role the account gets. Default Wazuh indexer installs map every internal user to the built-in `own_index` role (`users: ["*"]` in `roles_mapping.yml`). That role allows all index actions on an index named after the user, so `wazuh-mcp-indexer` can create, write to, and delete an index called `wazuh-mcp-indexer`. To list the roles the account holds, run this request. curl prompts for the password, and the `roles` list shows `own_index` and `wazuh_mcp_read`:
|
|
223
|
-
|
|
224
|
-
```bash
|
|
225
|
-
curl -sS --cacert "$CA_FILE" -u wazuh-mcp-indexer "$INDEXER_URL/_plugins/_security/authinfo"
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
Removing `"*"` from the `own_index` mapping takes that role away from every internal user, not only this one.
|
|
229
|
-
|
|
230
|
-
Running `securityadmin.sh -cd`, which Wazuh's Docker password-change steps do, reloads the security configuration from the YAML files and deletes users, roles, and mappings created through the REST API. After such a run, send the three requests above again. Keeping them in the YAML files instead needs more than an edit. On Docker only `config/wazuh_indexer/internal_users.yml` is mounted from the host, so `roles.yml` and `roles_mapping.yml` need bind mounts of their own, or edits to them are lost when the container is recreated. The `internal_users.yml` entry also takes a `hash:` value from `plugins/opensearch-security/tools/hash.sh`, not the password.
|
|
231
|
-
|
|
232
|
-
With both accounts created, go back to [Quickstart](#quickstart) and write the env file.
|
|
233
|
-
|
|
234
|
-
## CLI
|
|
235
|
-
|
|
236
|
-
The package ships `wazuhctrl` for shells, cron, and CI. Compatibility alias `wazuhctl` points at the same binary, and `wazuh-mcp` remains the MCP stdio adapter.
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
wazuhctrl status --json
|
|
240
|
-
wazuhctrl agents list --limit 20
|
|
241
|
-
wazuhctrl diagnostics
|
|
242
|
-
wazuhctrl diagnostics --no-connectivity
|
|
243
|
-
wazuhctrl mcp
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
`wazuhctrl` reads the same environment as the MCP adapter: `WAZUH_URL`, `WAZUH_USERNAME`, `WAZUH_PASSWORD`, optional `WAZUH_INDEXER_URL`, and the indexer credentials that become required once it is set. The [Quickstart](#quickstart) wrapper works for it too, for example `~/.local/bin/wazuh-mcp-env wazuhctrl diagnostics` after a global install. Agent IP addresses stay hidden unless a command explicitly requests them.
|
|
247
|
-
|
|
248
|
-
## Usage
|
|
5
|
+
wazuh-mcp connects an MCP client to Wazuh SIEM/XDR. Use it to list agents, inspect rules and inventory, search alerts, or check vulnerability findings. The package also ships a read-only command-line client.
|
|
249
6
|
|
|
250
|
-
|
|
7
|
+
## Install
|
|
251
8
|
|
|
252
|
-
|
|
9
|
+
This guide covers the published package `wazuh-mcp@3.0.0`. It requires Node.js 22 or later. The release's CI matrix covers Node.js 22 and 24. [Release manifest](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/package.json) · [CI workflow](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/.github/workflows/ci.yml)
|
|
253
10
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
257
|
-
|
|
258
|
-
```json
|
|
259
|
-
{
|
|
260
|
-
"mcpServers": {
|
|
261
|
-
"wazuh": {
|
|
262
|
-
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
263
|
-
"args": ["npx", "-y", "wazuh-mcp"]
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
11
|
+
```sh
|
|
12
|
+
npm install --global wazuh-mcp@3.0.0
|
|
267
13
|
```
|
|
268
14
|
|
|
269
|
-
|
|
15
|
+
The package installs `wazuh-mcp` for the MCP server and `wazuhctrl` for the CLI, with `wazuhctl` as a CLI alias. Run `wazuhctrl --help` for commands such as `status`, `agents list`, and `diagnostics`.
|
|
270
16
|
|
|
271
|
-
|
|
17
|
+
## Configure
|
|
272
18
|
|
|
273
|
-
|
|
274
|
-
claude mcp add wazuh -- /absolute/path/to/wazuh-mcp-env npx -y wazuh-mcp
|
|
275
|
-
```
|
|
19
|
+
Set these variables in the server or CLI process environment. Supply passwords through that environment using your secret store.
|
|
276
20
|
|
|
277
|
-
|
|
21
|
+
| Service | URL variable and example | Required credentials |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| Wazuh manager REST API | `WAZUH_URL=https://manager.example:55000` | `WAZUH_USERNAME`, `WAZUH_PASSWORD` |
|
|
24
|
+
| Wazuh Indexer (optional) | `WAZUH_INDEXER_URL=https://indexer.example:9200` | `WAZUH_INDEXER_USERNAME`, `WAZUH_INDEXER_PASSWORD` when the indexer URL is set |
|
|
278
25
|
|
|
279
|
-
|
|
26
|
+
The manager also accepts `WAZUH_BASE_URL` and `WAZUH_USER` as aliases for its URL and username. The manager client exchanges its credentials for a JWT and uses that JWT for REST reads. The indexer client uses HTTP Basic authentication for OpenSearch. With only the manager configured, alert and vulnerability tools stay listed and return indexer setup guidance. [Configuration](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/src/config.ts)
|
|
280
27
|
|
|
281
|
-
|
|
28
|
+
### Upstream TLS
|
|
282
29
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
30
|
+
| Setting | Manager | Indexer |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| Verify certificates (default `true`, set `false` to disable) | `WAZUH_VERIFY_SSL` | `WAZUH_INDEXER_VERIFY_SSL` |
|
|
33
|
+
| PEM CA bundle file | `WAZUH_CA_FILE` | `WAZUH_INDEXER_CA_FILE` |
|
|
34
|
+
| Override the certificate identity checked against the peer | `WAZUH_TLS_SERVERNAME` | `WAZUH_INDEXER_TLS_SERVERNAME` |
|
|
35
|
+
| Request timeout in seconds (default `30`) | `WAZUH_TIMEOUT` | `WAZUH_INDEXER_TIMEOUT` |
|
|
286
36
|
|
|
287
|
-
|
|
37
|
+
Use a CA bundle for a privately issued certificate. The identity override accepts a bare DNS name or IP address and keeps certificate chain verification in place when verification is enabled. Both upstream URLs require HTTPS by default. `WAZUH_ALLOW_INSECURE_HTTP=true` permits plain HTTP for either upstream. [TLS identity handling](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/src/tls-identity.ts)
|
|
288
38
|
|
|
289
|
-
###
|
|
39
|
+
### MCP transports
|
|
290
40
|
|
|
291
|
-
|
|
41
|
+
For **stdio**, configure your MCP client to launch `wazuh-mcp` with the settings above. To run the same version without a global install, use this command:
|
|
292
42
|
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
296
|
-
"args": ["npx", "-y", "wazuh-mcp"]
|
|
297
|
-
}'
|
|
43
|
+
```sh
|
|
44
|
+
npm exec --yes --package=wazuh-mcp@3.0.0 -- wazuh-mcp
|
|
298
45
|
```
|
|
299
46
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
openclaw mcp set wazuh '{
|
|
304
|
-
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
305
|
-
"args": ["node", "/absolute/path/to/wazuh-mcp/dist/mcp-bin.js"]
|
|
306
|
-
}'
|
|
307
|
-
```
|
|
47
|
+
For **Streamable HTTP**, set `WAZUH_MCP_HTTP_TOKEN` to a separate token of at least 32 characters after trimming whitespace and run `wazuh-mcp --http`. Generate a token with `openssl rand -hex 32`. Point the client at `/mcp` on the listener and have it send the token in the `Authorization: Bearer` header.
|
|
308
48
|
|
|
309
|
-
|
|
49
|
+
The listener serves plain HTTP on IPv4 loopback port 3120 by default. Override the bind address and port with `WAZUH_MCP_HTTP_HOST` and `WAZUH_MCP_HTTP_PORT`. The server rejects wildcard binds and tokens that reuse upstream credentials. It accepts the bound host or a loopback alias in the Host header. If an Origin header is present, it must be an HTTP or HTTPS loopback origin. HTTP request bodies are capped at 1 MiB. `GET /healthz` returns `{"status":"ok"}` without a token. Every holder of the bearer token shares the configured accounts' privileges. [MCP entry point](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/src/mcp-bin.ts) · [HTTP transport](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/src/mcp-http.ts)
|
|
310
50
|
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
|
|
51
|
+
```mermaid
|
|
52
|
+
flowchart LR
|
|
53
|
+
Client[MCP client] -->|stdio| Server[wazuh-mcp]
|
|
54
|
+
Client -->|HTTP with bearer token| Server
|
|
55
|
+
Server -->|REST with JWT| Manager[Wazuh manager]
|
|
56
|
+
Server -->|Basic auth| Indexer[Wazuh Indexer / OpenSearch]
|
|
314
57
|
```
|
|
315
58
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
[Hermes Agent](https://github.com/NousResearch/hermes-agent) reads MCP config from `~/.hermes/config.yaml` under the `mcp_servers` key. Add an entry:
|
|
319
|
-
|
|
320
|
-
```yaml
|
|
321
|
-
mcp_servers:
|
|
322
|
-
wazuh:
|
|
323
|
-
command: "/absolute/path/to/wazuh-mcp-env"
|
|
324
|
-
args: ["npx", "-y", "wazuh-mcp"]
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
Then reload MCP from inside a Hermes session with `/reload-mcp`.
|
|
328
|
-
|
|
329
|
-
### Standalone
|
|
330
|
-
|
|
331
|
-
```bash
|
|
332
|
-
~/.local/bin/wazuh-mcp-env npx -y wazuh-mcp
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
### Development
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
npm run dev # Watch mode with tsx
|
|
339
|
-
npm run lint # Type checking
|
|
340
|
-
npm test # Run tests
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
## MCP Tools
|
|
344
|
-
|
|
345
|
-
All 28 tools are read-only, and each one declares the MCP tool annotations `readOnlyHint: true` and `openWorldHint: true`. The tools query only your own Wazuh deployment, but most of what they return originates on monitored endpoints (see [Untrusted SIEM Content](#untrusted-siem-content)), so clients should treat the output as untrusted.
|
|
346
|
-
|
|
347
|
-
### Agent Tools
|
|
348
|
-
|
|
349
|
-
| Tool | Description |
|
|
350
|
-
|------|-------------|
|
|
351
|
-
| `list_agents` | List all agents with optional status filtering (active, disconnected, never_connected, pending) |
|
|
352
|
-
| `get_agent` | Get detailed info for a specific agent by ID |
|
|
353
|
-
| `get_agent_stats` | Get CPU, memory, and disk statistics for an agent |
|
|
354
|
-
|
|
355
|
-
### Alert Tools
|
|
356
|
-
|
|
357
|
-
| Tool | Description |
|
|
358
|
-
|------|-------------|
|
|
359
|
-
| `get_alerts` | Retrieve recent alerts with filtering by time range, level, agent, rule, and text search |
|
|
360
|
-
| `get_alert` | Retrieve a single alert by ID |
|
|
361
|
-
| `search_alerts` | Full-text search across alerts with optional time range filtering |
|
|
362
|
-
|
|
363
|
-
### Vulnerability Tools
|
|
364
|
-
|
|
365
|
-
| Tool | Description |
|
|
366
|
-
|------|-------------|
|
|
367
|
-
| `list_vulnerabilities` | List vulnerability inventory with optional CVE, agent, severity, and package filters |
|
|
368
|
-
| `search_vulnerabilities` | Search vulnerability inventory by CVE, package, agent, or description |
|
|
369
|
-
|
|
370
|
-
### Rule Tools
|
|
371
|
-
|
|
372
|
-
| Tool | Description |
|
|
373
|
-
|------|-------------|
|
|
374
|
-
| `list_rules` | List detection rules with level and group filtering |
|
|
375
|
-
| `get_rule` | Get full rule details including compliance mappings |
|
|
376
|
-
| `search_rules` | Search rules by description text |
|
|
377
|
-
|
|
378
|
-
### SCA Tools (Security Configuration Assessment)
|
|
379
|
-
|
|
380
|
-
| Tool | Description |
|
|
381
|
-
|------|-------------|
|
|
382
|
-
| `get_sca_policies` | List SCA policies and scores for an agent (CIS benchmarks, etc.) |
|
|
383
|
-
| `get_sca_checks` | Get individual check results with remediation steps and compliance mappings |
|
|
384
|
-
|
|
385
|
-
### Syscollector Tools (System Inventory)
|
|
386
|
-
|
|
387
|
-
| Tool | Description |
|
|
388
|
-
|------|-------------|
|
|
389
|
-
| `get_agent_os` | Get OS information (name, version, architecture, hostname) |
|
|
390
|
-
| `get_agent_packages` | List installed software packages with versions |
|
|
391
|
-
| `get_agent_processes` | List running processes with PIDs and command lines |
|
|
392
|
-
| `get_agent_ports` | List open network ports with associated processes |
|
|
393
|
-
| `get_agent_network` | List network interfaces and IP addresses |
|
|
394
|
-
| `get_agent_hotfixes` | List installed Windows hotfixes/patches |
|
|
395
|
-
|
|
396
|
-
### FIM & Rootcheck Tools
|
|
397
|
-
|
|
398
|
-
| Tool | Description |
|
|
399
|
-
|------|-------------|
|
|
400
|
-
| `get_fim_files` | Get File Integrity Monitoring results (files, registry keys, hashes) |
|
|
401
|
-
| `get_rootcheck` | Get rootkit detection scan findings |
|
|
402
|
-
|
|
403
|
-
### Manager Tools
|
|
404
|
-
|
|
405
|
-
| Tool | Description |
|
|
406
|
-
|------|-------------|
|
|
407
|
-
| `get_manager_logs` | Get Wazuh manager logs filtered by level and module |
|
|
408
|
-
| `get_manager_config` | Get active manager configuration by section with secret-like values redacted by default |
|
|
409
|
-
|
|
410
|
-
### Group Tools
|
|
411
|
-
|
|
412
|
-
| Tool | Description |
|
|
413
|
-
|------|-------------|
|
|
414
|
-
| `list_groups` | List all agent groups |
|
|
415
|
-
| `get_group_agents` | List agents in a specific group |
|
|
416
|
-
|
|
417
|
-
### Other Tools
|
|
418
|
-
|
|
419
|
-
| Tool | Description |
|
|
420
|
-
|------|-------------|
|
|
421
|
-
| `list_decoders` | List log decoders with optional name filtering |
|
|
422
|
-
| `get_wazuh_version` | Get Wazuh manager version and API info |
|
|
423
|
-
| `diagnose_wazuh_connection` | Check sanitized configuration, URL/TLS settings, manager auth/version, and indexer readiness |
|
|
424
|
-
|
|
425
|
-
## Configuration
|
|
426
|
-
|
|
427
|
-
Set the following environment variables:
|
|
428
|
-
|
|
429
|
-
| Variable | Required | Default | Description |
|
|
430
|
-
|----------|----------|---------|-------------|
|
|
431
|
-
| `WAZUH_URL` | Yes | - | Wazuh API URL (e.g., `https://192.0.2.2:55000`). Must be `https://` (or `http://` with `WAZUH_ALLOW_INSECURE_HTTP=true`), and must not contain embedded credentials, a query string, or a fragment. A path prefix for a reverse proxy is allowed. |
|
|
432
|
-
| `WAZUH_USERNAME` | Yes | - | API username. Use a dedicated user with the built-in `readonly` role (see [Least-privilege setup](#least-privilege-setup)). |
|
|
433
|
-
| `WAZUH_PASSWORD` | Yes | - | API password |
|
|
434
|
-
| `WAZUH_VERIFY_SSL` | No | `true` | Verifies SSL certificates by default. Set to `false` (also accepts `0`/`no`/`off`) to disable verification for trusted self-signed lab environments only. |
|
|
435
|
-
| `WAZUH_CA_FILE` | No | - | Path to a PEM CA bundle used to verify the manager's TLS certificate (private CA or self-signed). Read at startup. The server exits with an error if the file cannot be read. Prefer this over `WAZUH_VERIFY_SSL=false`. See [TLS verification](#tls-verification) for the Docker deployment's root CA and the manager's default self-signed certificate. |
|
|
436
|
-
| `WAZUH_ALLOW_INSECURE_HTTP` | No | `false` | Allow plain `http://` for `WAZUH_URL` and `WAZUH_INDEXER_URL`. When unset, `http://` URLs are rejected at startup. When enabled and in use, the server prints a startup warning to stderr. Trusted lab networks only. |
|
|
437
|
-
| `WAZUH_TIMEOUT` | No | `30` | Request timeout in seconds. Must be a positive integer. |
|
|
438
|
-
| `WAZUH_ALLOW_SENSITIVE_CONFIG` | No | `false` | Server-side gate for `get_manager_config`. When unset/`false`, sensitive configuration values are always redacted even if the tool's `include_sensitive_config` argument is `true`. Set to `true` (also accepts `1`/`yes`/`on`) to allow unredacted output when explicitly requested. |
|
|
439
|
-
| `WAZUH_MCP_MAX_RESPONSE_BYTES` | No | `250000` | Maximum MCP tool response size before returning a truncated preview with metadata. Values below `1024` are raised to `1024`. The truncated envelope itself always fits within the cap. |
|
|
440
|
-
| `WAZUH_MCP_MAX_STDIO_BUFFER_BYTES` | No | `8388608` (8 MiB) | Maximum stdio read-buffer size in bytes. Must be a positive integer. A single client message exceeding it makes the transport error and close. |
|
|
59
|
+
## Tools
|
|
441
60
|
|
|
442
|
-
|
|
61
|
+
Version 3.0.0 exposes **46 tools**, 3 resources, and 3 prompts over both MCP transports. [Tool registration](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/src/mcp-server.ts)
|
|
443
62
|
|
|
444
|
-
|
|
63
|
+
| Task | Examples |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| Agent and inventory checks | `list_agents`, `get_agent_packages`, `get_fim_files` |
|
|
66
|
+
| Manager and cluster checks | `list_rules`, `get_manager_status`, `get_cluster_nodes` |
|
|
67
|
+
| Alert and vulnerability searches | `search_alerts`, `aggregate_alerts`, `search_vulnerabilities` |
|
|
68
|
+
| Connection diagnostics | `diagnose_wazuh_connection` |
|
|
445
69
|
|
|
446
|
-
|
|
70
|
+
`WAZUH_MCP_MAX_RESPONSE_BYTES` defaults to 90,000 bytes with a minimum of 1,024 bytes. Oversized tool responses return a JSON preview with `output.response_truncated`. Paginated indexer calls require `offset + limit` to stay within 10,000. When an indexer search reports a lower bound for the total, `pagination.total_is_lower_bound` is true. [Response formatting](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/src/tools/output.ts) · [Indexer client](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/src/indexer-client.ts)
|
|
447
71
|
|
|
448
|
-
|
|
449
|
-
|----------|----------|---------|-------------|
|
|
450
|
-
| `WAZUH_INDEXER_URL` | No | - | Wazuh Indexer URL (e.g., `https://192.0.2.2:9200`). Same URL rules as `WAZUH_URL`. |
|
|
451
|
-
| `WAZUH_INDEXER_USERNAME` | Yes, when `WAZUH_INDEXER_URL` is set | - | Indexer username. Use a dedicated indexer user with a read-only role (see [Least-privilege setup](#least-privilege-setup), including the `own_index` note). The server fails fast at startup if `WAZUH_INDEXER_URL` is set without it. There is no `admin` default (2.0.0 and earlier fell back to `admin`). |
|
|
452
|
-
| `WAZUH_INDEXER_PASSWORD` | Yes, when `WAZUH_INDEXER_URL` is set | - | Indexer password. The server fails fast at startup if `WAZUH_INDEXER_URL` is set without it. |
|
|
453
|
-
| `WAZUH_INDEXER_VERIFY_SSL` | No | `true` | Verifies SSL certificates by default. Set to `false` (also accepts `0`/`no`/`off`) to disable verification for trusted self-signed lab environments only. |
|
|
454
|
-
| `WAZUH_INDEXER_CA_FILE` | No | - | Path to a PEM CA bundle used to verify the indexer's TLS certificate, for example the deployment's `root-ca.pem`. Read at startup. The server exits with an error if the file cannot be read. |
|
|
455
|
-
| `WAZUH_INDEXER_TIMEOUT` | No | `30` | Indexer request timeout in seconds. Must be a positive integer. |
|
|
72
|
+
## Safety
|
|
456
73
|
|
|
457
|
-
|
|
74
|
+
- Both the CLI and MCP server are read-only by design. Upstream POSTs are limited to manager JWT authentication and indexer `_search` requests. Use a read-only manager account and restrict the indexer account to the alert and vulnerability indices it needs.
|
|
75
|
+
- Tools validate input before sending it upstream. Agent IPs, full alert logs, file hashes, and process command lines require explicit opt-ins on the relevant calls. `get_manager_config` always redacts credential-bearing keys.
|
|
76
|
+
- Tools mark endpoint-supplied text with `<untrusted_siem_data>` where it appears in affected responses. MCP clients should treat the marked text as data. [Security policy](SECURITY.md)
|
|
458
77
|
|
|
459
|
-
|
|
78
|
+
## Why not other Wazuh MCP servers?
|
|
460
79
|
|
|
461
|
-
|
|
80
|
+
| Tool | Runtime | Write access | Prompt-injection / field guards | Local CLI included |
|
|
81
|
+
| --- | --- | --- | --- | --- |
|
|
82
|
+
| **wazuh-mcp** | Node.js / TypeScript (`npx`) | Read-only by design | Minimizes IPs/hashes/logs by default, wraps endpoint strings in `<untrusted_siem_data>` | Yes (`wazuhctrl`) |
|
|
83
|
+
| `gensecaihq/Wazuh-MCP-Server` | Python | Includes active-response writes | Configurable | No |
|
|
84
|
+
| `socfortress/wazuh-mcp-server` | Python | Read/query focused | Standard | No |
|
|
85
|
+
| `gbrigandi/mcp-server-wazuh` | Rust | Read/query focused | Standard | No |
|
|
462
86
|
|
|
463
|
-
|
|
87
|
+
Pick `gensecaihq/Wazuh-MCP-Server` if you want Python with OAuth 2.1 and active-response actions. Pick `wazuh-mcp` if you want a strict read-only Node/TypeScript server with default data minimization, untrusted-data tagging, and a matching shell CLI (`wazuhctrl`).
|
|
464
88
|
|
|
465
|
-
|
|
89
|
+
## FAQ
|
|
466
90
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
| `list_agents`, `get_agent`, `get_group_agents` | Agent IP details | `include_ip: true` |
|
|
470
|
-
| `get_alerts`, `search_alerts` | `full_log` | `include_full_log: true` |
|
|
471
|
-
| `get_alert` | `full_log`, raw `data` | `include_full_log: true`, `include_raw_data: true` |
|
|
472
|
-
| `list_vulnerabilities`, `search_vulnerabilities` | Vulnerability descriptions | `include_description: true` |
|
|
473
|
-
| `get_agent_processes` | Process command lines and arguments | `include_command: true` |
|
|
474
|
-
| `get_fim_files` | MD5 and SHA-256 hashes | `include_hashes: true` |
|
|
475
|
-
| `get_manager_logs` | Full log descriptions | `include_description: true` |
|
|
476
|
-
| `get_manager_config` | Secret-like config values | `include_sensitive_config: true` (only honored when the server-side `WAZUH_ALLOW_SENSITIVE_CONFIG` flag is enabled; otherwise always redacted) |
|
|
91
|
+
**Can an AI agent modify Wazuh rules, active response, or agent state through `wazuh-mcp`?**
|
|
92
|
+
No. Upstream POST requests are limited to manager JWT authentication and indexer `_search` queries.
|
|
477
93
|
|
|
478
|
-
|
|
94
|
+
**Does `wazuh-mcp` work with Claude Code, Claude Desktop, Cursor, and Codex?**
|
|
95
|
+
Yes. Run it over stdio via `npx -y wazuh-mcp` or over loopback Streamable HTTP with `wazuh-mcp --http` and a bearer token.
|
|
479
96
|
|
|
480
|
-
|
|
97
|
+
**Do I need the Wazuh Indexer configured to start?**
|
|
98
|
+
No. Manager-only credentials work for agents, rules, decoders, SCA, and diagnostics. Add `WAZUH_INDEXER_URL` when you want alert and vulnerability search.
|
|
481
99
|
|
|
482
|
-
|
|
100
|
+
## Part of Lidless Labs
|
|
483
101
|
|
|
484
|
-
|
|
102
|
+
`wazuh-mcp` is maintained by [Lidless Labs](https://lidless.dev) ([GitHub](https://github.com/lidless-labs)). Related SOC and threat-hunting tools:
|
|
485
103
|
|
|
486
|
-
|
|
104
|
+
- [soc-stack](https://github.com/lidless-labs/soc-stack) - one-command Proxmox SOC lab with Wazuh, TheHive, Cortex, MISP, Zeek, and Suricata
|
|
105
|
+
- [suricata-mcp](https://github.com/lidless-labs/suricata-mcp) - Suricata IDS/IPS EVE JSON alerts and rule workflows over MCP
|
|
106
|
+
- [zeek-mcp](https://github.com/lidless-labs/zeek-mcp) - Zeek and Suricata NSM log querying and C2 hunting over MCP
|
|
107
|
+
- [thehive-mcp](https://github.com/lidless-labs/thehive-mcp) - TheHive 5 case management and alert triage over MCP
|
|
108
|
+
- [mitre-mcp](https://github.com/lidless-labs/mitre-mcp) - local MITRE ATT&CK mapping and coverage analysis over MCP
|
|
487
109
|
|
|
488
|
-
|
|
110
|
+
## Development
|
|
489
111
|
|
|
490
|
-
|
|
112
|
+
Run these commands from a source checkout. The test suite uses mocked Wazuh services.
|
|
491
113
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
- **3 MCP Prompts** - Alert investigation, agent health checks, and security overviews
|
|
497
|
-
- **Read-only by design** - The only writes are JWT auth and indexer `_search`; no tool changes Wazuh state
|
|
498
|
-
- **Secure by default** - TLS verification on, sensitive fields redacted unless opted in, untrusted SIEM content delimited, every error sanitized before it reaches the client
|
|
499
|
-
- **JWT Authentication** - Automatic token management with refresh on expiry
|
|
500
|
-
- **Full Compliance Mapping** - PCI-DSS, GDPR, HIPAA, NIST 800-53, MITRE ATT&CK
|
|
501
|
-
- **Pagination** - All list endpoints support limit/offset pagination
|
|
502
|
-
- **Type-Safe** - Full TypeScript with strict mode and Zod schema validation
|
|
503
|
-
|
|
504
|
-
## Prerequisites
|
|
505
|
-
|
|
506
|
-
- Node.js 22+
|
|
507
|
-
<!-- content-guard: allow port-reference -->
|
|
508
|
-
- A running Wazuh manager with API access (default port 55000)
|
|
509
|
-
- Wazuh API credentials for a user with the built-in `readonly` role
|
|
510
|
-
- (Optional) A Wazuh Indexer (OpenSearch) user with a read-only role for alert and vulnerability queries
|
|
511
|
-
|
|
512
|
-
## MCP Resources
|
|
513
|
-
|
|
514
|
-
| Resource URI | Description |
|
|
515
|
-
|-------------|-------------|
|
|
516
|
-
| `wazuh://agents` | All registered agents and their status |
|
|
517
|
-
| `wazuh://alerts/recent` | 25 most recent security alerts |
|
|
518
|
-
| `wazuh://rules/summary` | Detection rules sorted by severity |
|
|
519
|
-
|
|
520
|
-
## MCP Prompts
|
|
521
|
-
|
|
522
|
-
| Prompt | Description |
|
|
523
|
-
|--------|-------------|
|
|
524
|
-
| `investigate-alert` | Step-by-step alert investigation with MITRE mapping and remediation |
|
|
525
|
-
| `agent-health-check` | Comprehensive agent health assessment (status, resources, alerts) |
|
|
526
|
-
| `security-overview` | Full environment security summary with compliance coverage |
|
|
527
|
-
|
|
528
|
-
## Examples
|
|
529
|
-
|
|
530
|
-
### List active agents
|
|
531
|
-
|
|
532
|
-
```
|
|
533
|
-
Use list_agents with status "active" to see all connected agents.
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
### Investigate a brute force attempt
|
|
537
|
-
|
|
538
|
-
```
|
|
539
|
-
Search alerts for "brute force" and investigate the top result,
|
|
540
|
-
including the MITRE ATT&CK technique and remediation steps.
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
### Check agent health
|
|
544
|
-
|
|
545
|
-
```
|
|
546
|
-
Run an agent health check on agent 001 - check its connection status,
|
|
547
|
-
resource usage, and any recent critical alerts.
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
### Find high-severity rules
|
|
551
|
-
|
|
552
|
-
```
|
|
553
|
-
List all rules with level 12 or higher to see critical detection rules
|
|
554
|
-
and their compliance framework mappings.
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
## Why not the Wazuh dashboard or the raw API?
|
|
558
|
-
|
|
559
|
-
- **The Wazuh dashboard** is built for humans clicking through Kibana-style views. It is great for a SOC analyst at a screen, but an AI agent cannot drive it, and it does not turn natural-language questions into the right manager and indexer queries. wazuh-mcp gives the model typed tools instead.
|
|
560
|
-
- **The raw Wazuh REST API + indexer `_search`** can be called directly, but then every agent has to learn JWT auth, the manager-versus-indexer split (alerts and vulnerabilities live in the indexer in Wazuh 4.x), pagination shapes, and which fields are sensitive. wazuh-mcp wraps all of that, validates inputs, caps response size, and sanitizes errors so credentials never leak back to the model.
|
|
561
|
-
- **A general "run any HTTP request" tool** would technically reach Wazuh, but it hands the model your credentials, no input validation, no read-only guarantee, and no redaction of IPs, hashes, or full logs. This server is deliberately read-only and minimizes sensitive output by default.
|
|
562
|
-
- **Writing your own Wazuh MCP shim** is reasonable, and the source here is MIT-licensed if you want to fork it. This one already handles auth refresh, the indexer fallback message, untrusted-content delimiting, transient-error retries, and 28 vetted tools.
|
|
563
|
-
|
|
564
|
-
## What wazuh-mcp is not
|
|
565
|
-
|
|
566
|
-
- **Not a write path.** No tool modifies Wazuh state. It cannot restart agents, edit rules, acknowledge alerts, or change configuration. The only writes are JWT authentication and indexer `_search` queries.
|
|
567
|
-
- **Not a replacement for the Wazuh dashboard or SIEM.** It is a query surface for AI clients, not an analyst UI, a data store, or an alerting engine.
|
|
568
|
-
- **Not a hosted service.** It runs locally as a stdio MCP server next to your client. Your Wazuh credentials stay on your machine, in the wrapper's env file or your client's config.
|
|
569
|
-
- **Not a guarantee against prompt injection.** It delimits attacker-influenced SIEM content and warns the model, which reduces risk but does not eliminate it. Treat tool output as data, not instructions.
|
|
570
|
-
- **Not a way to bypass Wazuh access control.** It uses the credentials you give it and can see only what that account can see.
|
|
571
|
-
|
|
572
|
-
## Documentation and links
|
|
573
|
-
|
|
574
|
-
- **Website:** [lidless.dev/wazuh-mcp](https://lidless.dev/wazuh-mcp)
|
|
575
|
-
- **npm:** [`wazuh-mcp`](https://www.npmjs.com/package/wazuh-mcp)
|
|
576
|
-
- **Issues:** [github.com/lidless-labs/wazuh-mcp/issues](https://github.com/lidless-labs/wazuh-mcp/issues)
|
|
577
|
-
- **Changelog:** [CHANGELOG.md](CHANGELOG.md)
|
|
578
|
-
- **Security policy:** [SECURITY.md](SECURITY.md)
|
|
579
|
-
- **Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
580
|
-
|
|
581
|
-
## Testing
|
|
582
|
-
|
|
583
|
-
```bash
|
|
584
|
-
npm test # Run all tests
|
|
585
|
-
npm run typecheck # Type-check TypeScript
|
|
586
|
-
npm audit --omit=dev # Audit production dependencies
|
|
587
|
-
npm run pack:check # Verify package contents
|
|
588
|
-
npm run test:watch # Watch mode
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
Tests use mocked Wazuh API responses - no live Wazuh instance needed.
|
|
592
|
-
|
|
593
|
-
## Project Structure
|
|
594
|
-
|
|
595
|
-
```
|
|
596
|
-
wazuh-mcp/
|
|
597
|
-
├── src/
|
|
598
|
-
│ ├── mcp-bin.ts # MCP server entry point
|
|
599
|
-
│ ├── cli.ts # wazuhctrl command entry point
|
|
600
|
-
│ ├── mcp-server.ts # shared MCP server factory
|
|
601
|
-
│ ├── config.ts # Environment configuration
|
|
602
|
-
│ ├── client.ts # Wazuh REST API client (JWT auth)
|
|
603
|
-
│ ├── indexer-client.ts # Wazuh Indexer (OpenSearch) client
|
|
604
|
-
│ ├── types.ts # TypeScript type definitions
|
|
605
|
-
│ ├── resources.ts # MCP resource handlers
|
|
606
|
-
│ ├── prompts.ts # MCP prompt templates
|
|
607
|
-
│ └── tools/
|
|
608
|
-
│ ├── agents.ts # Agent management tools
|
|
609
|
-
│ ├── alerts.ts # Alert query tools
|
|
610
|
-
│ ├── rules.ts # Rule query tools
|
|
611
|
-
│ ├── decoders.ts # Decoder listing tool
|
|
612
|
-
│ ├── version.ts # Version info tool
|
|
613
|
-
│ ├── sca.ts # Security Configuration Assessment
|
|
614
|
-
│ ├── syscollector.ts # System inventory (OS, packages, ports, etc.)
|
|
615
|
-
│ ├── syscheck.ts # File Integrity Monitoring
|
|
616
|
-
│ ├── rootcheck.ts # Rootkit detection
|
|
617
|
-
│ ├── manager.ts # Manager logs and configuration
|
|
618
|
-
│ └── groups.ts # Agent group management
|
|
619
|
-
├── tests/
|
|
620
|
-
│ ├── client.test.ts # API client unit tests
|
|
621
|
-
│ └── tools.test.ts # Tool handler unit tests
|
|
622
|
-
├── package.json
|
|
623
|
-
├── tsconfig.json
|
|
624
|
-
├── tsup.config.ts
|
|
625
|
-
└── vitest.config.ts
|
|
114
|
+
```sh
|
|
115
|
+
npm ci
|
|
116
|
+
./scripts/verify
|
|
117
|
+
npm run pack:check
|
|
626
118
|
```
|
|
627
119
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
MIT. See [LICENSE](LICENSE).
|
|
631
|
-
|
|
632
|
-
---
|
|
633
|
-
|
|
634
|
-
<p align="center"><a href="https://lidless.dev">Part of <strong>Lidless Labs</strong></a> · the eye does not close</p>
|
|
120
|
+
`./scripts/verify` runs tests, type checking, and the build. `npm run pack:check` shows the npm publish payload. [Verification script](scripts/verify) · [Contributing](CONTRIBUTING.md)
|
|
635
121
|
|
|
636
|
-
|
|
122
|
+
Releases publish from the tagged GitHub Actions workflow with npm provenance. [Publish workflow](https://github.com/lidless-labs/wazuh-mcp/blob/v3.0.0/.github/workflows/publish.yml)
|
|
637
123
|
|
|
638
|
-
|
|
124
|
+
[Changelog](CHANGELOG.md) · [MIT License](LICENSE)
|