wazuh-mcp 1.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/LICENSE +21 -0
- package/README.md +291 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1941 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Solomon Neas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# wazuh-mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.typescriptlang.org/)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](https://modelcontextprotocol.io/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server for the [Wazuh](https://wazuh.com/) SIEM/XDR platform. Query agents, security alerts, detection rules, and decoders directly from Claude or any MCP-compatible client.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **25 MCP Tools** - Agents, alerts, rules, decoders, SCA, syscollector, FIM, rootcheck, groups, and manager
|
|
13
|
+
- **3 MCP Resources** - Pre-built views for agents, recent alerts, and rule summaries
|
|
14
|
+
- **3 MCP Prompts** - Alert investigation, agent health checks, and security overviews
|
|
15
|
+
- **JWT Authentication** - Automatic token management with refresh on expiry
|
|
16
|
+
- **Full Compliance Mapping** - PCI-DSS, GDPR, HIPAA, NIST 800-53, MITRE ATT&CK
|
|
17
|
+
- **Pagination** - All list endpoints support limit/offset pagination
|
|
18
|
+
- **Type-Safe** - Full TypeScript with strict mode and Zod schema validation
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- Node.js 20+
|
|
23
|
+
- A running Wazuh manager with API access (default port 55000)
|
|
24
|
+
- Wazuh API credentials (username/password)
|
|
25
|
+
- (Optional) Wazuh Indexer (OpenSearch) access for alert queries
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/solomonneas/wazuh-mcp.git
|
|
31
|
+
cd wazuh-mcp
|
|
32
|
+
npm install
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configuration
|
|
37
|
+
|
|
38
|
+
Set the following environment variables:
|
|
39
|
+
|
|
40
|
+
| Variable | Required | Default | Description |
|
|
41
|
+
|----------|----------|---------|-------------|
|
|
42
|
+
| `WAZUH_URL` | Yes | - | Wazuh API URL (e.g., `https://10.0.0.2:55000`) |
|
|
43
|
+
| `WAZUH_USERNAME` | Yes | - | API username |
|
|
44
|
+
| `WAZUH_PASSWORD` | Yes | - | API password |
|
|
45
|
+
| `WAZUH_VERIFY_SSL` | No | `false` | Set to `true` to verify SSL certificates |
|
|
46
|
+
|
|
47
|
+
Alternative variable names `WAZUH_BASE_URL` and `WAZUH_USER` are also supported.
|
|
48
|
+
|
|
49
|
+
### Wazuh Indexer (OpenSearch) - Required for Alerts
|
|
50
|
+
|
|
51
|
+
Wazuh 4.x stores alerts in the Wazuh Indexer (OpenSearch), not the REST API. To enable alert tools (`get_alerts`, `get_alert`, `search_alerts`) and the `wazuh://alerts/recent` resource, configure the indexer connection:
|
|
52
|
+
|
|
53
|
+
| Variable | Required | Default | Description |
|
|
54
|
+
|----------|----------|---------|-------------|
|
|
55
|
+
| `WAZUH_INDEXER_URL` | No | - | Wazuh Indexer URL (e.g., `https://10.0.0.2:9200`) |
|
|
56
|
+
| `WAZUH_INDEXER_USERNAME` | No | `admin` | Indexer username |
|
|
57
|
+
| `WAZUH_INDEXER_PASSWORD` | No | - | Indexer password |
|
|
58
|
+
| `WAZUH_INDEXER_VERIFY_SSL` | No | `false` | Set to `true` to verify SSL certificates |
|
|
59
|
+
|
|
60
|
+
If `WAZUH_INDEXER_URL` is not set, alert tools will return a helpful configuration message. All other tools (agents, rules, decoders, version) work without the indexer.
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
### Claude Desktop
|
|
65
|
+
|
|
66
|
+
Add to your Claude Desktop configuration (`claude_desktop_config.json`):
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"wazuh": {
|
|
72
|
+
"command": "node",
|
|
73
|
+
"args": ["/path/to/wazuh-mcp/dist/index.js"],
|
|
74
|
+
"env": {
|
|
75
|
+
"WAZUH_URL": "https://your-wazuh-manager:55000",
|
|
76
|
+
"WAZUH_USERNAME": "wazuh-wui",
|
|
77
|
+
"WAZUH_PASSWORD": "your-password",
|
|
78
|
+
"WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
|
|
79
|
+
"WAZUH_INDEXER_USERNAME": "admin",
|
|
80
|
+
"WAZUH_INDEXER_PASSWORD": "your-indexer-password"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### OpenClaw
|
|
88
|
+
|
|
89
|
+
Add to your `openclaw.json`:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcp": {
|
|
94
|
+
"servers": {
|
|
95
|
+
"wazuh": {
|
|
96
|
+
"type": "stdio",
|
|
97
|
+
"command": "node",
|
|
98
|
+
"args": ["/path/to/wazuh-mcp/dist/index.js"],
|
|
99
|
+
"env": {
|
|
100
|
+
"WAZUH_URL": "https://your-wazuh-manager:55000",
|
|
101
|
+
"WAZUH_USERNAME": "wazuh-wui",
|
|
102
|
+
"WAZUH_PASSWORD": "your-password",
|
|
103
|
+
"WAZUH_INDEXER_URL": "https://your-wazuh-indexer:9200",
|
|
104
|
+
"WAZUH_INDEXER_USERNAME": "admin",
|
|
105
|
+
"WAZUH_INDEXER_PASSWORD": "your-indexer-password"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Standalone
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
export WAZUH_URL=https://your-wazuh-manager:55000
|
|
117
|
+
export WAZUH_USERNAME=wazuh-wui
|
|
118
|
+
export WAZUH_PASSWORD=your-password
|
|
119
|
+
npm start
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Development
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm run dev # Watch mode with tsx
|
|
126
|
+
npm run lint # Type checking
|
|
127
|
+
npm test # Run tests
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## MCP Tools
|
|
131
|
+
|
|
132
|
+
### Agent Tools
|
|
133
|
+
|
|
134
|
+
| Tool | Description |
|
|
135
|
+
|------|-------------|
|
|
136
|
+
| `list_agents` | List all agents with optional status filtering (active, disconnected, never_connected, pending) |
|
|
137
|
+
| `get_agent` | Get detailed info for a specific agent by ID |
|
|
138
|
+
| `get_agent_stats` | Get CPU, memory, and disk statistics for an agent |
|
|
139
|
+
|
|
140
|
+
### Alert Tools
|
|
141
|
+
|
|
142
|
+
| Tool | Description |
|
|
143
|
+
|------|-------------|
|
|
144
|
+
| `get_alerts` | Retrieve recent alerts with filtering by level, agent, rule, and text search |
|
|
145
|
+
| `get_alert` | Retrieve a single alert by ID |
|
|
146
|
+
| `search_alerts` | Full-text search across all alerts |
|
|
147
|
+
|
|
148
|
+
### Rule Tools
|
|
149
|
+
|
|
150
|
+
| Tool | Description |
|
|
151
|
+
|------|-------------|
|
|
152
|
+
| `list_rules` | List detection rules with level and group filtering |
|
|
153
|
+
| `get_rule` | Get full rule details including compliance mappings |
|
|
154
|
+
| `search_rules` | Search rules by description text |
|
|
155
|
+
|
|
156
|
+
### SCA Tools (Security Configuration Assessment)
|
|
157
|
+
|
|
158
|
+
| Tool | Description |
|
|
159
|
+
|------|-------------|
|
|
160
|
+
| `get_sca_policies` | List SCA policies and scores for an agent (CIS benchmarks, etc.) |
|
|
161
|
+
| `get_sca_checks` | Get individual check results with remediation steps and compliance mappings |
|
|
162
|
+
|
|
163
|
+
### Syscollector Tools (System Inventory)
|
|
164
|
+
|
|
165
|
+
| Tool | Description |
|
|
166
|
+
|------|-------------|
|
|
167
|
+
| `get_agent_os` | Get OS information (name, version, architecture, hostname) |
|
|
168
|
+
| `get_agent_packages` | List installed software packages with versions |
|
|
169
|
+
| `get_agent_processes` | List running processes with PIDs and command lines |
|
|
170
|
+
| `get_agent_ports` | List open network ports with associated processes |
|
|
171
|
+
| `get_agent_network` | List network interfaces and IP addresses |
|
|
172
|
+
| `get_agent_hotfixes` | List installed Windows hotfixes/patches |
|
|
173
|
+
|
|
174
|
+
### FIM & Rootcheck Tools
|
|
175
|
+
|
|
176
|
+
| Tool | Description |
|
|
177
|
+
|------|-------------|
|
|
178
|
+
| `get_fim_files` | Get File Integrity Monitoring results (files, registry keys, hashes) |
|
|
179
|
+
| `get_rootcheck` | Get rootkit detection scan findings |
|
|
180
|
+
|
|
181
|
+
### Manager Tools
|
|
182
|
+
|
|
183
|
+
| Tool | Description |
|
|
184
|
+
|------|-------------|
|
|
185
|
+
| `get_manager_logs` | Get Wazuh manager logs filtered by level and module |
|
|
186
|
+
| `get_manager_config` | Get active manager configuration by section |
|
|
187
|
+
|
|
188
|
+
### Group Tools
|
|
189
|
+
|
|
190
|
+
| Tool | Description |
|
|
191
|
+
|------|-------------|
|
|
192
|
+
| `list_groups` | List all agent groups |
|
|
193
|
+
| `get_group_agents` | List agents in a specific group |
|
|
194
|
+
|
|
195
|
+
### Other Tools
|
|
196
|
+
|
|
197
|
+
| Tool | Description |
|
|
198
|
+
|------|-------------|
|
|
199
|
+
| `list_decoders` | List log decoders with optional name filtering |
|
|
200
|
+
| `get_wazuh_version` | Get Wazuh manager version and API info |
|
|
201
|
+
|
|
202
|
+
## MCP Resources
|
|
203
|
+
|
|
204
|
+
| Resource URI | Description |
|
|
205
|
+
|-------------|-------------|
|
|
206
|
+
| `wazuh://agents` | All registered agents and their status |
|
|
207
|
+
| `wazuh://alerts/recent` | 25 most recent security alerts |
|
|
208
|
+
| `wazuh://rules/summary` | Detection rules sorted by severity |
|
|
209
|
+
|
|
210
|
+
## MCP Prompts
|
|
211
|
+
|
|
212
|
+
| Prompt | Description |
|
|
213
|
+
|--------|-------------|
|
|
214
|
+
| `investigate-alert` | Step-by-step alert investigation with MITRE mapping and remediation |
|
|
215
|
+
| `agent-health-check` | Comprehensive agent health assessment (status, resources, alerts) |
|
|
216
|
+
| `security-overview` | Full environment security summary with compliance coverage |
|
|
217
|
+
|
|
218
|
+
## Examples
|
|
219
|
+
|
|
220
|
+
### List active agents
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Use list_agents with status "active" to see all connected agents.
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Investigate a brute force attempt
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
Search alerts for "brute force" and investigate the top result,
|
|
230
|
+
including the MITRE ATT&CK technique and remediation steps.
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Check agent health
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
Run an agent health check on agent 001 - check its connection status,
|
|
237
|
+
resource usage, and any recent critical alerts.
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Find high-severity rules
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
List all rules with level 12 or higher to see critical detection rules
|
|
244
|
+
and their compliance framework mappings.
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Testing
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
npm test # Run all tests
|
|
251
|
+
npm run test:watch # Watch mode
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Tests use mocked Wazuh API responses - no live Wazuh instance needed.
|
|
255
|
+
|
|
256
|
+
## Project Structure
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
wazuh-mcp/
|
|
260
|
+
├── src/
|
|
261
|
+
│ ├── index.ts # MCP server entry point
|
|
262
|
+
│ ├── config.ts # Environment configuration
|
|
263
|
+
│ ├── client.ts # Wazuh REST API client (JWT auth)
|
|
264
|
+
│ ├── indexer-client.ts # Wazuh Indexer (OpenSearch) client
|
|
265
|
+
│ ├── types.ts # TypeScript type definitions
|
|
266
|
+
│ ├── resources.ts # MCP resource handlers
|
|
267
|
+
│ ├── prompts.ts # MCP prompt templates
|
|
268
|
+
│ └── tools/
|
|
269
|
+
│ ├── agents.ts # Agent management tools
|
|
270
|
+
│ ├── alerts.ts # Alert query tools
|
|
271
|
+
│ ├── rules.ts # Rule query tools
|
|
272
|
+
│ ├── decoders.ts # Decoder listing tool
|
|
273
|
+
│ ├── version.ts # Version info tool
|
|
274
|
+
│ ├── sca.ts # Security Configuration Assessment
|
|
275
|
+
│ ├── syscollector.ts # System inventory (OS, packages, ports, etc.)
|
|
276
|
+
│ ├── syscheck.ts # File Integrity Monitoring
|
|
277
|
+
│ ├── rootcheck.ts # Rootkit detection
|
|
278
|
+
│ ├── manager.ts # Manager logs and configuration
|
|
279
|
+
│ └── groups.ts # Agent group management
|
|
280
|
+
├── tests/
|
|
281
|
+
│ ├── client.test.ts # API client unit tests
|
|
282
|
+
│ └── tools.test.ts # Tool handler unit tests
|
|
283
|
+
├── package.json
|
|
284
|
+
├── tsconfig.json
|
|
285
|
+
├── tsup.config.ts
|
|
286
|
+
└── vitest.config.ts
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
MIT
|
package/dist/index.d.ts
ADDED