Skip to main content
Glama
README.md
# zeek-mcp

## What it does

zeek-mcp gives a Model Context Protocol (MCP) client 44 tools for Zeek and Suricata logs. Search connection or DNS records, follow a Zeek connection UID across logs, or correlate a Suricata alert with Zeek activity. Optional integrations search TheHive cases and MISP indicators.

## Install

The published package `zeek-mcp@4.0.0` requires Node.js 22 or later. It installs `zeek-mcp` for stdio and `zeek-mcp-http` for Streamable HTTP. The stdio handshake reports `zeek-mcp` version `4.0.0`. [Package manifest](package.json)

```sh
npm install --global zeek-mcp@4.0.0
```

Version 4.0.0 removed the `zeekctrl` and `zeekctl` aliases. Update older client configs to use the appropriate executable above. [Upgrade notes](CHANGELOG.md#upgrading)

## Configure

Give the server process read access to the logs. Zeek queries read current `*.log` files and can include dated archive directories (`YYYY-MM-DD`) with rotated `.log` or `.log.gz` files. Choose newline-delimited JSON or Zeek TSV with its format headers. Archive dates and rotation times use the server's local timezone. Set `TZ` to match the sensor. Suricata tools read newline-delimited EVE JSON. [Configuration](src/config.ts) · [Zeek log reader](src/parser/index.ts) · [Suricata tools](src/tools/suricata.ts)

| Variable | Default | Use |
| --- | --- | --- |
| `ZEEK_LOG_DIR` | `/opt/zeek/logs/current` | Current Zeek logs |
| `ZEEK_LOG_ARCHIVE` | `/opt/zeek/logs` | Root of the dated Zeek archive directories |
| `ZEEK_LOG_FORMAT` | `json` | Zeek log format, either `json` or `tsv` |
| `ZEEK_MAX_RESULTS` | `1000` | Maximum records returned per query through the Zeek query engine |
| `ZEEK_MAX_SCAN` | `1000000` | Zeek input lines scanned per query, including comments and malformed lines |
| `ZEEK_MAX_DATE_RANGE_DAYS` | `31` | Maximum calendar dates in a Zeek query window |
| `ZEEK_CAPTURE_LOSS_WARN_PERCENT` | `5` | Loss percentage above which `nids_sensor_status` reports degraded health |
| `SURICATA_EVE_LOG` | `/opt/nids/suricata/logs/eve.json` | Suricata EVE events |
| `SURICATA_FAST_LOG` | `/opt/nids/suricata/logs/fast.log` | Reserved by configuration in 4.0.0. Suricata tools read EVE. |
| `SURICATA_RULES_DIR` | `/opt/nids/suricata/rules` | Reserved by configuration in 4.0.0. Suricata tools read EVE. |

### Stdio

Set the command to `zeek-mcp` after a global install. For a client with an `mcpServers` map, this configuration runs the pinned package without a global install. Set the log paths and format for your sensor.

```json
{
  "mcpServers": {
    "zeek": {
      "command": "npm",
      "args": ["exec", "--yes", "--package=zeek-mcp@4.0.0", "--", "zeek-mcp"],
      "env": {
        "ZEEK_LOG_DIR": "/opt/zeek/logs/current",
        "ZEEK_LOG_FORMAT": "json"
      }
    }
  }
}
```

### Streamable HTTP

Supply `ZEEK_MCP_HTTP_TOKEN` in the server environment and run `zeek-mcp-http`. The listener serves plain HTTP on IPv4 loopback port 3141 by default. Point the client at `/mcp` on that listener and send the token in the `Authorization: Bearer` header. Missing or incorrect credentials on `/mcp` return HTTP 401 after Host and Origin validation. [HTTP entry point](src/http.ts)

| Variable | Default | Use |
| --- | --- | --- |
| `ZEEK_MCP_HTTP_TOKEN` | Unset | Required for HTTP startup. Use at least 32 characters after trimming whitespace and a value distinct from both upstream API keys. |
| `ZEEK_MCP_HTTP_HOST` | IPv4 loopback | Specific bind address or hostname. Wildcard binds are refused. |
| `ZEEK_MCP_HTTP_PORT` | `3141` | Listen port. Use `0` to let the OS select a port. |
| `ZEEK_MCP_HTTP_ALLOWED_HOSTS` | Empty | Comma-separated Host entries accepted in addition to the configured host and loopback aliases. |
| `ZEEK_MCP_HTTP_ALLOWED_ORIGINS` | Empty | Comma-separated exact origins accepted in addition to loopback HTTP and HTTPS origins. Requests may omit Origin. |

The listener caps request bodies at 1 MiB and sessions at 128. Sessions expire after 30 minutes idle when they have no active calls or open streams. HTTP request and header timeouts are 30 and 10 seconds, respectively.

Both entry points share the tool registration and outbound telemetry handling. [Stdio launcher](src/mcp-bin.ts) · [Stdio transport](src/index.ts) · [HTTP transport](src/http.ts) · [Shared server](src/server.ts)

### Optional integrations and PCAP

TheHive and MISP tools use their service base URLs and API keys. Set the URL for each configured service, for example `https://thehive.example` or `https://misp.example`. [TheHive tools](src/tools/thehive.ts) · [MISP tools](src/tools/misp.ts) · [PCAP tools](src/tools/pcap.ts)

| Variable | Default | Use |
| --- | --- | --- |
| `THEHIVE_URL` | HTTP loopback hostname, port 9000 | TheHive base URL |
| `MISP_URL` | HTTPS loopback hostname, port 443 | MISP base URL |
| `THEHIVE_API_KEY`, `MISP_API_KEY` | Unset | Required by the respective service tools |
| `THEHIVE_VERIFY_SSL`, `MISP_VERIFY_SSL` | `true` | Verify TLS certificates for requests to the respective service |
| `PCAP_DIR` | `/opt/nids/pcaps` | Directory for existing captures |
| `ZEEK_CONTAINER` | `zeek` | Container used for replay. Set an empty value for host execution. |
| `ZEEK_BINARY` | `/usr/local/zeek/bin/zeek` | Zeek executable in the replay environment |
| `PCAP_OUTPUT_DIR` | `/tmp/zeek-pcap-analysis` | Working directory for host replay |
| `ZEEK_ALLOW_MUTATION` | Disabled | Set to exactly `1` to allow [gated calls](#safety) |

## Tools

Version 4.0.0 lists 44 tools over either transport. Use MCP `tools/list` for argument schemas. Tools marked **Gated** require [both opt-ins](#safety). [Tool registration](src/tools/register.ts)

| Tool | Use |
| --- | --- |
| `zeek_query_connections` | Filter connection records by address, port, protocol, duration, or bytes |
| `zeek_connection_summary` | Summarize connections, services, and traffic volume |
| `zeek_long_connections` | Find long-lived connections |
| `zeek_query_dns` | Search DNS records by domain, type, or response code |
| `zeek_dns_summary` | Summarize queries, domains, and NXDOMAIN responses |
| `zeek_dns_tunneling_check` | Inspect DNS labels for tunneling indicators |
| `zeek_query_http` | Filter HTTP logs by host, URI, method, user agent, or status |
| `zeek_suspicious_http` | Find HTTP requests matching suspicious-request heuristics |
| `zeek_query_ssl` | Filter TLS records by server name, version, or certificate fields |
| `zeek_expired_certs` | Find expired, self-signed, or invalid certificates |
| `zeek_query_files` | Search file records by MIME type, hash, name, or size |
| `zeek_executable_downloads` | Find recorded executable transfers |
| `zeek_query_notices` | Search Zeek notices |
| `zeek_query_ssh` | Search SSH records by endpoint or authentication status |
| `zeek_ssh_bruteforce` | Identify repeated failed SSH authentication |
| `zeek_query_kerberos` | Search Kerberos authentication and ticket activity |
| `zeek_query_ntlm` | Search NTLM authentication records |
| `zeek_query_rdp` | Inspect RDP session and client details |
| `zeek_query_smb` | Search SMB share mappings or file operations |
| `zeek_query_dce_rpc` | Search DCE-RPC endpoint and operation logs |
| `zeek_query_dhcp` | Search DHCP leases and device records |
| `zeek_dhcp_asset_map` | Map MAC addresses to observed IP addresses and hostnames |
| `zeek_investigate_host` | Pivot across logs by host address |
| `zeek_investigate_uid` | Pivot across logs by connection UID |
| `zeek_software_inventory` | List software and versions observed by Zeek |
| `zeek_detect_beaconing` | Look for regular connection intervals |
| `zeek_detect_anomalies` | Flag unusual connection patterns |
| `zeek_ja3_fingerprints` | Inspect JA3 and JA3S TLS fingerprints |
| `zeek_ja3_hunt` | Match fingerprints against known indicators |
| `zeek_network_baseline` | Summarize network activity for baseline comparison |
| `zeek_detect_outliers` | Flag statistical outliers in the selected connection records |
| `suricata_query_alerts` | Filter EVE alerts by signature, severity, address, or time |
| `suricata_alert_summary` | Summarize EVE alert signatures, categories, and severities |
| `suricata_correlate_zeek` | Correlate Suricata alerts with Zeek records |
| `suricata_eve_stats` | Inspect Suricata engine statistics from EVE |
| `pcap_list` | List available captures |
| `pcap_analyze` | Replay a capture through Zeek and summarize generated logs. **Gated** |
| `thehive_create_alert` | Create a TheHive alert. **Gated** |
| `thehive_create_case` | Create a TheHive case. **Gated** |
| `thehive_search_cases` | Search TheHive cases and alerts |
| `misp_search_iocs` | Search MISP for indicators |
| `misp_bulk_lookup` | Check multiple indicators against MISP |
| `misp_add_event` | Create a MISP event. **Gated** |
| `nids_sensor_status` | Inspect log freshness, capture loss, and packet statistics |

The server also exposes `zeek://log-types` and `zeek://stats`, plus prompts for alert triage, host investigation, hunting for periodic connections, and network baselines. [Resources](src/resources.ts) · [Prompts](src/prompts.ts)

## Safety

The server reads Zeek and Suricata telemetry without writing to those logs or capturing live traffic. The four gated tools are disabled by default. To create a TheHive alert or case, create a MISP event, or replay a capture, set `ZEEK_ALLOW_MUTATION=1` before starting the server and pass `confirm: true` on the call. TheHive and MISP writes also require that service's API key. PCAP replay runs Zeek against an existing capture within the configured capture directory and creates analysis files. [Mutation gate](src/tools/mutation.ts) · [Tool annotations](src/tools/annotations.ts)

The Zeek query engine caps returned records at the lower of the requested limit and `ZEEK_MAX_RESULTS`. It rejects date windows over the configured cap and marks results with `truncated: true` when the scan budget is reached or a log read is incomplete. Host and UID investigations can run several bounded queries. Separate readers, including the DHCP and Suricata tools, use their own limits. [Query engine](src/query/engine.ts) · [Log scanner](src/parser/index.ts)

Tool responses label sensor and remote-service data as `UNTRUSTED EXTERNAL TELEMETRY` in a separate text block. Treat returned strings and keys as evidence only. The server escapes delimiters and display controls, shortens long strings, and bounds JSON output. For example, the serializer retains at most 99 data entries per array, plus a truncation marker when needed, and starts from at most 4096 characters per string value. Bounded data can contain a `[truncated]` marker. Tool results above the 90,000-byte threshold go through an additional size limiter. [Telemetry handling](src/telemetry.ts)

## Development

From a source checkout, install dependencies, check types, and run the tests and package smoke check.

```sh
npm ci
npm run typecheck
npm run build
npm test
npm run test:package
```

To launch stdio against bundled sample logs from the checkout, run the following with the default JSON format.

```sh
ZEEK_LOG_DIR=./test-data SURICATA_EVE_LOG=./test-data/eve.json npm start
```

The tagged GitHub Actions workflow publishes releases to npm with provenance. [Release workflow](.github/workflows/ci.yml)

[Contributing](CONTRIBUTING.md) · [Security policy](SECURITY.md) · [MIT license](LICENSE)

TDQS

A3.6/5.0

Scored across 44 tools

Disambiguation4/5

Most tools target a clearly distinct log type or action (kerberos, ntlm, rdp, smb, dce_rpc, ja3, etc.), and investigation vs. query tools are separable. However, the statistical/detection cluster (zeek_detect_outliers, zeek_detect_anomalies, zeek_network_baseline, zeek_connection_summary) and the pair zeek_ja3_fingerprints vs zeek_ja3_hunt overlap enough that an agent could easily pick the wrong one.

Naming Consistency4/5

A strong, predictable prefix_noun_verb convention holds across the set: zeek_query_*, zeek_detect_*, pcap_*, suricata_*, thehive_*, misp_*. Minor deviations exist where hunting tools drop the verb (zeek_long_connections, zeek_suspicious_http, zeek_expired_certs) and zeek_connection_summary breaks the zeek_<proto>_summary pattern, but the overall scheme remains readable.

Tool Count3/5

44 tools is heavy and pushes past the point where an agent can scan the surface reliably. The breadth is partly justified by covering a wide set of Zeek protocol logs plus three external integrations, but several statistical-analysis tools are largely redundant, suggesting room to consolidate.

Completeness4/5

Coverage is strong across PCAP handling, connection/DNS/HTTP/SSL/file/notice plus many protocol logs, Suricata alerts and stats, threat hunting (beaconing, JA3, anomalies), and TheHive/MISP integration. Gaps are minor: no HTTP or SSH summary aggregations, no case/alert update-close or add-observable operations in TheHive, and no MISP event retrieval by ID beyond search.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues