suricata-mcp 2.1.2 → 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 CHANGED
@@ -2,6 +2,9 @@
2
2
  <img src="docs/assets/suricata-mcp-social-preview.jpg" alt="suricata-mcp banner" width="900">
3
3
  </p>
4
4
 
5
+ <p align="center">
6
+ <a href="https://lidless.dev"><img src="docs/assets/marks/suricata-mcp-circle.png" width="48" alt="Lidless Labs"></a>
7
+ </p>
5
8
  <h1 align="center">suricata-mcp</h1>
6
9
 
7
10
  <p align="center">
@@ -23,7 +26,9 @@ suricata-mcp is a Model Context Protocol (MCP) server for network security monit
23
26
 
24
27
  ## What it does
25
28
 
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.
29
+ 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 or JSON 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. Zeek JSON records omit unset fields by default, while unset fields in TSV records are returned as empty strings.
30
+
31
+ 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.
27
32
 
28
33
  ## Installation
29
34
 
@@ -56,7 +61,7 @@ Add suricata-mcp to any MCP client with the published npm package. No clone or b
56
61
  }
57
62
  ```
58
63
 
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.
64
+ 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.
60
65
 
61
66
  ## Usage
62
67
 
@@ -75,9 +80,9 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
75
80
  "SURICATA_RULES_DIR": "/opt/nids/suricata/rules",
76
81
  "ZEEK_LOGS_DIR": "/opt/nids/zeek/logs",
77
82
  "PCAP_DIR": "/opt/nids/pcaps",
78
- "MISP_URL": "https://misp.local",
83
+ "MISP_URL": "https://misp.example.com",
79
84
  "MISP_API_KEY": "your-key",
80
- "THEHIVE_URL": "http://thehive.local:9000",
85
+ "THEHIVE_URL": "https://thehive.example.com",
81
86
  "THEHIVE_API_KEY": "your-key"
82
87
  }
83
88
  }
@@ -85,28 +90,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
85
90
  }
86
91
  ```
87
92
 
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.
93
+ If you installed from source, set `"command": "suricata-mcp"` (global npm install) or `"command": "node"` with `"args": ["/absolute/path/to/suricata-mcp/dist/index.js"]`.
110
94
 
111
95
  ### Claude Code
112
96
 
@@ -122,12 +106,12 @@ Add `--scope user` to make it available from any directory instead of only the c
122
106
 
123
107
  ### OpenClaw
124
108
 
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`:
109
+ If you're running from a source checkout instead of the npm-installed binary, point `command`/`args` at the built `dist/index.js`:
126
110
 
127
111
  ```bash
128
112
  openclaw mcp set suricata '{
129
113
  "command": "node",
