wazuh-mcp 2.0.0 → 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 +196 -83
- package/dist/{chunk-5Q2DPBC6.js → chunk-JDIXLCOH.js} +77 -30
- package/dist/chunk-JDIXLCOH.js.map +1 -0
- package/dist/cli.d.ts +9 -1
- package/dist/cli.js +25 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-bin.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5Q2DPBC6.js.map +0 -1
package/README.md
CHANGED
|
@@ -44,36 +44,193 @@ npm run build
|
|
|
44
44
|
|
|
45
45
|
## Quickstart
|
|
46
46
|
|
|
47
|
-
|
|
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 `~`:
|
|
48
99
|
|
|
49
100
|
```json
|
|
50
101
|
{
|
|
51
102
|
"mcpServers": {
|
|
52
103
|
"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
|
-
}
|
|
104
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
105
|
+
"args": ["npx", "-y", "wazuh-mcp"]
|
|
63
106
|
}
|
|
64
107
|
}
|
|
65
108
|
}
|
|
66
109
|
```
|
|
67
110
|
|
|
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."*
|
|
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.
|
|
69
112
|
|
|
70
113
|
Prefer a global install?
|
|
71
114
|
|
|
72
115
|
```bash
|
|
73
116
|
npm install -g wazuh-mcp
|
|
74
|
-
# then use "command": "wazuh-mcp" instead of the npx invocation above
|
|
75
117
|
```
|
|
76
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
|
+
|
|
77
234
|
## CLI
|
|
78
235
|
|
|
79
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.
|
|
@@ -86,11 +243,13 @@ wazuhctrl diagnostics --no-connectivity
|
|
|
86
243
|
wazuhctrl mcp
|
|
87
244
|
```
|
|
88
245
|
|
|
89
|
-
`wazuhctrl` reads the same environment as the MCP adapter: `WAZUH_URL`, `WAZUH_USERNAME`, `WAZUH_PASSWORD`, optional `WAZUH_INDEXER_URL`, and
|
|
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.
|
|
90
247
|
|
|
91
248
|
## Usage
|
|
92
249
|
|
|
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.
|
|
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.
|
|
94
253
|
|
|
95
254
|
### Claude Desktop
|
|
96
255
|
|
|
@@ -100,32 +259,19 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
|
100
259
|
{
|
|
101
260
|
"mcpServers": {
|
|
102
261
|
"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
|
-
}
|
|
262
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
263
|
+
"args": ["npx", "-y", "wazuh-mcp"]
|
|
113
264
|
}
|
|
114
265
|
}
|
|
115
266
|
}
|
|
116
267
|
```
|
|
117
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
|
+
|
|
118
271
|
### Claude Code
|
|
119
272
|
|
|
120
273
|
```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
|
|
274
|
+
claude mcp add wazuh -- /absolute/path/to/wazuh-mcp-env npx -y wazuh-mcp
|
|
129
275
|
```
|
|
130
276
|
|
|
131
277
|
Add `--scope user` to make it available from any directory instead of only the current project.
|
|
@@ -135,14 +281,7 @@ Add `--scope user` to make it available from any directory instead of only the c
|
|
|
135
281
|
[Codex CLI](https://github.com/openai/codex) registers MCP servers via `codex mcp add`:
|
|
136
282
|
|
|
137
283
|
```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
|
|
284
|
+
codex mcp add wazuh -- /absolute/path/to/wazuh-mcp-env npx -y wazuh-mcp
|
|
146
285
|
```
|
|
147
286
|
|
|
148
287
|
Codex writes the entry to `~/.codex/config.toml` under `[mcp_servers.wazuh]`. Verify with `codex mcp list`.
|
|
@@ -153,33 +292,17 @@ With the npm package:
|
|
|
153
292
|
|
|
154
293
|
```bash
|
|
155
294
|
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
|
-
}
|
|
295
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
296
|
+
"args": ["npx", "-y", "wazuh-mcp"]
|
|
166
297
|
}'
|
|
167
298
|
```
|
|
168
299
|
|
|
169
|
-
Or, when running from a source checkout, point `
|
|
300
|
+
Or, when running from a source checkout, point `args` at the built `dist/mcp-bin.js`:
|
|
170
301
|
|
|
171
302
|
```bash
|
|
172
303
|
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
|
-
}
|
|
304
|
+
"command": "/absolute/path/to/wazuh-mcp-env",
|
|
305
|
+
"args": ["node", "/absolute/path/to/wazuh-mcp/dist/mcp-bin.js"]
|
|
183
306
|
}'
|
|
184
307
|
```
|
|
185
308
|
|
|
@@ -197,15 +320,8 @@ openclaw mcp list # confirm "wazuh" is registered
|
|
|
197
320
|
```yaml
|
|
198
321
|
mcp_servers:
|
|
199
322
|
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"
|
|
323
|
+
command: "/absolute/path/to/wazuh-mcp-env"
|
|
324
|
+
args: ["npx", "-y", "wazuh-mcp"]
|
|
209
325
|
```
|
|
210
326
|
|
|
211
327
|
Then reload MCP from inside a Hermes session with `/reload-mcp`.
|
|
@@ -213,10 +329,7 @@ Then reload MCP from inside a Hermes session with `/reload-mcp`.
|
|
|
213
329
|
### Standalone
|
|
214
330
|
|
|
215
331
|
```bash
|
|
216
|
-
|
|
217
|
-
export WAZUH_USERNAME=wazuh-wui
|
|
218
|
-
export WAZUH_PASSWORD=your-password
|
|
219
|
-
npx -y wazuh-mcp
|
|
332
|
+
~/.local/bin/wazuh-mcp-env npx -y wazuh-mcp
|
|
220
333
|
```
|
|
221
334
|
|
|
222
335
|
### Development
|
|
@@ -229,7 +342,7 @@ npm test # Run tests
|
|
|
229
342
|
|
|
230
343
|
## MCP Tools
|
|
231
344
|
|
|
232
|
-
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.
|
|
233
346
|
|
|
234
347
|
### Agent Tools
|
|
235
348
|
|
|
@@ -316,10 +429,10 @@ Set the following environment variables:
|
|
|
316
429
|
| Variable | Required | Default | Description |
|
|
317
430
|
|----------|----------|---------|-------------|
|
|
318
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. |
|
|
319
|
-
| `WAZUH_USERNAME` | Yes | - | API username |
|
|
432
|
+
| `WAZUH_USERNAME` | Yes | - | API username. Use a dedicated user with the built-in `readonly` role (see [Least-privilege setup](#least-privilege-setup)). |
|
|
320
433
|
| `WAZUH_PASSWORD` | Yes | - | API password |
|
|
321
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. |
|
|
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
|
|
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. |
|
|
323
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. |
|
|
324
437
|
| `WAZUH_TIMEOUT` | No | `30` | Request timeout in seconds. Must be a positive integer. |
|
|
325
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. |
|
|
@@ -335,10 +448,10 @@ Wazuh 4.x stores alerts and vulnerability inventory in the Wazuh Indexer (OpenSe
|
|
|
335
448
|
| Variable | Required | Default | Description |
|
|
336
449
|
|----------|----------|---------|-------------|
|
|
337
450
|
| `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` |
|
|
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`). |
|
|
339
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. |
|
|
340
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. |
|
|
341
|
-
| `WAZUH_INDEXER_CA_FILE` | No | - | Path to a PEM CA bundle used to verify the indexer's TLS certificate. Read at startup
|
|
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. |
|
|
342
455
|
| `WAZUH_INDEXER_TIMEOUT` | No | `30` | Indexer request timeout in seconds. Must be a positive integer. |
|
|
343
456
|
|
|
344
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.
|
|
@@ -393,8 +506,8 @@ Transient manager `GET` requests and indexer search/readiness requests retry bri
|
|
|
393
506
|
- Node.js 22+
|
|
394
507
|
<!-- content-guard: allow port-reference -->
|
|
395
508
|
- A running Wazuh manager with API access (default port 55000)
|
|
396
|
-
- Wazuh API credentials
|
|
397
|
-
- (Optional) Wazuh Indexer (OpenSearch)
|
|
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
|
|
398
511
|
|
|
399
512
|
## MCP Resources
|
|
400
513
|
|
|
@@ -452,7 +565,7 @@ and their compliance framework mappings.
|
|
|
452
565
|
|
|
453
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.
|
|
454
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.
|
|
455
|
-
- **Not a hosted service.** It runs locally as a stdio MCP server next to your client. Your Wazuh credentials stay on your machine
|
|
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.
|
|
456
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.
|
|
457
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.
|
|
458
571
|
|