wazuh-mcp 2.0.0 → 3.0.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 +352 -91
- package/dist/{chunk-5Q2DPBC6.js → chunk-3YIRVVWE.js} +1184 -236
- package/dist/chunk-3YIRVVWE.js.map +1 -0
- package/dist/cli.d.ts +11 -2
- package/dist/cli.js +25 -7
- package/dist/cli.js.map +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 +2 -2
- package/dist/chunk-5Q2DPBC6.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,9 +27,110 @@
|
|
|
27
27
|
|
|
28
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.
|
|
29
29
|
|
|
30
|
+
## HTTP mode
|
|
31
|
+
|
|
32
|
+
The npm package supports Streamable HTTP starting with v3.0.0. Use stdio with v2.1.0.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npx -y wazuh-mcp@3.0.0 --http
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If you [build from source](#installation), start the same HTTP listener with:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
node dist/mcp-bin.js --http
|
|
42
|
+
# The existing wazuh-mcp bin also accepts --http.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Keep the usual manager and optional indexer environment variables on the server.
|
|
46
|
+
Generate a separate HTTP token with `openssl rand -hex 32`, then set:
|
|
47
|
+
|
|
48
|
+
| Variable | Default | Purpose |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `WAZUH_MCP_HTTP_TOKEN` | Required | Independent bearer token, at least 32 characters after trimming whitespace |
|
|
51
|
+
| `WAZUH_MCP_HTTP_HOST` | IPv4 loopback | Specific listener bind address. Wildcards are refused |
|
|
52
|
+
| `WAZUH_MCP_HTTP_PORT` | `3120` | TCP port, or `0` for a free port |
|
|
53
|
+
|
|
54
|
+
Startup rejects a missing or blank token and reuse of manager or indexer
|
|
55
|
+
credentials, including passwords and Basic authorization values. Bearer tokens
|
|
56
|
+
are compared with SHA-256 digests and constant-time comparison and registered
|
|
57
|
+
with the error sanitizer.
|
|
58
|
+
|
|
59
|
+
`/mcp` accepts authenticated Streamable HTTP POST, GET, and DELETE requests.
|
|
60
|
+
`GET /healthz` needs no token and returns only `{"status":"ok"}`.
|
|
61
|
+
The Host header must name the bound host or a loopback alias. A supplied Origin
|
|
62
|
+
must be an HTTP or HTTPS loopback origin. Requests have a 1 MiB body limit,
|
|
63
|
+
a 30-second request timeout, and a 10-second header timeout. The process accepts
|
|
64
|
+
128 sessions and expires sessions idle for 30 minutes on a one-minute timer.
|
|
65
|
+
Active POST requests prevent expiry. An open idle SSE channel does not.
|
|
66
|
+
SIGTERM and SIGINT close all session transports and the listener.
|
|
67
|
+
|
|
68
|
+
Each HTTP session owns a separate MCP server. The manager client, cached JWT,
|
|
69
|
+
and in-flight login promise are shared across sessions. Concurrent initial
|
|
70
|
+
logins and token refreshes coalesce into one authentication request, and a late
|
|
71
|
+
401 for an old token reuses the replacement token. The indexer client holds only
|
|
72
|
+
upstream configuration. Tools are read-only, with no pending confirmations,
|
|
73
|
+
per-client approvals, deferred visibility sets, or mutable tool result caches.
|
|
74
|
+
Sensitive-field opt-ins belong to each call. Session deletion does not clear
|
|
75
|
+
another session's state or the shared JWT.
|
|
76
|
+
|
|
77
|
+
Every holder of the HTTP token shares the configured upstream account's read
|
|
78
|
+
privileges. Session IDs route protocol state and do not identify separate users.
|
|
79
|
+
Keep the loopback binding for local clients. Remote access needs a trusted TLS
|
|
80
|
+
proxy or tunnel and network access controls. Preserve an allowed Host header
|
|
81
|
+
through a proxy. This listener provides no TLS, OAuth, or browser CORS access.
|
|
82
|
+
Omit `--http` to retain the existing stdio behavior.
|
|
83
|
+
|
|
84
|
+
### Claude Code
|
|
85
|
+
|
|
86
|
+
Export the HTTP token in the environment that launches Claude Code. Add an HTTP
|
|
87
|
+
entry to its MCP configuration:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcpServers": {
|
|
92
|
+
"wazuh": {
|
|
93
|
+
"type": "http",
|
|
94
|
+
"url": "http://localhost:3120/mcp",
|
|
95
|
+
"headersHelper": "/path/to/helper WAZUH_MCP_HTTP_TOKEN"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The executable helper reads the named variable and prints a JSON object with the
|
|
102
|
+
Authorization header. For example, save this as the helper and make it executable:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
#!/usr/bin/env node
|
|
106
|
+
const token = process.env[process.argv[2]]
|
|
107
|
+
if (!token?.trim()) process.exit(1)
|
|
108
|
+
console.log(JSON.stringify({ Authorization: `Bearer ${token}` }))
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Codex
|
|
112
|
+
|
|
113
|
+
Export `WAZUH_MCP_HTTP_TOKEN` in the environment that launches Codex. Its value
|
|
114
|
+
must match the server's token, without the `Bearer ` prefix:
|
|
115
|
+
|
|
116
|
+
```toml
|
|
117
|
+
[mcp_servers.wazuh]
|
|
118
|
+
url = "http://localhost:3120/mcp"
|
|
119
|
+
bearer_token_env_var = "WAZUH_MCP_HTTP_TOKEN"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### systemd user service
|
|
123
|
+
|
|
124
|
+
An example unit is in [docs/systemd/wazuh-mcp-http.service](docs/systemd/wazuh-mcp-http.service).
|
|
125
|
+
Adjust its repository and Node paths, build the repository, and create the
|
|
126
|
+
referenced EnvironmentFile with mode `0600`. Put the manager credentials,
|
|
127
|
+
optional indexer credentials, and independent HTTP token in that file. The unit
|
|
128
|
+
runs the built `dist/mcp-bin.js --http` entry point with `NoNewPrivileges=true`,
|
|
129
|
+
`PrivateTmp=true`, and `UMask=0077`.
|
|
130
|
+
|
|
30
131
|
## What it does
|
|
31
132
|
|
|
32
|
-
wazuhctrl and wazuh-mcp turn a Wazuh SIEM/XDR deployment into typed operator surfaces. Point your MCP client at
|
|
133
|
+
wazuhctrl and wazuh-mcp turn a Wazuh SIEM/XDR deployment into typed operator surfaces. Point your MCP client at your Wazuh manager and optional Indexer to list agents, search alerts, aggregate alert counts, review vulnerability inventory, inspect rules, decoders and SCA results, and read system inventory (OS, hardware, packages, processes, ports, network interfaces and addresses, users, groups, services, hotfixes, and scan times). The tools also read FIM and rootcheck findings, manager logs and log summaries, manager processing statistics and configuration, and manager daemon and cluster health. The MCP adapter exposes 46 tools, 3 resources, and 3 guided prompts. Both the CLI and MCP adapter use read-only Wazuh operations. Their only POST requests are manager JWT authentication and indexer `_search` queries.
|
|
33
134
|
|
|
34
135
|
## Installation
|
|
35
136
|
|
|
@@ -44,36 +145,210 @@ npm run build
|
|
|
44
145
|
|
|
45
146
|
## Quickstart
|
|
46
147
|
|
|
47
|
-
|
|
148
|
+
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.
|
|
149
|
+
|
|
150
|
+
Put the settings in a file that only you can read:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
mkdir -p -m 700 ~/.config/wazuh-mcp
|
|
154
|
+
touch ~/.config/wazuh-mcp/env
|
|
155
|
+
chmod 600 ~/.config/wazuh-mcp/env
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Then fill it in with your editor:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
WAZUH_URL=https://your-wazuh-manager:55000
|
|
162
|
+
WAZUH_USERNAME=wazuh-mcp-api
|
|
163
|
+
WAZUH_PASSWORD='the-api-user-password'
|
|
164
|
+
WAZUH_CA_FILE=/path/to/root-ca.pem
|
|
165
|
+
WAZUH_INDEXER_URL=https://your-wazuh-indexer:9200
|
|
166
|
+
WAZUH_INDEXER_USERNAME=wazuh-mcp-indexer
|
|
167
|
+
WAZUH_INDEXER_PASSWORD='the-indexer-user-password'
|
|
168
|
+
WAZUH_INDEXER_CA_FILE=/path/to/root-ca.pem
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
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.
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
|
|
175
|
+
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:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
mkdir -p ~/.local/bin
|
|
179
|
+
cat > ~/.local/bin/wazuh-mcp-env <<'EOF'
|
|
180
|
+
#!/bin/sh
|
|
181
|
+
# Load wazuh-mcp settings from a 0600 file, then run the given command.
|
|
182
|
+
set -eu
|
|
183
|
+
set -a
|
|
184
|
+
. "${WAZUH_MCP_ENV_FILE:-$HOME/.config/wazuh-mcp/env}"
|
|
185
|
+
set +a
|
|
186
|
+
exec "$@"
|
|
187
|
+
EOF
|
|
188
|
+
chmod 755 ~/.local/bin/wazuh-mcp-env
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Check both logins, TLS, and the indexer role from a shell before you wire up a client:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
~/.local/bin/wazuh-mcp-env npx -y --package wazuh-mcp wazuhctrl diagnostics
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
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 `~`:
|
|
48
200
|
|
|
49
201
|
```json
|
|
50
202
|
{
|
|
51
203
|
"mcpServers": {
|
|
52
204
|
"wazuh": {
|
|
53
|
-
"command": "
|
|
54
|
-
"args": ["-y", "wazuh-mcp"]
|
|
55
|
-
"env": {
|
|
56
|
-
"WAZUH_URL": "https://your-wazuh-manager:55000",
|
|
57
|
-
"WAZUH_USERNAME": "wazuh-wui",
|
|
58
|
-
"WAZUH_PASSWORD": "your-password",
|
|
59
|
-
"WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
|
|
60
|
-
"WAZUH_INDEXER_USERNAME": "admin",
|
|
61
|
-
"WAZUH_INDEXER_PASSWORD": "your-indexer-password"
|
|
62
|
-
}
|
|
205
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
206
|
+
"args": ["npx", "-y", "wazuh-mcp"]
|
|
63
207
|
}
|
|
64
208
|
}
|
|
65
209
|
}
|
|
66
210
|
```
|
|
67
211
|
|
|
68
|
-
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."*
|
|
212
|
+
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.
|
|
69
213
|
|
|
70
214
|
Prefer a global install?
|
|
71
215
|
|
|
72
216
|
```bash
|
|
73
217
|
npm install -g wazuh-mcp
|
|
74
|
-
# then use "command": "wazuh-mcp" instead of the npx invocation above
|
|
75
218
|
```
|
|
76
219
|
|
|
220
|
+
Then use `"args": ["wazuh-mcp"]` instead of the npx invocation above.
|
|
221
|
+
|
|
222
|
+
## Least-privilege setup
|
|
223
|
+
|
|
224
|
+
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.
|
|
225
|
+
|
|
226
|
+
### TLS verification
|
|
227
|
+
|
|
228
|
+
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`.
|
|
229
|
+
|
|
230
|
+
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:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
mkdir -p -m 700 ~/.config/wazuh-mcp
|
|
234
|
+
sudo cat wazuh-docker/single-node/config/wazuh_indexer_ssl_certs/root-ca.pem > ~/.config/wazuh-mcp/root-ca.pem
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
<!-- content-guard: allow localhost-bare -->
|
|
238
|
+
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.
|
|
239
|
+
|
|
240
|
+
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`:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
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'
|
|
244
|
+
docker compose exec wazuh.manager /var/ossec/bin/wazuh-control restart
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The API makes the `wazuh` user the owner of both files when it starts, and the copies stay on the volume across restarts.
|
|
248
|
+
|
|
249
|
+
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`.
|
|
250
|
+
|
|
251
|
+
#### Reaching Wazuh by an address that is not in its certificate
|
|
252
|
+
|
|
253
|
+
Wazuh's default certificates are issued for loopback names only. The indexer node certificate lists `IP:127.0.0.1` as its only subject alternative name, and the manager API's default self-signed certificate lists only `DNS:localhost`. A client that reaches either service over the LAN, for example at `https://192.0.2.10:9200`, cannot verify the certificate, and the usual workaround is `WAZUH_VERIFY_SSL=false` or `WAZUH_INDEXER_VERIFY_SSL=false`, which turns off all verification.
|
|
254
|
+
|
|
255
|
+
Set `WAZUH_TLS_SERVERNAME` and `WAZUH_INDEXER_TLS_SERVERNAME` instead. The connection still goes to the host in the URL, and the certificate chain is still checked against the system roots or the file named by `WAZUH_CA_FILE` and `WAZUH_INDEXER_CA_FILE`. Only the identity check changes: the certificate must match the configured name rather than the URL host.
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
WAZUH_URL=https://192.0.2.10:55000
|
|
259
|
+
WAZUH_CA_FILE=/path/to/root-ca.pem
|
|
260
|
+
WAZUH_TLS_SERVERNAME=localhost
|
|
261
|
+
WAZUH_INDEXER_URL=https://192.0.2.10:9200
|
|
262
|
+
WAZUH_INDEXER_CA_FILE=/path/to/root-ca.pem
|
|
263
|
+
WAZUH_INDEXER_TLS_SERVERNAME=127.0.0.1
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
When the name is a DNS name it is also sent as the TLS SNI value. An IP address is never sent as SNI, because Node rejects it there. The setting has no effect while verification is disabled; `diagnose_wazuh_connection` reports a warning if you set one with `WAZUH_VERIFY_SSL=false` or `WAZUH_INDEXER_VERIFY_SSL=false`. This trusts anyone who holds a certificate for the configured name that your CA signed, so use the narrowest CA file you can.
|
|
267
|
+
|
|
268
|
+
### Wazuh API user with the `readonly` role
|
|
269
|
+
|
|
270
|
+
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:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
WAZUH_URL=https://your-wazuh-manager:55000
|
|
274
|
+
CA_FILE=/path/to/root-ca.pem
|
|
275
|
+
API_ADMIN=wazuh-wui
|
|
276
|
+
|
|
277
|
+
printf 'Password for %s: ' "$API_ADMIN"; read -rs API_ADMIN_PASSWORD; echo
|
|
278
|
+
printf 'Password for the new wazuh-mcp-api user: '; read -rs NEW_PASSWORD; echo
|
|
279
|
+
export NEW_PASSWORD
|
|
280
|
+
|
|
281
|
+
TOKEN=$(curl -sS --cacert "$CA_FILE" -u "$API_ADMIN:$API_ADMIN_PASSWORD" \
|
|
282
|
+
-X POST "$WAZUH_URL/security/user/authenticate?raw=true")
|
|
283
|
+
|
|
284
|
+
USER_ID=$(jq -n '{username: "wazuh-mcp-api", password: env.NEW_PASSWORD}' |
|
|
285
|
+
curl -sS --cacert "$CA_FILE" -X POST "$WAZUH_URL/security/users" \
|
|
286
|
+
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" --data-binary @- |
|
|
287
|
+
jq -r '.data.affected_items[0].id')
|
|
288
|
+
|
|
289
|
+
ROLE_ID=$(curl -sS --cacert "$CA_FILE" "$WAZUH_URL/security/roles" \
|
|
290
|
+
-H "Authorization: Bearer $TOKEN" |
|
|
291
|
+
jq -r '.data.affected_items[] | select(.name == "readonly") | .id')
|
|
292
|
+
|
|
293
|
+
echo "user id: $USER_ID, readonly role id: $ROLE_ID"
|
|
294
|
+
|
|
295
|
+
curl -sS --cacert "$CA_FILE" -X POST \
|
|
296
|
+
"$WAZUH_URL/security/users/$USER_ID/roles?role_ids=$ROLE_ID" \
|
|
297
|
+
-H "Authorization: Bearer $TOKEN"
|
|
298
|
+
|
|
299
|
+
unset API_ADMIN_PASSWORD NEW_PASSWORD TOKEN
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
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`.
|
|
303
|
+
|
|
304
|
+
### Wazuh Indexer user and role
|
|
305
|
+
|
|
306
|
+
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:
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
INDEXER_URL=https://your-wazuh-indexer:9200
|
|
310
|
+
CA_FILE=/path/to/root-ca.pem
|
|
311
|
+
|
|
312
|
+
printf 'Password for the indexer admin user: '; read -rs INDEXER_ADMIN_PASSWORD; echo
|
|
313
|
+
printf 'Password for the new wazuh-mcp-indexer user: '; read -rs NEW_PASSWORD; echo
|
|
314
|
+
export NEW_PASSWORD
|
|
315
|
+
|
|
316
|
+
curl -sS --cacert "$CA_FILE" -u "admin:$INDEXER_ADMIN_PASSWORD" -X PUT \
|
|
317
|
+
"$INDEXER_URL/_plugins/_security/api/roles/wazuh_mcp_read" \
|
|
318
|
+
-H "Content-Type: application/json" -d '{
|
|
319
|
+
"cluster_permissions": ["cluster:monitor/main"],
|
|
320
|
+
"index_permissions": [{
|
|
321
|
+
"index_patterns": ["wazuh-alerts-*", "wazuh-states-vulnerabilities-*"],
|
|
322
|
+
"allowed_actions": ["read", "indices:admin/get"]
|
|
323
|
+
}]
|
|
324
|
+
}'
|
|
325
|
+
|
|
326
|
+
jq -n '{password: env.NEW_PASSWORD}' |
|
|
327
|
+
curl -sS --cacert "$CA_FILE" -u "admin:$INDEXER_ADMIN_PASSWORD" -X PUT \
|
|
328
|
+
"$INDEXER_URL/_plugins/_security/api/internalusers/wazuh-mcp-indexer" \
|
|
329
|
+
-H "Content-Type: application/json" --data-binary @-
|
|
330
|
+
|
|
331
|
+
curl -sS --cacert "$CA_FILE" -u "admin:$INDEXER_ADMIN_PASSWORD" -X PUT \
|
|
332
|
+
"$INDEXER_URL/_plugins/_security/api/rolesmapping/wazuh_mcp_read" \
|
|
333
|
+
-H "Content-Type: application/json" -d '{"users": ["wazuh-mcp-indexer"]}'
|
|
334
|
+
|
|
335
|
+
unset INDEXER_ADMIN_PASSWORD NEW_PASSWORD
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
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.
|
|
339
|
+
|
|
340
|
+
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`:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
curl -sS --cacert "$CA_FILE" -u wazuh-mcp-indexer "$INDEXER_URL/_plugins/_security/authinfo"
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Removing `"*"` from the `own_index` mapping takes that role away from every internal user, not only this one.
|
|
347
|
+
|
|
348
|
+
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.
|
|
349
|
+
|
|
350
|
+
With both accounts created, go back to [Quickstart](#quickstart) and write the env file.
|
|
351
|
+
|
|
77
352
|
## CLI
|
|
78
353
|
|
|
79
354
|
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.
|
|
@@ -86,11 +361,13 @@ wazuhctrl diagnostics --no-connectivity
|
|
|
86
361
|
wazuhctrl mcp
|
|
87
362
|
```
|
|
88
363
|
|
|
89
|
-
`wazuhctrl` reads the same environment as the MCP adapter: `WAZUH_URL`, `WAZUH_USERNAME`, `WAZUH_PASSWORD`, optional `WAZUH_INDEXER_URL`, and
|
|
364
|
+
`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.
|
|
90
365
|
|
|
91
366
|
## Usage
|
|
92
367
|
|
|
93
|
-
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.
|
|
368
|
+
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.
|
|
369
|
+
|
|
370
|
+
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.
|
|
94
371
|
|
|
95
372
|
### Claude Desktop
|
|
96
373
|
|
|
@@ -100,32 +377,19 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
|
100
377
|
{
|
|
101
378
|
"mcpServers": {
|
|
102
379
|
"wazuh": {
|
|
103
|
-
"command": "
|
|
104
|
-
"args": ["-y", "wazuh-mcp"]
|
|
105
|
-
"env": {
|
|
106
|
-
"WAZUH_URL": "https://your-wazuh-manager:55000",
|
|
107
|
-
"WAZUH_USERNAME": "wazuh-wui",
|
|
108
|
-
"WAZUH_PASSWORD": "your-password",
|
|
109
|
-
"WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
|
|
110
|
-
"WAZUH_INDEXER_USERNAME": "admin",
|
|
111
|
-
"WAZUH_INDEXER_PASSWORD": "your-indexer-password"
|
|
112
|
-
}
|
|
380
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
381
|
+
"args": ["npx", "-y", "wazuh-mcp"]
|
|
113
382
|
}
|
|
114
383
|
}
|
|
115
384
|
}
|
|
116
385
|
```
|
|
117
386
|
|
|
387
|
+
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`.
|
|
388
|
+
|
|
118
389
|
### Claude Code
|
|
119
390
|
|
|
120
391
|
```bash
|
|
121
|
-
claude mcp add wazuh
|
|
122
|
-
--env WAZUH_URL=https://your-wazuh-manager:55000 \
|
|
123
|
-
--env WAZUH_USERNAME=wazuh-wui \
|
|
124
|
-
--env WAZUH_PASSWORD=your-password \
|
|
125
|
-
--env WAZUH_INDEXER_URL=https://your-wazuh-indexer:9200 \
|
|
126
|
-
--env WAZUH_INDEXER_USERNAME=admin \
|
|
127
|
-
--env WAZUH_INDEXER_PASSWORD=your-indexer-password \
|
|
128
|
-
-- npx -y wazuh-mcp
|
|
392
|
+
claude mcp add wazuh -- /absolute/path/to/wazuh-mcp-env npx -y wazuh-mcp
|
|
129
393
|
```
|
|
130
394
|
|
|
131
395
|
Add `--scope user` to make it available from any directory instead of only the current project.
|
|
@@ -135,14 +399,7 @@ Add `--scope user` to make it available from any directory instead of only the c
|
|
|
135
399
|
[Codex CLI](https://github.com/openai/codex) registers MCP servers via `codex mcp add`:
|
|
136
400
|
|
|
137
401
|
```bash
|
|
138
|
-
codex mcp add wazuh
|
|
139
|
-
--env WAZUH_URL=https://your-wazuh-manager:55000 \
|
|
140
|
-
--env WAZUH_USERNAME=wazuh-wui \
|
|
141
|
-
--env WAZUH_PASSWORD=your-password \
|
|
142
|
-
--env WAZUH_INDEXER_URL=https://your-wazuh-indexer:9200 \
|
|
143
|
-
--env WAZUH_INDEXER_USERNAME=admin \
|
|
144
|
-
--env WAZUH_INDEXER_PASSWORD=your-indexer-password \
|
|
145
|
-
-- npx -y wazuh-mcp
|
|
402
|
+
codex mcp add wazuh -- /absolute/path/to/wazuh-mcp-env npx -y wazuh-mcp
|
|
146
403
|
```
|
|
147
404
|
|
|
148
405
|
Codex writes the entry to `~/.codex/config.toml` under `[mcp_servers.wazuh]`. Verify with `codex mcp list`.
|
|
@@ -153,33 +410,17 @@ With the npm package:
|
|
|
153
410
|
|
|
154
411
|
```bash
|
|
155
412
|
openclaw mcp set wazuh '{
|
|
156
|
-
"command": "
|
|
157
|
-
"args": ["-y", "wazuh-mcp"]
|
|
158
|
-
"env": {
|
|
159
|
-
"WAZUH_URL": "https://your-wazuh-manager:55000",
|
|
160
|
-
"WAZUH_USERNAME": "wazuh-wui",
|
|
161
|
-
"WAZUH_PASSWORD": "your-password",
|
|
162
|
-
"WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
|
|
163
|
-
"WAZUH_INDEXER_USERNAME": "admin",
|
|
164
|
-
"WAZUH_INDEXER_PASSWORD": "your-indexer-password"
|
|
165
|
-
}
|
|
413
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
414
|
+
"args": ["npx", "-y", "wazuh-mcp"]
|
|
166
415
|
}'
|
|
167
416
|
```
|
|
168
417
|
|
|
169
|
-
Or, when running from a source checkout, point `
|
|
418
|
+
Or, when running from a source checkout, point `args` at the built `dist/mcp-bin.js`:
|
|
170
419
|
|
|
171
420
|
```bash
|
|
172
421
|
openclaw mcp set wazuh '{
|
|
173
|
-
"command": "
|
|
174
|
-
"args": ["/absolute/path/to/wazuh-mcp/dist/mcp-bin.js"]
|
|
175
|
-
"env": {
|
|
176
|
-
"WAZUH_URL": "https://your-wazuh-manager:55000",
|
|
177
|
-
"WAZUH_USERNAME": "wazuh-wui",
|
|
178
|
-
"WAZUH_PASSWORD": "your-password",
|
|
179
|
-
"WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
|
|
180
|
-
"WAZUH_INDEXER_USERNAME": "admin",
|
|
181
|
-
"WAZUH_INDEXER_PASSWORD": "your-indexer-password"
|
|
182
|
-
}
|
|
422
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
423
|
+
"args": ["node", "/absolute/path/to/wazuh-mcp/dist/mcp-bin.js"]
|
|
183
424
|
}'
|
|
184
425
|
```
|
|
185
426
|
|
|
@@ -197,15 +438,8 @@ openclaw mcp list # confirm "wazuh" is registered
|
|
|
197
438
|
```yaml
|
|
198
439
|
mcp_servers:
|
|
199
440
|
wazuh:
|
|
200
|
-
command: "
|
|
201
|
-
args: ["-y", "wazuh-mcp"]
|
|
202
|
-
env:
|
|
203
|
-
WAZUH_URL: "https://your-wazuh-manager:55000"
|
|
204
|
-
WAZUH_USERNAME: "wazuh-wui"
|
|
205
|
-
WAZUH_PASSWORD: "your-password"
|
|
206
|
-
WAZUH_INDEXER_URL: "https://your-wazuh-indexer:9200"
|
|
207
|
-
WAZUH_INDEXER_USERNAME: "admin"
|
|
208
|
-
WAZUH_INDEXER_PASSWORD: "your-indexer-password"
|
|
441
|
+
command: "/absolute/path/to/wazuh-mcp-env"
|
|
442
|
+
args: ["npx", "-y", "wazuh-mcp"]
|
|
209
443
|
```
|
|
210
444
|
|
|
211
445
|
Then reload MCP from inside a Hermes session with `/reload-mcp`.
|
|
@@ -213,10 +447,7 @@ Then reload MCP from inside a Hermes session with `/reload-mcp`.
|
|
|
213
447
|
### Standalone
|
|
214
448
|
|
|
215
449
|
```bash
|
|
216
|
-
|
|
217
|
-
export WAZUH_USERNAME=wazuh-wui
|
|
218
|
-
export WAZUH_PASSWORD=your-password
|
|
219
|
-
npx -y wazuh-mcp
|
|
450
|
+
~/.local/bin/wazuh-mcp-env npx -y wazuh-mcp
|
|
220
451
|
```
|
|
221
452
|
|
|
222
453
|
### Development
|
|
@@ -229,7 +460,7 @@ npm test # Run tests
|
|
|
229
460
|
|
|
230
461
|
## MCP Tools
|
|
231
462
|
|
|
232
|
-
All
|
|
463
|
+
All 46 tools are read-only, and each one declares the MCP tool annotations `readOnlyHint: true`, `idempotentHint: 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.
|
|
233
464
|
|
|
234
465
|
### Agent Tools
|
|
235
466
|
|
|
@@ -238,6 +469,9 @@ All 28 tools are read-only.
|
|
|
238
469
|
| `list_agents` | List all agents with optional status filtering (active, disconnected, never_connected, pending) |
|
|
239
470
|
| `get_agent` | Get detailed info for a specific agent by ID |
|
|
240
471
|
| `get_agent_stats` | Get CPU, memory, and disk statistics for an agent |
|
|
472
|
+
| `get_agents_summary` | Get agent counts by connection status, group configuration status, and operating system from `/overview/agents` (requires `agent:read` and `group:read`) |
|
|
473
|
+
| `list_outdated_agents` | List agents running an outdated Wazuh version |
|
|
474
|
+
| `list_agents_without_group` | List agents that do not belong to a group |
|
|
241
475
|
|
|
242
476
|
### Alert Tools
|
|
243
477
|
|
|
@@ -246,6 +480,7 @@ All 28 tools are read-only.
|
|
|
246
480
|
| `get_alerts` | Retrieve recent alerts with filtering by time range, level, agent, rule, and text search |
|
|
247
481
|
| `get_alert` | Retrieve a single alert by ID |
|
|
248
482
|
| `search_alerts` | Full-text search across alerts with optional time range filtering |
|
|
483
|
+
| `aggregate_alerts` | Aggregate counts by top alert rule or agent fields, or by time histogram |
|
|
249
484
|
|
|
250
485
|
### Vulnerability Tools
|
|
251
486
|
|
|
@@ -279,6 +514,11 @@ All 28 tools are read-only.
|
|
|
279
514
|
| `get_agent_ports` | List open network ports with associated processes |
|
|
280
515
|
| `get_agent_network` | List network interfaces and IP addresses |
|
|
281
516
|
| `get_agent_hotfixes` | List installed Windows hotfixes/patches |
|
|
517
|
+
| `get_agent_hardware` | Get processor, memory, and hardware scan inventory |
|
|
518
|
+
| `get_agent_netaddr` | List collected network addresses; IP addresses are hidden by default |
|
|
519
|
+
| `get_agent_users` | List local users collected from an agent |
|
|
520
|
+
| `get_agent_groups` | List local groups collected from an agent |
|
|
521
|
+
| `get_agent_services` | List services collected from an agent |
|
|
282
522
|
|
|
283
523
|
### FIM & Rootcheck Tools
|
|
284
524
|
|
|
@@ -286,13 +526,27 @@ All 28 tools are read-only.
|
|
|
286
526
|
|------|-------------|
|
|
287
527
|
| `get_fim_files` | Get File Integrity Monitoring results (files, registry keys, hashes) |
|
|
288
528
|
| `get_rootcheck` | Get rootkit detection scan findings |
|
|
529
|
+
| `get_fim_last_scan` | Get the last FIM scan start and end times |
|
|
530
|
+
| `get_rootcheck_last_scan` | Get the last rootcheck scan start and end times |
|
|
289
531
|
|
|
290
532
|
### Manager Tools
|
|
291
533
|
|
|
292
534
|
| Tool | Description |
|
|
293
535
|
|------|-------------|
|
|
294
536
|
| `get_manager_logs` | Get Wazuh manager logs filtered by level and module |
|
|
537
|
+
| `get_manager_stats_analysisd` | Get analysisd event processing counters (deprecated in Wazuh 4.14; planned removal in 5.0) |
|
|
538
|
+
| `get_manager_stats_remoted` | Get remoted queue, session, and message counters (deprecated in Wazuh 4.14; planned removal in 5.0) |
|
|
539
|
+
| `get_manager_log_summary` | Get recent manager log counts by daemon tag and severity |
|
|
295
540
|
| `get_manager_config` | Get active manager configuration by section with secret-like values redacted by default |
|
|
541
|
+
| `get_manager_status` | Get the running state of Wazuh manager daemons |
|
|
542
|
+
| `get_manager_info` | Get manager path, version, build information, type, and OpenSSL support |
|
|
543
|
+
|
|
544
|
+
### Cluster Tools
|
|
545
|
+
|
|
546
|
+
| Tool | Description |
|
|
547
|
+
|------|-------------|
|
|
548
|
+
| `get_cluster_status` | Get whether the Wazuh cluster is enabled and running |
|
|
549
|
+
| `get_cluster_nodes` | List cluster nodes and synchronization health; node IPs are hidden unless requested |
|
|
296
550
|
|
|
297
551
|
### Group Tools
|
|
298
552
|
|
|
@@ -316,29 +570,30 @@ Set the following environment variables:
|
|
|
316
570
|
| Variable | Required | Default | Description |
|
|
317
571
|
|----------|----------|---------|-------------|
|
|
318
572
|
| `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. |
|
|
319
|
-
| `WAZUH_USERNAME` | Yes | - | API username |
|
|
573
|
+
| `WAZUH_USERNAME` | Yes | - | API username. Use a dedicated user with the built-in `readonly` role (see [Least-privilege setup](#least-privilege-setup)). |
|
|
320
574
|
| `WAZUH_PASSWORD` | Yes | - | API password |
|
|
321
575
|
| `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. |
|
|
322
|
-
| `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
|
|
576
|
+
| `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. |
|
|
577
|
+
| `WAZUH_TLS_SERVERNAME` | No | - | Name to check the manager certificate against instead of the host in `WAZUH_URL`: an IPv4 address, IPv6 address, or DNS name, with no scheme, port, or path (253 characters at most). The certificate chain is still verified. Ignored when `WAZUH_VERIFY_SSL` is `false`, and `diagnose_wazuh_connection` reports that. See [TLS verification](#tls-verification). |
|
|
323
578
|
| `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. |
|
|
324
579
|
| `WAZUH_TIMEOUT` | No | `30` | Request timeout in seconds. Must be a positive integer. |
|
|
325
|
-
| `
|
|
326
|
-
| `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. |
|
|
580
|
+
| `WAZUH_MCP_MAX_RESPONSE_BYTES` | No | `90000` | 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. The default stays under 100,000 bytes so clients that refuse larger direct results still get the truncated preview. |
|
|
327
581
|
| `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. |
|
|
328
582
|
|
|
329
583
|
Alternative variable names `WAZUH_BASE_URL` and `WAZUH_USER` are also supported.
|
|
330
584
|
|
|
331
585
|
### Wazuh Indexer (OpenSearch) - Required for Alerts and Vulnerabilities
|
|
332
586
|
|
|
333
|
-
Wazuh 4.x stores alerts and vulnerability inventory in the Wazuh Indexer (OpenSearch), not the REST API. To enable alert tools (`get_alerts`, `get_alert`, `search_alerts`), vulnerability tools (`list_vulnerabilities`, `search_vulnerabilities`), and the `wazuh://alerts/recent` resource, configure the indexer connection:
|
|
587
|
+
Wazuh 4.x stores alerts and vulnerability inventory in the Wazuh Indexer (OpenSearch), not the REST API. To enable alert tools (`get_alerts`, `get_alert`, `search_alerts`, `aggregate_alerts`), vulnerability tools (`list_vulnerabilities`, `search_vulnerabilities`), and the `wazuh://alerts/recent` resource, configure the indexer connection:
|
|
334
588
|
|
|
335
589
|
| Variable | Required | Default | Description |
|
|
336
590
|
|----------|----------|---------|-------------|
|
|
337
591
|
| `WAZUH_INDEXER_URL` | No | - | Wazuh Indexer URL (e.g., `https://192.0.2.2:9200`). Same URL rules as `WAZUH_URL`. |
|
|
338
|
-
| `WAZUH_INDEXER_USERNAME` |
|
|
592
|
+
| `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`). |
|
|
339
593
|
| `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. |
|
|
340
594
|
| `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. |
|
|
341
|
-
| `WAZUH_INDEXER_CA_FILE` | No | - | Path to a PEM CA bundle used to verify the indexer's TLS certificate. Read at startup
|
|
595
|
+
| `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. |
|
|
596
|
+
| `WAZUH_INDEXER_TLS_SERVERNAME` | No | - | Name to check the indexer certificate against instead of the host in `WAZUH_INDEXER_URL`. Same format and rules as `WAZUH_TLS_SERVERNAME`. Ignored when `WAZUH_INDEXER_VERIFY_SSL` is `false`. |
|
|
342
597
|
| `WAZUH_INDEXER_TIMEOUT` | No | `30` | Indexer request timeout in seconds. Must be a positive integer. |
|
|
343
598
|
|
|
344
599
|
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.
|
|
@@ -358,13 +613,17 @@ Several tools return minimized output by default to avoid exposing raw logs, IPs
|
|
|
358
613
|
| `get_alert` | `full_log`, raw `data` | `include_full_log: true`, `include_raw_data: true` |
|
|
359
614
|
| `list_vulnerabilities`, `search_vulnerabilities` | Vulnerability descriptions | `include_description: true` |
|
|
360
615
|
| `get_agent_processes` | Process command lines and arguments | `include_command: true` |
|
|
616
|
+
| `get_agent_services` | Service process arguments | `include_command: true` |
|
|
617
|
+
| `get_agent_services` | Service and target addresses | `include_address: true` |
|
|
618
|
+
| `get_agent_netaddr` | IPv4 and IPv6 address fields | `include_ip: true` |
|
|
619
|
+
| `get_agent_users` | Agent `host_ip` | Always omitted |
|
|
361
620
|
| `get_fim_files` | MD5 and SHA-256 hashes | `include_hashes: true` |
|
|
362
621
|
| `get_manager_logs` | Full log descriptions | `include_description: true` |
|
|
363
|
-
| `get_manager_config` | Secret-like config values |
|
|
622
|
+
| `get_manager_config` | Secret-like config values | None. Credential-bearing keys are always redacted. |
|
|
364
623
|
|
|
365
624
|
### Untrusted SIEM Content
|
|
366
625
|
|
|
367
|
-
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
|
|
626
|
+
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`, rule and decoder text, manager log descriptions, agent names and OS fields, syscollector hardware, network address, user, group, service, process, package, port, interface, and hotfix fields, FIM paths and owners, rootcheck log text, 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.
|
|
368
627
|
|
|
369
628
|
### Input Validation
|
|
370
629
|
|
|
@@ -378,7 +637,7 @@ Transient manager `GET` requests and indexer search/readiness requests retry bri
|
|
|
378
637
|
|
|
379
638
|
## Features
|
|
380
639
|
|
|
381
|
-
- **
|
|
640
|
+
- **46 MCP Tools** - Agents, alerts, vulnerabilities, rules, decoders, SCA, syscollector, FIM, rootcheck, groups, manager, cluster, and diagnostics
|
|
382
641
|
- **3 MCP Resources** - Pre-built views for agents, recent alerts, and rule summaries
|
|
383
642
|
- **3 MCP Prompts** - Alert investigation, agent health checks, and security overviews
|
|
384
643
|
- **Read-only by design** - The only writes are JWT auth and indexer `_search`; no tool changes Wazuh state
|
|
@@ -393,8 +652,8 @@ Transient manager `GET` requests and indexer search/readiness requests retry bri
|
|
|
393
652
|
- Node.js 22+
|
|
394
653
|
<!-- content-guard: allow port-reference -->
|
|
395
654
|
- A running Wazuh manager with API access (default port 55000)
|
|
396
|
-
- Wazuh API credentials
|
|
397
|
-
- (Optional) Wazuh Indexer (OpenSearch)
|
|
655
|
+
- Wazuh API credentials for a user with the built-in `readonly` role
|
|
656
|
+
- (Optional) A Wazuh Indexer (OpenSearch) user with a read-only role for alert and vulnerability queries
|
|
398
657
|
|
|
399
658
|
## MCP Resources
|
|
400
659
|
|
|
@@ -446,13 +705,13 @@ and their compliance framework mappings.
|
|
|
446
705
|
- **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.
|
|
447
706
|
- **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.
|
|
448
707
|
- **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.
|
|
449
|
-
- **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
|
|
708
|
+
- **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 46 vetted tools.
|
|
450
709
|
|
|
451
710
|
## What wazuh-mcp is not
|
|
452
711
|
|
|
453
712
|
- **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.
|
|
454
713
|
- **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.
|
|
455
|
-
- **
|
|
714
|
+
- **Self-hosted.** Run the adapter next to your client over stdio or run it yourself over HTTP. Keep Wazuh credentials in the server process's environment.
|
|
456
715
|
- **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.
|
|
457
716
|
- **Not a way to bypass Wazuh access control.** It uses the credentials you give it and can see only what that account can see.
|
|
458
717
|
|
|
@@ -520,6 +779,8 @@ MIT. See [LICENSE](LICENSE).
|
|
|
520
779
|
|
|
521
780
|
<p align="center"><a href="https://lidless.dev">Part of <strong>Lidless Labs</strong></a> · the eye does not close</p>
|
|
522
781
|
|
|
782
|
+
<p align="center">Built and maintained by <a href="https://solomonneas.dev">Solomon Neas</a>.</p>
|
|
783
|
+
|
|
523
784
|
<p align="center"><sub><strong>Security / SOC:</strong> <a href="https://github.com/lidless-labs/soc-stack">soc-stack</a> · <a href="https://github.com/lidless-labs/misp-mcp">misp-mcp</a> · <a href="https://github.com/lidless-labs/suricata-mcp">suricata-mcp</a> · <a href="https://github.com/lidless-labs/thehive-mcp">thehive-mcp</a> · <a href="https://github.com/lidless-labs/cortex-mcp">cortex-mcp</a> · <a href="https://github.com/lidless-labs/mitre-mcp">mitre-mcp</a> · <a href="https://github.com/lidless-labs/zeek-mcp">zeek-mcp</a> · <a href="https://github.com/lidless-labs/hotwash">hotwash</a></sub></p>
|
|
524
785
|
|
|
525
786
|
<p align="center"><sub><a href="https://lidless.dev">All tools</a> · <a href="https://github.com/lidless-labs">Lidless Labs on GitHub</a></sub></p>
|