130
- "args": ["/absolute/path/to/suricata-mcp/dist/mcp-bin.js"],
114
+ "args": ["/absolute/path/to/suricata-mcp/dist/index.js"],
131
115
  "env": {
132
116
  "SURICATA_EVE_LOG": "/opt/nids/suricata/logs/eve.json",
133
117
  "SURICATA_RULES_DIR": "/opt/nids/suricata/rules",
@@ -178,7 +162,7 @@ Or, when running from a source checkout instead of the published package:
178
162
  mcp_servers:
179
163
  suricata:
180
164
  command: "node"
181
- args: ["/absolute/path/to/suricata-mcp/dist/mcp-bin.js"]
165
+ args: ["/absolute/path/to/suricata-mcp/dist/index.js"]
182
166
  env:
183
167
  SURICATA_EVE_LOG: "/opt/nids/suricata/logs/eve.json"
184
168
  SURICATA_RULES_DIR: "/opt/nids/suricata/rules"
@@ -210,7 +194,7 @@ codex mcp add suricata \
210
194
  --env SURICATA_EVE_LOG=/opt/nids/suricata/logs/eve.json \
211
195
  --env SURICATA_RULES_DIR=/opt/nids/suricata/rules \
212
196
  --env ZEEK_LOGS_DIR=/opt/nids/zeek/logs \
213
- -- node /absolute/path/to/suricata-mcp/dist/mcp-bin.js
197
+ -- node /absolute/path/to/suricata-mcp/dist/index.js
214
198
  ```
215
199
 
216
200
  Codex writes the entry to `~/.codex/config.toml` under `[mcp_servers.suricata]`. Verify with:
@@ -224,7 +208,7 @@ codex mcp list
224
208
  ```bash
225
209
  SURICATA_EVE_LOG=/var/log/suricata/eve.json \
226
210
  ZEEK_LOGS_DIR=/opt/zeek/logs \
227
- node dist/mcp-bin.js
211
+ node dist/index.js
228
212
  ```
229
213
 
230
214
  ### Development
@@ -275,13 +259,19 @@ npm run lint # Type-check
275
259
  | `suricata_toggle_rule` | Enable or disable a rule by SID |
276
260
  | `suricata_reload_rules_docker` | Reload rules via Docker (suricata-update + SIGUSR2) |
277
261
 
278
- ### Suricata Engine & Live Commands (3 tools)
262
+ ### Suricata Engine & Live Commands (7 tools)
279
263
 
280
264
  | Tool | Description |
281
265
  |------|-------------|
282
266
  | `suricata_engine_stats` | Capture, decoder, detect, and flow statistics |
283
267
  | `suricata_reload_rules` | Live rule reload via Unix socket |
284
268
  | `suricata_iface_stat` | Interface capture statistics via Unix socket |
269
+ | `suricata_uptime` | Engine uptime via Unix socket |
270
+ | `suricata_ruleset_stats` | Loaded and failed ruleset counts via Unix socket |
271
+ | `suricata_ruleset_failed_rules` | Failed rule text from the engine via Unix socket |
272
+ | `suricata_dump_counters` | Performance counters via Unix socket |
273
+
274
+ Socket responses are untrusted data. The shared output envelope caps large results; check `_provenance.truncated` to see whether any output was omitted.
285
275
 
286
276
  ### Suricata Investigation (2 tools)
287
277
 
@@ -346,12 +336,13 @@ Set environment variables to point at your NIDS installation:
346
336
  | `SURICATA_MAX_RESULTS` | `1000` | Maximum results per query |
347
337
  | `SURICATA_UNIX_SOCKET` | _(none)_ | Unix socket path for live commands |
348
338
  | `ZEEK_LOGS_DIR` | _(none)_ | Zeek log directory (enables Zeek tools) |
339
+ | `ZEEK_LOG_FORMAT` | `auto` | Zeek log format: `auto` detects each file, or force `json` / `tsv`; values are trimmed and case-insensitive, and invalid values fall back to `auto` |
349
340
  | `PCAP_DIR` | _(none)_ | PCAP drop directory (enables PCAP tools) |
350
341
  | `MISP_URL` | _(none)_ | MISP instance URL |
351
342
  | `MISP_API_KEY` | _(none)_ | MISP API key |
352
343
  | `THEHIVE_URL` | _(none)_ | TheHive instance URL |
353
344
  | `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. |
345
+ | `SURICATA_ALLOW_MUTATION` | _(off)_ | Set to `1` to enable mutating tools (rule writes, ruleset reload, PCAP replay, TheHive creation). Off by default. |
355
346
 
356
347
  ### Mutating tools (opt-in)
357
348
 
@@ -361,17 +352,23 @@ tools that change a live IDS or shell out are disabled. To enable them you must:
361
352
  1. Set `SURICATA_ALLOW_MUTATION=1` in the server environment (operator opt-in), **and**
362
353
  2. Pass `confirm: true` on the tool call itself (per-invocation opt-in).
363
354
 
364
- Both guards must be satisfied; otherwise the tool returns an error without
355
+ Both guards must be satisfied. Otherwise the tool returns an error without
365
356
  acting. The gated tools are:
366
357
 
367
- - `suricata_create_rule` - appends to `local.rules`. Additionally enforces a
358
+ - `suricata_create_rule` - appends to `local.rules`. Also enforces a
368
359
  local SID range (`sid >= 1000000`) and rejects SIDs that collide with the
369
- loaded ruleset.
360
+ loaded ruleset. Rule text must be a single line with no newline or carriage
361
+ return characters.
362
+ - `suricata_toggle_rule` - enables or disables a rule by SID in `local.rules`.
363
+ - `suricata_reload_rules` - reloads rules through the Unix socket.
364
+ - `thehive_create_case` / `thehive_create_alert` - creates a case or alert in TheHive.
370
365
  - `suricata_reload_rules_docker` - runs `suricata-update` + `SIGUSR2` against the
371
366
  live container.
372
367
  - `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.
368
+ Filenames must be a bare name of letters, digits, `.`, `-`, and `_` (anything
369
+ else is rejected), are rejected if they begin with `-` (option-injection), and
370
+ concurrent replays are capped. Docker is invoked with argv arrays, never a
371
+ shell.
375
372
 
376
373
  Threat-intel HTTP calls (MISP/TheHive) use `redirect: "manual"`, so a 3xx from a
377
374
  compromised or misconfigured endpoint is refused rather than followed with the
@@ -379,11 +376,11 @@ API key attached.
379
376
 
380
377
  ## Features
381
378
 
382
- - **41 tools** for comprehensive network security analysis
379
+ - **45 tools** for network security analysis
383
380
  - **5 resources** for quick reference data
384
381
  - **5 prompts** for guided investigation workflows
385
382
  - **Suricata EVE JSON** alert querying, flow analysis, protocol inspection, rule management
386
- - **Zeek TSV logs** connection analysis, DNS/HTTP/TLS/SSH/file inspection
383
+ - **Zeek TSV or JSON logs** connection analysis, DNS/HTTP/TLS/SSH/file inspection
387
384
  - **Cross-correlation** between Suricata alerts and Zeek network metadata
388
385
  - **Threat intel** integration with MISP IOC lookup and TheHive case/alert creation
389
386
  - **PCAP management** list and replay PCAPs through Suricata or Zeek
@@ -393,9 +390,9 @@ API key attached.
393
390
 
394
391
  ## Prerequisites
395
392
 
396
- - Node.js 20+
393
+ - Node.js 22+
397
394
  - Suricata sensor producing EVE JSON logs
398
- - (Optional) Zeek NSM with TSV log output
395
+ - (Optional) Zeek NSM with TSV or JSON log output
399
396
  - (Optional) MISP and/or TheHive instances for threat intel
400
397
 
401
398
  ## Resources
@@ -429,7 +426,7 @@ suricata-mcp/
429
426
  parser/
430
427
  eve.ts # Streaming EVE JSON parser (supports .gz)
431
428
  rules.ts # Suricata rule file parser
432
- zeek.ts # Zeek TSV log parser with header handling
429
+ zeek.ts # Zeek TSV and JSON log parser
433
430
  query/
434
431
  engine.ts # Query engine for EVE files
435
432
  filters.ts # CIDR, wildcard, time range, IP matching
@@ -485,13 +482,13 @@ suricata-mcp/
485
482
  ## Why not query the logs directly?
486
483
 
487
484
  - **`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.
485
+ - **A full SIEM (Splunk, Elastic, Wazuh).** A SIEM is the right home for long-term retention, dashboards, and multi-source alerting. suricata-mcp lets an agent inspect the Suricata and Zeek logs already on a sensor, without maintaining an index or running another service.
486
+ - **A generic log-tailing MCP server.** Those stream raw lines. suricata-mcp understands EVE JSON and Zeek TSV/JSON 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
487
  - **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
488
 
492
489
  ## What suricata-mcp is not
493
490
 
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.
491
+ - **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
492
  - **Not a SIEM, log store, or dashboard.** No retention, no UI, no indexing. It analyzes the logs that already exist on disk.
496
493
  - **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
494
  - **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.
@@ -510,3 +507,11 @@ Issues and pull requests are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING
510
507
  ## License
511
508
 
512
509
  [MIT](LICENSE)
510
+
511
+ ---
512
+
513
+ <p align="center"><a href="https://lidless.dev">Part of <strong>Lidless Labs</strong></a> &middot; the eye does not close</p>
514
+
515
+ <p align="center"><sub><strong>Security / SOC:</strong> <a href="https://github.com/lidless-labs/soc-stack">soc-stack</a> &middot; <a href="https://github.com/lidless-labs/wazuh-mcp">wazuh-mcp</a> &middot; <a href="https://github.com/lidless-labs/misp-mcp">misp-mcp</a> &middot; <a href="https://github.com/lidless-labs/thehive-mcp">thehive-mcp</a> &middot; <a href="https://github.com/lidless-labs/cortex-mcp">cortex-mcp</a> &middot; <a href="https://github.com/lidless-labs/mitre-mcp">mitre-mcp</a> &middot; <a href="https://github.com/lidless-labs/zeek-mcp">zeek-mcp</a> &middot; <a href="https://github.com/lidless-labs/hotwash">hotwash</a></sub></p>
516
+
517
+ <p align="center"><sub><a href="https://lidless.dev">All tools</a> &middot; <a href="https://github.com/lidless-labs">Lidless Labs on GitHub</a></sub></p>