wazuh-mcp 1.1.4 → 2.1.0

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 CHANGED
@@ -2,6 +2,10 @@
2
2
  <img src="docs/assets/wazuh-mcp-social-preview.jpg" alt="wazuh-mcp banner" width="900">
3
3
  </p>
4
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
+
5
9
  <h1 align="center">wazuh-mcp</h1>
6
10
 
7
11
  <p align="center">
@@ -40,36 +44,193 @@ npm run build
40
44
 
41
45
  ## Quickstart
42
46
 
43
- Run it straight from npm with `npx`, no clone or build required:
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 `~`:
44
99
 
45
100
  ```json
46
101
  {
47
102
  "mcpServers": {
48
103
  "wazuh": {
49
- "command": "npx",
50
- "args": ["-y", "wazuh-mcp"],
51
- "env": {
52
- "WAZUH_URL": "https://your-wazuh-manager:55000",
53
- "WAZUH_USERNAME": "wazuh-wui",
54
- "WAZUH_PASSWORD": "your-password",
55
- "WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
56
- "WAZUH_INDEXER_USERNAME": "admin",
57
- "WAZUH_INDEXER_PASSWORD": "your-indexer-password"
58
- }
104
+ "command": "/absolute/path/to/wazuh-mcp-env",
105
+ "args": ["npx", "-y", "wazuh-mcp"]
59
106
  }
60
107
  }
61
108
  }
62
109
  ```
63
110
 
64
- 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."* The indexer settings are optional: without them the agent, rule, decoder, and version tools still work, and the alert and vulnerability tools return a configuration message instead of failing.
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.
65
112
 
66
113
  Prefer a global install?
67
114
 
68
115
  ```bash
69
116
  npm install -g wazuh-mcp
70
- # then use "command": "wazuh-mcp" instead of the npx invocation above
71
117
  ```
72
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
+
73
234
  ## CLI
74
235
 
75
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.
@@ -82,11 +243,13 @@ wazuhctrl diagnostics --no-connectivity
82
243
  wazuhctrl mcp
83
244
  ```
84
245
 
85
- `wazuhctrl` reads the same environment as the MCP adapter: `WAZUH_URL`, `WAZUH_USERNAME`, `WAZUH_PASSWORD`, optional `WAZUH_INDEXER_URL`, and optional indexer credentials. Agent IP addresses stay hidden unless a command explicitly requests them.
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.
86
247
 
87
248
  ## Usage
88
249
 
89
- The quickstart `mcpServers` block at the top works for most clients. The per-client recipes below give you the exact file location or CLI command for each.
250
+ The quickstart `mcpServers` block at the top works for most clients. The per-client recipes below give you the exact file location or CLI command for each. On macOS and Linux, all of them start the server through the `wazuh-mcp-env` wrapper from the [Quickstart](#quickstart), so credentials stay in the 0600 env file. Replace `/absolute/path/to/wazuh-mcp-env` with the wrapper's full path.
251
+
252
+ The wrapper is a POSIX shell script and does not run on Windows. There, start `npx -y wazuh-mcp` directly and pass the `WAZUH_*` settings through the client: an `"env"` object on the server entry in a JSON config (see [Claude Desktop](#claude-desktop)), or one `--env KEY=value` option per setting after the server name and before the `--` in `claude mcp add` and `codex mcp add`. The settings, passwords included, then sit in the client's config file, so keep that file readable only by your account.
90
253
 
91
254
  ### Claude Desktop
92
255
 
@@ -96,32 +259,19 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
96
259
  {
97
260
  "mcpServers": {
98
261
  "wazuh": {
99
- "command": "npx",
100
- "args": ["-y", "wazuh-mcp"],
101
- "env": {
102
- "WAZUH_URL": "https://your-wazuh-manager:55000",
103
- "WAZUH_USERNAME": "wazuh-wui",
104
- "WAZUH_PASSWORD": "your-password",
105
- "WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
106
- "WAZUH_INDEXER_USERNAME": "admin",
107
- "WAZUH_INDEXER_PASSWORD": "your-indexer-password"
108
- }
262
+ "command": "/absolute/path/to/wazuh-mcp-env",
263
+ "args": ["npx", "-y", "wazuh-mcp"]
109
264
  }
110
265
  }
111
266
  }
112
267
  ```
