suricata-mcp 2.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 +3271 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -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
|
+
# Suricata MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://www.typescriptlang.org/)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](https://modelcontextprotocol.io/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
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.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
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
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
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
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git clone https://github.com/solomonneas/suricata-mcp.git
|
|
35
|
+
cd suricata-mcp
|
|
36
|
+
npm install
|
|
37
|
+
npm run build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
|
|
42
|
+
Set environment variables to point at your NIDS installation:
|
|
43
|
+
|
|
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 |
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
### Claude Desktop
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"suricata": {
|
|
66
|
+
"command": "node",
|
|
67
|
+
"args": ["/path/to/suricata-mcp/dist/index.js"],
|
|
68
|
+
"env": {
|
|
69
|
+
"SURICATA_EVE_LOG": "/opt/nids/suricata/logs/eve.json",
|
|
70
|
+
"SURICATA_RULES_DIR": "/opt/nids/suricata/rules",
|
|
71
|
+
"ZEEK_LOGS_DIR": "/opt/nids/zeek/logs",
|
|
72
|
+
"PCAP_DIR": "/opt/nids/pcaps",
|
|
73
|
+
"MISP_URL": "https://misp.local",
|
|
74
|
+
"MISP_API_KEY": "your-key",
|
|
75
|
+
"THEHIVE_URL": "http://thehive.local:9000",
|
|
76
|
+
"THEHIVE_API_KEY": "your-key"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Standalone
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
SURICATA_EVE_LOG=/var/log/suricata/eve.json \
|
|
87
|
+
ZEEK_LOGS_DIR=/opt/zeek/logs \
|
|
88
|
+
node dist/index.js
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Development
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run dev # Watch mode with tsx
|
|
95
|
+
npm run build # Production build
|
|
96
|
+
npm test # Run test suite (158 tests)
|
|
97
|
+
npm run lint # Type-check
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Tools
|
|
101
|
+
|
|
102
|
+
### Suricata Alert Analysis (4 tools)
|
|
103
|
+
|
|
104
|
+
| Tool | Description |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| `suricata_query_alerts` | Search alerts by SID, signature, category, severity, IP, port, protocol, action, time range |
|
|
107
|
+
| `suricata_alert_summary` | Aggregated alert statistics grouped by signature, category, severity, source, or destination |
|
|
108
|
+
| `suricata_top_alerts` | Top alerts by frequency and severity with unique source/destination counts |
|
|
109
|
+
| `suricata_alert_timeline` | Time-bucketed alert counts with severity breakdown |
|
|
110
|
+
|
|
111
|
+
### Suricata Flow Analysis (2 tools)
|
|
112
|
+
|
|
113
|
+
| Tool | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `suricata_query_flows` | Search flows by IP, port, protocol, app protocol, bytes, duration, state |
|
|
116
|
+
| `suricata_flow_summary` | Top talkers, protocol distribution, bandwidth stats |
|
|
117
|
+
|
|
118
|
+
### Suricata Protocol Analysis (6 tools)
|
|
119
|
+
|
|
120
|
+
| Tool | Description |
|
|
121
|
+
|------|-------------|
|
|
122
|
+
| `suricata_query_dns` | Search DNS queries by name, source IP, record type, response code |
|
|
123
|
+
| `suricata_query_http` | Search HTTP transactions by hostname, URL, method, status, user-agent |
|
|
124
|
+
| `suricata_query_tls` | Search TLS connections by SNI, JA3/JA4, certificate subject/issuer |
|
|
125
|
+
| `suricata_query_ssh` | Search SSH connections by client/server software version |
|
|
126
|
+
| `suricata_query_fileinfo` | Search extracted files by name, magic type, hash, size |
|
|
127
|
+
| `suricata_query_anomalies` | Search protocol anomalies by type, source/destination IP |
|
|
128
|
+
|
|
129
|
+
### Suricata Rule Management (5 tools)
|
|
130
|
+
|
|
131
|
+
| Tool | Description |
|
|
132
|
+
|------|-------------|
|
|
133
|
+
| `suricata_search_rules` | Search rule files by SID, message, classtype, reference, content |
|
|
134
|
+
| `suricata_rule_stats` | Rule set statistics: total, enabled/disabled, by action, by classtype |
|
|
135
|
+
| `suricata_create_rule` | Write a custom rule to local.rules |
|
|
136
|
+
| `suricata_toggle_rule` | Enable or disable a rule by SID |
|
|
137
|
+
| `suricata_reload_rules_docker` | Reload rules via Docker (suricata-update + SIGUSR2) |
|
|
138
|
+
|
|
139
|
+
### Suricata Engine & Live Commands (3 tools)
|
|
140
|
+
|
|
141
|
+
| Tool | Description |
|
|
142
|
+
|------|-------------|
|
|
143
|
+
| `suricata_engine_stats` | Capture, decoder, detect, and flow statistics |
|
|
144
|
+
| `suricata_reload_rules` | Live rule reload via Unix socket |
|
|
145
|
+
| `suricata_iface_stat` | Interface capture statistics via Unix socket |
|
|
146
|
+
|
|
147
|
+
### Suricata Investigation (2 tools)
|
|
148
|
+
|
|
149
|
+
| Tool | Description |
|
|
150
|
+
|------|-------------|
|
|
151
|
+
| `suricata_investigate_host` | Full host investigation across all event types |
|
|
152
|
+
| `suricata_investigate_alert` | Deep alert investigation with correlated flow and protocol data |
|
|
153
|
+
|
|
154
|
+
### Advanced Analytics (4 tools)
|
|
155
|
+
|
|
156
|
+
| Tool | Description |
|
|
157
|
+
|------|-------------|
|
|
158
|
+
| `suricata_beaconing_detection` | Detect C2 beaconing via connection interval analysis with jitter and confidence scoring |
|
|
159
|
+
| `suricata_dga_detection` | Detect DGA domains using Shannon entropy analysis on DNS queries |
|
|
160
|
+
| `suricata_exfiltration_detection` | Detect hosts with abnormally high outbound data transfer |
|
|
161
|
+
| `suricata_lateral_movement_detection` | Detect internal-to-internal scanning on unusual ports |
|
|
162
|
+
|
|
163
|
+
### Zeek NSM Analysis (8 tools)
|
|
164
|
+
|
|
165
|
+
| Tool | Description |
|
|
166
|
+
|------|-------------|
|
|
167
|
+
| `zeek_query_connections` | Search conn.log by IP, port, protocol, service, duration, bytes, state |
|
|
168
|
+
| `zeek_query_dns` | Search dns.log by query name, type, rcode |
|
|
169
|
+
| `zeek_query_http` | Search http.log by host, URI, method, status, user-agent |
|
|
170
|
+
| `zeek_query_ssl` | Search ssl.log by server name, TLS version |
|
|
171
|
+
| `zeek_query_files` | Search files.log by filename, MIME type, hash |
|
|
172
|
+
| `zeek_query_ssh` | Search ssh.log by client, server, auth success |
|
|
173
|
+
| `zeek_query_weird` | Search weird.log for protocol anomalies |
|
|
174
|
+
| `zeek_connection_summary` | Top talkers, protocol and service distribution, bandwidth stats |
|
|
175
|
+
|
|
176
|
+
### Cross-Correlation (1 tool)
|
|
177
|
+
|
|
178
|
+
| Tool | Description |
|
|
179
|
+
|------|-------------|
|
|
180
|
+
| `correlate_alert_with_zeek` | Cross-correlate Suricata alerts with Zeek conn/dns/http/ssl logs by IP pair and time window |
|
|
181
|
+
|
|
182
|
+
### PCAP Management (3 tools)
|
|
183
|
+
|
|
184
|
+
| Tool | Description |
|
|
185
|
+
|------|-------------|
|
|
186
|
+
| `pcap_list` | List available PCAP files |
|
|
187
|
+
| `pcap_replay_suricata` | Replay a PCAP through Suricata |
|
|
188
|
+
| `pcap_replay_zeek` | Replay a PCAP through Zeek |
|
|
189
|
+
|
|
190
|
+
### Threat Intelligence (3 tools)
|
|
191
|
+
|
|
192
|
+
| Tool | Description |
|
|
193
|
+
|------|-------------|
|
|
194
|
+
| `misp_search_ioc` | Search MISP for IOCs (IP, domain, hash) |
|
|
195
|
+
| `thehive_create_case` | Create a TheHive case from investigation findings |
|
|
196
|
+
| `thehive_create_alert` | Push a Suricata alert to TheHive for triage |
|
|
197
|
+
|
|
198
|
+
## Resources
|
|
199
|
+
|
|
200
|
+
| URI | Description |
|
|
201
|
+
|-----|-------------|
|
|
202
|
+
| `suricata://event-types` | All EVE event types with field descriptions |
|
|
203
|
+
| `suricata://stats/current` | Latest engine performance statistics |
|
|
204
|
+
| `suricata://rules/summary` | Rule set summary |
|
|
205
|
+
| `suricata://config` | Current server configuration (sanitized) |
|
|
206
|
+
| `zeek://log-types` | Available Zeek log types with field descriptions |
|
|
207
|
+
|
|
208
|
+
## Prompts
|
|
209
|
+
|
|
210
|
+
| Prompt | Description |
|
|
211
|
+
|--------|-------------|
|
|
212
|
+
| `investigate-alert` | Guided alert investigation workflow |
|
|
213
|
+
| `hunt-for-threats` | Proactive threat hunting methodology |
|
|
214
|
+
| `incident-response` | Full IR workflow with Suricata + Zeek + TheHive |
|
|
215
|
+
| `network-baseline` | Network baseline report generation |
|
|
216
|
+
| `daily-alert-report` | Daily alert summary report template |
|
|
217
|
+
|
|
218
|
+
## Architecture
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
suricata-mcp/
|
|
222
|
+
src/
|
|
223
|
+
index.ts # MCP server entry, tool registration
|
|
224
|
+
config.ts # Environment config (Suricata, Zeek, PCAP, MISP, TheHive)
|
|
225
|
+
types.ts # EVE JSON type definitions
|
|
226
|
+
parser/
|
|
227
|
+
eve.ts # Streaming EVE JSON parser (supports .gz)
|
|
228
|
+
rules.ts # Suricata rule file parser
|
|
229
|
+
zeek.ts # Zeek TSV log parser with header handling
|
|
230
|
+
query/
|
|
231
|
+
engine.ts # Query engine for EVE files
|
|
232
|
+
filters.ts # CIDR, wildcard, time range, IP matching
|
|
233
|
+
aggregation.ts # Statistical aggregation, top-N, numeric stats
|
|
234
|
+
timeline.ts # Time-bucketed event aggregation
|
|
235
|
+
tools/
|
|
236
|
+
alerts.ts # Suricata alert analysis
|
|
237
|
+
flows.ts # Suricata flow analysis
|
|
238
|
+
dns.ts # Suricata DNS tools
|
|
239
|
+
http.ts # Suricata HTTP tools
|
|
240
|
+
tls.ts # Suricata TLS/JA3/JA4 tools
|
|
241
|
+
files.ts # Suricata file extraction tools
|
|
242
|
+
ssh.ts # Suricata SSH tools
|
|
243
|
+
anomalies.ts # Suricata anomaly tools
|
|
244
|
+
rules.ts # Rule management (search, stats, create, toggle, reload)
|
|
245
|
+
stats.ts # Engine stats tools
|
|
246
|
+
investigation.ts # Cross-type investigation
|
|
247
|
+
zeek.ts # Zeek log query tools (conn, dns, http, ssl, files, ssh, weird)
|
|
248
|
+
pcap.ts # PCAP list and replay tools
|
|
249
|
+
threatintel.ts # MISP search + TheHive case/alert creation
|
|
250
|
+
correlation.ts # Suricata-Zeek cross-correlation
|
|
251
|
+
analytics/
|
|
252
|
+
beaconing.ts # C2 beacon detection
|
|
253
|
+
dns_entropy.ts # DGA detection via Shannon entropy
|
|
254
|
+
exfiltration.ts # Data exfiltration detection
|
|
255
|
+
lateral.ts # Lateral movement detection + RFC1918 helpers
|
|
256
|
+
ja3.ts # Known JA3 fingerprint database
|
|
257
|
+
socket/
|
|
258
|
+
client.ts # Unix socket for live Suricata commands
|
|
259
|
+
resources.ts # MCP resources
|
|
260
|
+
prompts.ts # MCP prompts
|
|
261
|
+
tests/
|
|
262
|
+
parser.test.ts # Parser unit tests
|
|
263
|
+
query.test.ts # Filter and aggregation tests
|
|
264
|
+
tools.test.ts # Tool handler integration tests
|
|
265
|
+
zeek.test.ts # Zeek parser and tool tests
|
|
266
|
+
analytics.test.ts # Advanced analytics tests
|
|
267
|
+
correlation.test.ts # Cross-correlation tests
|
|
268
|
+
test-data/
|
|
269
|
+
eve.json # Sample Suricata EVE JSON data
|
|
270
|
+
sample.rules # Sample Suricata rules
|
|
271
|
+
conn.log # Sample Zeek conn.log
|
|
272
|
+
dns.log # Sample Zeek dns.log
|
|
273
|
+
http.log # Sample Zeek http.log
|
|
274
|
+
ssl.log # Sample Zeek ssl.log
|
|
275
|
+
files.log # Sample Zeek files.log
|
|
276
|
+
ssh.log # Sample Zeek ssh.log
|
|
277
|
+
weird.log # Sample Zeek weird.log
|
|
278
|
+
scripts/
|
|
279
|
+
generate-eve.ts # Mock EVE data generator
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Testing
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
npm test # Run all 158 tests
|
|
286
|
+
npm run test:watch # Watch mode
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
MIT
|
package/dist/index.d.ts
ADDED