suricata-mcp 2.0.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,70 +1,75 @@
1
- # Suricata MCP Server
1
+ <p align="center">
2
+ <img src="docs/assets/suricata-mcp-social-preview.jpg" alt="suricata-mcp banner" width="900">
3
+ </p>
2
4
 
3
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue?logo=typescript)](https://www.typescriptlang.org/)
4
- [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green?logo=node.js)](https://nodejs.org/)
5
- [![MCP](https://img.shields.io/badge/MCP-1.x-purple)](https://modelcontextprotocol.io/)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
+ <h1 align="center">suricata-mcp</h1>
7
6
 
8
- An MCP (Model Context Protocol) server for network security monitoring. Provides intelligent analysis of Suricata IDS/IPS and Zeek NSM logs, cross-correlation between sensors, threat intelligence integration (MISP + TheHive), PCAP replay, and advanced analytics including DGA detection, C2 beaconing, data exfiltration, and lateral movement detection.
7
+ <p align="center">
8
+ <strong>An MCP server that lets an AI client read and triage Suricata IDS/IPS and Zeek NSM telemetry, so alert investigation happens in natural language instead of grep over EVE JSON.</strong>
9
+ </p>
9
10
 
10
- ## Features
11
+ <p align="center">
12
+ <a href="https://lidless.dev/suricata-mcp"><strong>Website &amp; docs -&gt; lidless.dev/suricata-mcp</strong></a>
13
+ </p>
11
14
 
12
- - **36 tools** for comprehensive network security analysis
13
- - **5 resources** for quick reference data
14
- - **5 prompts** for guided investigation workflows
15
- - **Suricata EVE JSON** alert querying, flow analysis, protocol inspection, rule management
16
- - **Zeek TSV logs** connection analysis, DNS/HTTP/TLS/SSH/file inspection
17
- - **Cross-correlation** between Suricata alerts and Zeek network metadata
18
- - **Threat intel** integration with MISP IOC lookup and TheHive case/alert creation
19
- - **PCAP management** list and replay PCAPs through Suricata or Zeek
20
- - **Advanced analytics** DGA detection, C2 beaconing, data exfiltration, lateral movement
21
- - **Rule management** create, enable/disable, and reload custom Suricata rules
22
- - Streaming parsers for large files, CIDR-aware filtering, gzip archive support
15
+ <p align="center">
16
+ <img src="https://shieldcn.dev/github/ci/lidless-labs/suricata-mcp.svg?branch=main&workflow=ci.yml" alt="CI status">
17
+ <img src="https://shieldcn.dev/npm/suricata-mcp.svg" alt="npm version">
18
+ <img src="https://shieldcn.dev/badge/MCP-server-8A2BE2.svg" alt="MCP server">
19
+ <img src="https://shieldcn.dev/badge/license-MIT-green.svg" alt="MIT license">
20
+ </p>
23
21
 
24
- ## Prerequisites
22
+ suricata-mcp is a Model Context Protocol (MCP) server for network security monitoring: it exposes Suricata IDS/IPS alerts and Zeek NSM logs to an AI client as structured tools. **Why:** a SOC analyst chasing a single alert normally pivots by hand across `eve.json`, flow records, DNS/HTTP/TLS transactions, and the Zeek logs next to them, which is slow and easy to get wrong under pressure. **How it differs:** instead of a dashboard or a one-shot log shipper, it gives the model query, aggregation, correlation, and threat-hunting tools that run locally against your own log files, with cross-correlation between Suricata and Zeek and built-in analytics for C2 beaconing, DGA, exfiltration, and lateral movement, so the analyst asks questions in plain language and the model does the pivoting.
25
23
 
26
- - Node.js 20+
27
- - Suricata sensor producing EVE JSON logs
28
- - (Optional) Zeek NSM with TSV log output
29
- - (Optional) MISP and/or TheHive instances for threat intel
24
+ ## What it does
25
+
26
+ suricata-mcp is an MCP server for **Suricata** IDS/IPS and **Zeek** network-security monitoring. It reads Suricata **EVE JSON** alerts, flows, and protocol records (DNS, HTTP, TLS/JA3/JA4, SSH, fileinfo, anomalies) and Zeek TSV logs straight off disk, then exposes them to an AI client as MCP tools for querying, aggregation, timelines, host and alert investigation, and cross-sensor correlation. On top of the raw telemetry it ships intrusion-detection analytics, C2 beaconing detection, DGA domain detection via Shannon entropy, data-exfiltration detection, and lateral-movement detection, plus Suricata rule management and optional threat-intel pivots into MISP and TheHive. The server is **read-only by default**: every analysis tool works out of the box, and the handful of tools that change a live IDS or shell out stay disabled until you explicitly opt in. It speaks MCP over stdio, so it drops into Claude Desktop, Claude Code, Codex CLI, OpenClaw, Hermes, or any MCP-capable agent.
30
27
 
31
28
  ## Installation
32
29
 
30
+ Most clients can run the published package directly with `npx -y suricata-mcp` (see [Quickstart](#quickstart)). To work from source instead:
31
+
33
32
  ```bash
34
- git clone https://github.com/solomonneas/suricata-mcp.git
33
+ git clone https://github.com/lidless-labs/suricata-mcp.git
35
34
  cd suricata-mcp
36
35
  npm install
37
36
  npm run build
38
37
  ```
39
38
 
40
- ## Configuration
39
+ ## Quickstart
41
40
 
42
- Set environment variables to point at your NIDS installation:
41
+ Add suricata-mcp to any MCP client with the published npm package. No clone or build required:
43
42
 
44
- | Variable | Default | Description |
45
- |----------|---------|-------------|
46
- | `SURICATA_EVE_LOG` | `/var/log/suricata/eve.json` | Path to primary EVE JSON log |
47
- | `SURICATA_EVE_ARCHIVE` | `/var/log/suricata/` | Directory for rotated/archived logs |
48
- | `SURICATA_RULES_DIR` | _(none)_ | Suricata rules directory |
49
- | `SURICATA_MAX_RESULTS` | `1000` | Maximum results per query |
50
- | `SURICATA_UNIX_SOCKET` | _(none)_ | Unix socket path for live commands |
51
- | `ZEEK_LOGS_DIR` | _(none)_ | Zeek log directory (enables Zeek tools) |
52
- | `PCAP_DIR` | _(none)_ | PCAP drop directory (enables PCAP tools) |
53
- | `MISP_URL` | _(none)_ | MISP instance URL |
54
- | `MISP_API_KEY` | _(none)_ | MISP API key |
55
- | `THEHIVE_URL` | _(none)_ | TheHive instance URL |
56
- | `THEHIVE_API_KEY` | _(none)_ | TheHive API key |
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "suricata": {
47
+ "command": "npx",
48
+ "args": ["-y", "suricata-mcp"],
49
+ "env": {
50
+ "SURICATA_EVE_LOG": "/var/log/suricata/eve.json",
51
+ "SURICATA_RULES_DIR": "/etc/suricata/rules",
52
+ "ZEEK_LOGS_DIR": "/opt/zeek/logs"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ That is the entire install. The server starts read-only against the logs you point it at; everything below is configuration detail and per-client wiring.
57
60
 
58
61
  ## Usage
59
62
 
60
63
  ### Claude Desktop
61
64
 
65
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
66
+
62
67
  ```json
63
68
  {
64
69
  "mcpServers": {
65
70
  "suricata": {
66
- "command": "node",
67
- "args": ["/path/to/suricata-mcp/dist/index.js"],
71
+ "command": "npx",
72
+ "args": ["-y", "suricata-mcp"],
68
73
  "env": {
69
74
  "SURICATA_EVE_LOG": "/opt/nids/suricata/logs/eve.json",
70
75
  "SURICATA_RULES_DIR": "/opt/nids/suricata/rules",
@@ -80,12 +85,146 @@ Set environment variables to point at your NIDS installation:
80
85
  }
81
86
  ```
82
87
 
88
+ If you installed from source, set `"command": "suricata-mcp"` (global npm install) or `"command": "node"` with `"args": ["/absolute/path/to/suricata-mcp/dist/mcp-bin.js"]`.
89
+
90
+ ## suricatactrl CLI
91
+
92
+ `suricatactrl` is the operator CLI for quick local triage. The package also keeps `suricatactl` as a compatibility alias. `suricata-mcp` remains the MCP stdio adapter for AI clients.
93
+
94
+ ```bash
95
+ npx -y --package suricata-mcp suricatactrl status --json
96
+ SURICATA_EVE_LOG=./test-data/eve.json SURICATA_EVE_ARCHIVE=./test-data npx -y --package suricata-mcp suricatactrl alerts query --severity 1 --limit 5
97
+ SURICATA_EVE_LOG=./test-data/eve.json SURICATA_EVE_ARCHIVE=./test-data npx -y --package suricata-mcp suricatactrl flows query --app-proto http --json
98
+ SURICATA_EVE_LOG=./test-data/eve.json SURICATA_EVE_ARCHIVE=./test-data npx -y --package suricata-mcp suricatactrl dns query --query evil-domain
99
+ ```
100
+
101
+ From a source checkout after `npm run build`:
102
+
103
+ ```bash
104
+ SURICATA_EVE_LOG=./test-data/eve.json SURICATA_EVE_ARCHIVE=./test-data node dist/cli.js status
105
+ SURICATA_EVE_LOG=./test-data/eve.json SURICATA_EVE_ARCHIVE=./test-data node dist/cli.js alerts query --sid 2024001
106
+ node dist/cli.js mcp
107
+ ```
108
+
109
+ The first CLI slice is read-only. It covers setup checks, alert queries, flow queries, DNS queries, and beaconing detection with `--json` output for scripts. Use the MCP server for the full tool set, including rule mutation, Unix socket commands, PCAP workflows, cross-sensor correlation, MISP, and TheHive.
110
+
111
+ ### Claude Code
112
+
113
+ ```bash
114
+ claude mcp add suricata \
115
+ --env SURICATA_EVE_LOG=/opt/nids/suricata/logs/eve.json \
116
+ --env SURICATA_RULES_DIR=/opt/nids/suricata/rules \
117
+ --env ZEEK_LOGS_DIR=/opt/nids/zeek/logs \
118
+ -- npx -y suricata-mcp
119
+ ```
120
+
121
+ Add `--scope user` to make it available from any directory instead of only the current project.
122
+
123
+ ### OpenClaw
124
+
125
+ If you're running from a source checkout instead of the npm-installed binary, point `command`/`args` at the built `dist/mcp-bin.js`:
126
+
127
+ ```bash
128
+ openclaw mcp set suricata '{
129
+ "command": "node",
130
+ "args": ["/absolute/path/to/suricata-mcp/dist/mcp-bin.js"],
131
+ "env": {
132
+ "SURICATA_EVE_LOG": "/opt/nids/suricata/logs/eve.json",
133
+ "SURICATA_RULES_DIR": "/opt/nids/suricata/rules",
134
+ "ZEEK_LOGS_DIR": "/opt/nids/zeek/logs"
135
+ }
136
+ }'
137
+ ```
138
+
139
+ Or, with the published package:
140
+
141
+ ```bash
142
+ openclaw mcp set suricata '{
143
+ "command": "npx",
144
+ "args": ["-y", "suricata-mcp"],
145
+ "env": {
146
+ "SURICATA_EVE_LOG": "/opt/nids/suricata/logs/eve.json",
147
+ "SURICATA_RULES_DIR": "/opt/nids/suricata/rules",
148
+ "ZEEK_LOGS_DIR": "/opt/nids/zeek/logs"
149
+ }
150
+ }'
151
+ ```
152
+
153
+ Then restart the OpenClaw gateway so the new server is picked up:
154
+
155
+ ```bash
156
+ systemctl --user restart openclaw-gateway
157
+ openclaw mcp list # confirm "suricata" is registered
158
+ ```
159
+
160
+ ### Hermes Agent
161
+
162
+ [Hermes Agent](https://github.com/NousResearch/hermes-agent) reads MCP config from `~/.hermes/config.yaml` under the `mcp_servers` key. Add an entry:
163
+
164
+ ```yaml
165
+ mcp_servers:
166
+ suricata:
167
+ command: "npx"
168
+ args: ["-y", "suricata-mcp"]
169
+ env:
170
+ SURICATA_EVE_LOG: "/opt/nids/suricata/logs/eve.json"
171
+ SURICATA_RULES_DIR: "/opt/nids/suricata/rules"
172
+ ZEEK_LOGS_DIR: "/opt/nids/zeek/logs"
173
+ ```
174
+
175
+ Or, when running from a source checkout instead of the published package:
176
+
177
+ ```yaml
178
+ mcp_servers:
179
+ suricata:
180
+ command: "node"
181
+ args: ["/absolute/path/to/suricata-mcp/dist/mcp-bin.js"]
182
+ env:
183
+ SURICATA_EVE_LOG: "/opt/nids/suricata/logs/eve.json"
184
+ SURICATA_RULES_DIR: "/opt/nids/suricata/rules"
185
+ ZEEK_LOGS_DIR: "/opt/nids/zeek/logs"
186
+ ```
187
+
188
+ Then reload MCP from inside a Hermes session:
189
+
190
+ ```
191
+ /reload-mcp
192
+ ```
193
+
194
+ ### Codex CLI
195
+
196
+ [Codex CLI](https://github.com/openai/codex) registers MCP servers via `codex mcp add`:
197
+
198
+ ```bash
199
+ codex mcp add suricata \
200
+ --env SURICATA_EVE_LOG=/opt/nids/suricata/logs/eve.json \
201
+ --env SURICATA_RULES_DIR=/opt/nids/suricata/rules \
202
+ --env ZEEK_LOGS_DIR=/opt/nids/zeek/logs \
203
+ -- npx -y suricata-mcp
204
+ ```
205
+
206
+ Or, when running from a source checkout:
207
+
208
+ ```bash
209
+ codex mcp add suricata \
210
+ --env SURICATA_EVE_LOG=/opt/nids/suricata/logs/eve.json \
211
+ --env SURICATA_RULES_DIR=/opt/nids/suricata/rules \
212
+ --env ZEEK_LOGS_DIR=/opt/nids/zeek/logs \
213
+ -- node /absolute/path/to/suricata-mcp/dist/mcp-bin.js
214
+ ```
215
+
216
+ Codex writes the entry to `~/.codex/config.toml` under `[mcp_servers.suricata]`. Verify with:
217
+
218
+ ```bash
219
+ codex mcp list
220
+ ```
221
+
83
222
  ### Standalone
84
223
 
85
224
  ```bash
86
225
  SURICATA_EVE_LOG=/var/log/suricata/eve.json \
87
226
  ZEEK_LOGS_DIR=/opt/zeek/logs \
88
- node dist/index.js
227
+ node dist/mcp-bin.js
89
228
  ```
90
229
 
91
230
  ### Development
@@ -195,6 +334,70 @@ npm run lint # Type-check
195
334
  | `thehive_create_case` | Create a TheHive case from investigation findings |
196
335
  | `thehive_create_alert` | Push a Suricata alert to TheHive for triage |
197
336
 
337
+ ## Configuration
338
+
339
+ Set environment variables to point at your NIDS installation:
340
+
341
+ | Variable | Default | Description |
342
+ |----------|---------|-------------|
343
+ | `SURICATA_EVE_LOG` | `/var/log/suricata/eve.json` | Path to primary EVE JSON log |
344
+ | `SURICATA_EVE_ARCHIVE` | `/var/log/suricata/` | Directory for rotated/archived logs |
345
+ | `SURICATA_RULES_DIR` | _(none)_ | Suricata rules directory |
346
+ | `SURICATA_MAX_RESULTS` | `1000` | Maximum results per query |
347
+ | `SURICATA_UNIX_SOCKET` | _(none)_ | Unix socket path for live commands |
348
+ | `ZEEK_LOGS_DIR` | _(none)_ | Zeek log directory (enables Zeek tools) |
349
+ | `PCAP_DIR` | _(none)_ | PCAP drop directory (enables PCAP tools) |
350
+ | `MISP_URL` | _(none)_ | MISP instance URL |
351
+ | `MISP_API_KEY` | _(none)_ | MISP API key |
352
+ | `THEHIVE_URL` | _(none)_ | TheHive instance URL |
353
+ | `THEHIVE_API_KEY` | _(none)_ | TheHive API key |
354
+ | `SURICATA_ALLOW_MUTATION` | _(off)_ | Set to `1` to enable mutating tools (rule writes, ruleset reload, PCAP replay). Off by default. |
355
+
356
+ ### Mutating tools (opt-in)
357
+
358
+ By default the server is read-only: every analysis/query tool works, but the
359
+ tools that change a live IDS or shell out are disabled. To enable them you must:
360
+
361
+ 1. Set `SURICATA_ALLOW_MUTATION=1` in the server environment (operator opt-in), **and**
362
+ 2. Pass `confirm: true` on the tool call itself (per-invocation opt-in).
363
+
364
+ Both guards must be satisfied; otherwise the tool returns an error without
365
+ acting. The gated tools are:
366
+
367
+ - `suricata_create_rule` - appends to `local.rules`. Additionally enforces a
368
+ local SID range (`sid >= 1000000`) and rejects SIDs that collide with the
369
+ loaded ruleset.
370
+ - `suricata_reload_rules_docker` - runs `suricata-update` + `SIGUSR2` against the
371
+ live container.
372
+ - `pcap_replay_suricata` / `pcap_replay_zeek` - replay a PCAP through the engine.
373
+ Filenames are basename-sanitized, rejected if they begin with `-`
374
+ (option-injection), and concurrent replays are capped.
375
+
376
+ Threat-intel HTTP calls (MISP/TheHive) use `redirect: "manual"`, so a 3xx from a
377
+ compromised or misconfigured endpoint is refused rather than followed with the
378
+ API key attached.
379
+
380
+ ## Features
381
+
382
+ - **41 tools** for comprehensive network security analysis
383
+ - **5 resources** for quick reference data
384
+ - **5 prompts** for guided investigation workflows
385
+ - **Suricata EVE JSON** alert querying, flow analysis, protocol inspection, rule management
386
+ - **Zeek TSV logs** connection analysis, DNS/HTTP/TLS/SSH/file inspection
387
+ - **Cross-correlation** between Suricata alerts and Zeek network metadata
388
+ - **Threat intel** integration with MISP IOC lookup and TheHive case/alert creation
389
+ - **PCAP management** list and replay PCAPs through Suricata or Zeek
390
+ - **Advanced analytics** DGA detection, C2 beaconing, data exfiltration, lateral movement
391
+ - **Rule management** create, enable/disable, and reload custom Suricata rules
392
+ - Streaming parsers for large files, CIDR-aware filtering, gzip archive support
393
+
394
+ ## Prerequisites
395
+
396
+ - Node.js 20+
397
+ - Suricata sensor producing EVE JSON logs
398
+ - (Optional) Zeek NSM with TSV log output
399
+ - (Optional) MISP and/or TheHive instances for threat intel
400
+
198
401
  ## Resources
199
402
 
200
403
  | URI | Description |
@@ -279,6 +482,20 @@ suricata-mcp/
279
482
  generate-eve.ts # Mock EVE data generator
280
483
  ```
281
484
 
485
+ ## Why not query the logs directly?
486
+
487
+ - **`jq` / `grep` over `eve.json`.** Fine for one field on one file. It does not cross-correlate a Suricata alert with the Zeek `conn`/`dns`/`http`/`ssl` records for the same IP pair and time window, it does not compute beaconing intervals or DNS entropy, and it does not hand an LLM a typed tool surface. suricata-mcp does all of that and streams large, gzip-rotated logs without loading them whole.
488
+ - **A full SIEM (Splunk, Elastic, Wazuh).** A SIEM is the right home for long-term retention, dashboards, and multi-source alerting. suricata-mcp is not a SIEM and is not trying to be one. It is a local, zero-infrastructure way to let an agent reason over the Suricata and Zeek logs already on a sensor, with no index to feed and no service to run.
489
+ - **A generic log-tailing MCP server.** Those stream raw lines. suricata-mcp understands EVE JSON and Zeek TSV schemas, so it filters by SID, signature, JA3/JA4, MIME type, and CIDR, aggregates top talkers and protocol distributions, and returns structured results an agent can act on instead of text blobs.
490
+ - **Writing your own MCP wrapper.** You could, but you would re-implement streaming EVE/Zeek parsers, CIDR-aware filtering, the analytics, the dual mutation guard, and the redirect-refusing threat-intel client. That work is already done and tested here.
491
+
492
+ ## What suricata-mcp is not
493
+
494
+ - **Not a packet capture or IDS engine.** It does not sniff traffic or run detection. Suricata (and optionally Zeek) produce the logs; this server reads them.
495
+ - **Not a SIEM, log store, or dashboard.** No retention, no UI, no indexing. It analyzes the logs that already exist on disk.
496
+ - **Not write-happy.** By default it cannot modify your ruleset, reload the engine, or replay a PCAP. Mutating tools require both an operator environment opt-in and a per-call `confirm: true`.
497
+ - **Not a hosted service.** It runs locally over stdio against your own files. Nothing is sent anywhere except the optional, explicit MISP/TheHive calls you configure.
498
+
282
499
  ## Testing
283
500
 
284
501
  ```bash
@@ -286,6 +503,10 @@ npm test # Run all 158 tests
286
503
  npm run test:watch # Watch mode
287
504
  ```
288
505
 
506
+ ## Contributing
507
+
508
+ Issues and pull requests are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) for the contribution path and [SECURITY.md](SECURITY.md) before reporting a vulnerability. By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
509
+
289
510
  ## License
290
511
 
291
- MIT
512
+ [MIT](LICENSE)