113
268
 
269
+ On Windows, set `"command": "npx"` and `"args": ["-y", "wazuh-mcp"]`, put the `WAZUH_*` settings in an `"env"` object on the same entry, and keep `claude_desktop_config.json` readable only by your account. Setting them in your Windows user environment does not work, because Claude Desktop passes a stdio server only a short list of system variables such as `PATH` and `APPDATA`.
270
+
114
271
  ### Claude Code
115
272
 
116
273
  ```bash
117
- claude mcp add wazuh \
118
- --env WAZUH_URL=https://your-wazuh-manager:55000 \
119
- --env WAZUH_USERNAME=wazuh-wui \
120
- --env WAZUH_PASSWORD=your-password \
121
- --env WAZUH_INDEXER_URL=https://your-wazuh-indexer:9200 \
122
- --env WAZUH_INDEXER_USERNAME=admin \
123
- --env WAZUH_INDEXER_PASSWORD=your-indexer-password \
124
- -- npx -y wazuh-mcp
274
+ claude mcp add wazuh -- /absolute/path/to/wazuh-mcp-env npx -y wazuh-mcp
125
275
  ```
126
276
 
127
277
  Add `--scope user` to make it available from any directory instead of only the current project.
@@ -131,14 +281,7 @@ Add `--scope user` to make it available from any directory instead of only the c
131
281
  [Codex CLI](https://github.com/openai/codex) registers MCP servers via `codex mcp add`:
132
282
 
133
283
  ```bash
134
- codex mcp add wazuh \
135
- --env WAZUH_URL=https://your-wazuh-manager:55000 \
136
- --env WAZUH_USERNAME=wazuh-wui \
137
- --env WAZUH_PASSWORD=your-password \
138
- --env WAZUH_INDEXER_URL=https://your-wazuh-indexer:9200 \
139
- --env WAZUH_INDEXER_USERNAME=admin \
140
- --env WAZUH_INDEXER_PASSWORD=your-indexer-password \
141
- -- npx -y wazuh-mcp
284
+ codex mcp add wazuh -- /absolute/path/to/wazuh-mcp-env npx -y wazuh-mcp
142
285
  ```
143
286
 
144
287
  Codex writes the entry to `~/.codex/config.toml` under `[mcp_servers.wazuh]`. Verify with `codex mcp list`.
@@ -149,33 +292,17 @@ With the npm package:
149
292
 
150
293
  ```bash
151
294
  openclaw mcp set wazuh '{
152
- "command": "npx",
153
- "args": ["-y", "wazuh-mcp"],
154
- "env": {
155
- "WAZUH_URL": "https://your-wazuh-manager:55000",
156
- "WAZUH_USERNAME": "wazuh-wui",
157
- "WAZUH_PASSWORD": "your-password",
158
- "WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
159
- "WAZUH_INDEXER_USERNAME": "admin",
160
- "WAZUH_INDEXER_PASSWORD": "your-indexer-password"
161
- }
295
+ "command": "/absolute/path/to/wazuh-mcp-env",
296
+ "args": ["npx", "-y", "wazuh-mcp"]
162
297
  }'
163
298
  ```
164
299
 
165
- Or, when running from a source checkout, point `command`/`args` at the built `dist/mcp-bin.js`:
300
+ Or, when running from a source checkout, point `args` at the built `dist/mcp-bin.js`:
166
301
 
167
302
  ```bash
168
303
  openclaw mcp set wazuh '{
169
- "command": "node",
170
- "args": ["/absolute/path/to/wazuh-mcp/dist/mcp-bin.js"],
171
- "env": {
172
- "WAZUH_URL": "https://your-wazuh-manager:55000",
173
- "WAZUH_USERNAME": "wazuh-wui",
174
- "WAZUH_PASSWORD": "your-password",
175
- "WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
176
- "WAZUH_INDEXER_USERNAME": "admin",
177
- "WAZUH_INDEXER_PASSWORD": "your-indexer-password"
178
- }
304
+ "command": "/absolute/path/to/wazuh-mcp-env",
305
+ "args": ["node", "/absolute/path/to/wazuh-mcp/dist/mcp-bin.js"]
179
306
  }'
180
307
  ```
181
308
 
@@ -193,15 +320,8 @@ openclaw mcp list # confirm "wazuh" is registered
193
320
  ```yaml
194
321
  mcp_servers:
195
322
  wazuh:
196
- command: "npx"
197
- args: ["-y", "wazuh-mcp"]
198
- env:
199
- WAZUH_URL: "https://your-wazuh-manager:55000"
200
- WAZUH_USERNAME: "wazuh-wui"
201
- WAZUH_PASSWORD: "your-password"
202
- WAZUH_INDEXER_URL: "https://your-wazuh-indexer:9200"
203
- WAZUH_INDEXER_USERNAME: "admin"
204
- WAZUH_INDEXER_PASSWORD: "your-indexer-password"
323
+ command: "/absolute/path/to/wazuh-mcp-env"
324
+ args: ["npx", "-y", "wazuh-mcp"]
205
325
  ```
206
326
 
207
327
  Then reload MCP from inside a Hermes session with `/reload-mcp`.
@@ -209,10 +329,7 @@ Then reload MCP from inside a Hermes session with `/reload-mcp`.
209
329
  ### Standalone
210
330
 
211
331
  ```bash
212
- export WAZUH_URL=https://your-wazuh-manager:55000
213
- export WAZUH_USERNAME=wazuh-wui
214
- export WAZUH_PASSWORD=your-password
215
- npx -y wazuh-mcp
332
+ ~/.local/bin/wazuh-mcp-env npx -y wazuh-mcp
216
333
  ```
217
334
 
218
335
  ### Development
@@ -225,7 +342,7 @@ npm test # Run tests
225
342
 
226
343
  ## MCP Tools
227
344
 
228
- All 28 tools are read-only.
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.
229
346
 
230
347
  ### Agent Tools
231
348
 
@@ -311,13 +428,16 @@ Set the following environment variables:
311
428
 
312
429
  | Variable | Required | Default | Description |
313
430
  |----------|----------|---------|-------------|
314
- | `WAZUH_URL` | Yes | - | Wazuh API URL (e.g., `https://192.0.2.2:55000`) |
315
- | `WAZUH_USERNAME` | Yes | - | API username |
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)). |
316
433
  | `WAZUH_PASSWORD` | Yes | - | API password |
317
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. |
318
437
  | `WAZUH_TIMEOUT` | No | `30` | Request timeout in seconds. Must be a positive integer. |
319
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. |
320
- | `WAZUH_MCP_MAX_RESPONSE_BYTES` | No | `250000` | Maximum MCP tool response size before returning a truncated preview with metadata. |
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. |
321
441
 
322
442
  Alternative variable names `WAZUH_BASE_URL` and `WAZUH_USER` are also supported.
323
443
 
@@ -327,14 +447,17 @@ Wazuh 4.x stores alerts and vulnerability inventory in the Wazuh Indexer (OpenSe
327
447
 
328
448
  | Variable | Required | Default | Description |
329
449
  |----------|----------|---------|-------------|
330
- | `WAZUH_INDEXER_URL` | No | - | Wazuh Indexer URL (e.g., `https://192.0.2.2:9200`) |
331
- | `WAZUH_INDEXER_USERNAME` | No | `admin` | Indexer username |
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`). |
332
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. |
333
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. |
334
455
  | `WAZUH_INDEXER_TIMEOUT` | No | `30` | Indexer request timeout in seconds. Must be a positive integer. |
335
456
 
336
457
  If `WAZUH_INDEXER_URL` is not set, alert and vulnerability tools will return a helpful configuration message. All other tools (agents, rules, decoders, version) work without the indexer.
337
458
 
459
+ Indexer searches count at most 10000 matching hits and carry a 30-second server-side `timeout`. When the real match count is higher, `pagination.total_is_lower_bound` is `true` and `total` is 10000. Alert and vulnerability tools accept `offset` up to 9999 and reject requests where `offset + limit` exceeds 10000 (OpenSearch's default `max_result_window`); narrow the query with filters or a time range instead of paging deeper.
460
+
338
461
  SSL certificate verification is enabled by default (secure by default). When either SSL verification setting is explicitly set to `false`, the server prints a startup warning to stderr. TLS verification is disabled only for that configured Wazuh client.
339
462
 
340
463
  ### Sensitive Output Defaults
@@ -354,7 +477,7 @@ Several tools return minimized output by default to avoid exposing raw logs, IPs
354
477
 
355
478
  ### Untrusted SIEM Content
356
479
 
357
- Alert and log fields originate on monitored endpoints: anyone who can write a log line to a monitored host (a failed SSH login with a crafted username, a web request path, a syslog message) controls the text that lands in `full_log`, alert `rule_description`, raw event `data`, and manager log descriptions. To blunt prompt injection against the calling agent, the server wraps those values in `<untrusted_siem_data>...</untrusted_siem_data>` markers, includes an `output.untrusted_data_note` warning in affected responses, and states in the tool descriptions that the content is attacker-influenced data, never instructions to follow.
480
+ Alert, log, and inventory fields originate on monitored endpoints: anyone who can write a log line to a monitored host (a failed SSH login with a crafted username, a web request path, a syslog message) or control a process, package, file, or hostname on it controls the text that lands in `full_log`, alert `rule_description`, `agent_name`, `location`, and `decoder`, raw event `data`, manager log descriptions, agent names and OS fields, syscollector process/package/port/interface/hotfix fields, FIM paths and owners, rootcheck events, SCA policy and check text, and vulnerability package and description fields. To blunt prompt injection against the calling agent, the server wraps those values in `<untrusted_siem_data>...</untrusted_siem_data>` markers, includes an `output.untrusted_data_note` warning in affected responses, and states in the tool descriptions that the content is attacker-influenced data, never instructions to follow.
358
481
 
359
482
  ### Input Validation
360
483
 
@@ -380,11 +503,11 @@ Transient manager `GET` requests and indexer search/readiness requests retry bri
380
503
 
381
504
  ## Prerequisites
382
505
 
383
- - Node.js 20+
506
+ - Node.js 22+
384
507
  <!-- content-guard: allow port-reference -->
385
508
  - A running Wazuh manager with API access (default port 55000)
386
- - Wazuh API credentials (username/password)
387
- - (Optional) Wazuh Indexer (OpenSearch) access for alert queries
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
388
511
 
389
512
  ## MCP Resources
390
513
 
@@ -442,7 +565,7 @@ and their compliance framework mappings.
442
565
 
443
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.
444
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.
445
- - **Not a hosted service.** It runs locally as a stdio MCP server next to your client. Your Wazuh credentials stay on your machine and in your client's config.
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.
446
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.
447
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.
448
571
 
@@ -505,3 +628,11 @@ wazuh-mcp/
505
628
  ## License
506
629
 
507
630
  MIT. See [LICENSE](LICENSE).
631
+
632
+ ---
633
+
634
+ <p align="center"><a href="https://lidless.dev">Part of <strong>Lidless Labs</strong></a> &middot; the eye does not close</p>
635
+
636
+ <p align="center"><sub><strong>Security / SOC:</strong> <a href="https://github.com/lidless-labs/soc-stack">soc-stack</a> &middot; <a href="https://github.com/lidless-labs/misp-mcp">misp-mcp</a> &middot; <a href="https://github.com/lidless-labs/suricata-mcp">suricata-mcp</a> &middot; <a href="https://github.com/lidless-labs/thehive-mcp">thehive-mcp</a> &middot; <a href="https://github.com/lidless-labs/cortex-mcp">cortex-mcp</a> &middot; <a href="https://github.com/lidless-labs/mitre-mcp">mitre-mcp</a> &middot; <a href="https://github.com/lidless-labs/zeek-mcp">zeek-mcp</a> &middot; <a href="https://github.com/lidless-labs/hotwash">hotwash</a></sub></p>
637
+
638
+ <p align="center"><sub><a href="https://lidless.dev">All tools</a> &middot; <a href="https://github.com/lidless-labs">Lidless Labs on GitHub</a></sub></p>