misp-mcp 1.3.6 → 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 CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
3
  Copyright (c) 2026 Solomon Neas
4
+ Copyright (c) 2023 Effectful Technologies Inc (bundled Effect code)
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -20,16 +20,18 @@
20
20
  <img src="https://shieldcn.dev/badge/license-MIT-green.svg" alt="MIT license">
21
21
  </p>
22
22
 
23
- misp-mcp is a [Model Context Protocol](https://modelcontextprotocol.io/) server for [MISP](https://www.misp-project.org/), the open-source threat-intelligence sharing platform. It lets an LLM client such as Claude run IOC lookups, manage events, discover cross-event correlations, and export indicators directly against your own MISP instance. Unlike a generic HTTP wrapper, it ships 36 purpose-built tools, MISP-aware resources and prompts, and a confirmation gate that refuses destructive writes (delete, publish, untag) unless you explicitly approve them.
23
+ misp-mcp is a [Model Context Protocol](https://modelcontextprotocol.io/) server for [MISP](https://www.misp-project.org/), the open-source threat-intelligence sharing platform. It lets an LLM client such as Claude run IOC lookups, manage events, discover cross-event correlations, and export indicators directly against your own MISP instance. Unlike a generic HTTP wrapper, it ships 42 purpose-built tools, MISP-aware resources and prompts, and a confirmation gate that refuses destructive writes (delete, publish, untag) unless you explicitly approve them.
24
24
 
25
25
  ## What it does
26
26
 
27
- misp-mcp connects an AI agent to a MISP (Malware Information Sharing Platform & Threat Intelligence Sharing) instance over MISP's REST API and exposes it as Model Context Protocol tools, resources, and prompts. Point it at your MISP server with an API key and an LLM can search threat-intelligence events, look up and add indicators of compromise (IOCs), correlate indicators across events, attach MITRE ATT&CK galaxy clusters, check warninglists for false positives, and export IOCs as Suricata, Snort, STIX, CSV, RPZ, or hash lists. Read paths are safe by default; state-changing and destructive operations are guarded behind explicit confirmation flags so an agent cannot delete an event or publish to sharing partners without approval.
27
+ misp-mcp connects an AI agent to a MISP (Malware Information Sharing Platform & Threat Intelligence Sharing) instance over MISP's REST API and exposes it as Model Context Protocol tools, resources, and prompts. Point it at your MISP server with an API key and an LLM can search threat-intelligence events, look up and add indicators of compromise (IOCs), correlate indicators across events, attach MITRE ATT&CK galaxy clusters, check warninglists for false positives, and export IOCs as Suricata, Snort, STIX, CSV, RPZ, or hash lists. The server is read-only by default: every tool that changes MISP state refuses to run until the operator names it in `MISP_ALLOWED_MUTATIONS`. Destructive and publishing operations (delete, publish, untag, disabling a feed, false-positive and expiration sightings) additionally need a per-call confirmation flag, and bulk writes need confirmation above a small size.
28
28
 
29
- - **36 MCP tools** covering events, attributes, correlations, tags, exports, sightings, warninglists, objects, galaxies, feeds, organisations, and server administration.
29
+ - **42 MCP tools** covering events, attributes, correlations, tags, exports, sightings, warninglists, objects, galaxies, feeds, organisations, and server administration.
30
30
  - **3 MCP resources** for browsing attribute types, instance statistics, and available taxonomies.
31
31
  - **3 MCP prompts** for guided IOC investigation, incident event creation, and threat reporting.
32
- - **Confirmation-gated writes** so destructive tools refuse to run without `confirm: true` (and `confirmHard: true` for permanent deletes).
32
+ - **Read-only by default:** state-changing tools run only when listed in `MISP_ALLOWED_MUTATIONS`; each also accepts `dryRun: true` to preview a call without sending it.
33
+ - **Confirmation-gated destructive actions:** delete, publish, untag, feed disable, and false-positive/expiration sightings refuse to run without `confirm: true` (and `confirmHard: true` for permanent deletes).
34
+ - **Untrusted-data fencing:** MISP content returned to the model is wrapped in `<untrusted_misp_data>` markers, and every tool declares MCP annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`).
33
35
  - **MITRE ATT&CK integration** via galaxy cluster search and attachment.
34
36
  - **Export formats** including CSV, STIX, Suricata, Snort, text, RPZ, and hash lists.
35
37
  - **SSL flexibility** for the self-signed certificates common in on-prem MISP deployments.
@@ -48,6 +50,8 @@ claude mcp add misp \
48
50
 
49
51
  Add `--scope user` to make it available from any directory instead of only the current project.
50
52
 
53
+ The server starts read-only. To let the agent write, add `--env MISP_ALLOWED_MUTATIONS=misp_create_event,misp_add_attribute` (the tools you want enabled) or `--env MISP_ALLOWED_MUTATIONS='*'`; see [Mutation gate and destructive action safety](#mutation-gate-and-destructive-action-safety).
54
+
51
55
  Before wiring a client, verify that the package can reach MISP with the same environment:
52
56
 
53
57
  ```bash
@@ -81,6 +85,14 @@ For Claude Desktop, Cursor, or any client that reads a JSON `mcpServers` block,
81
85
 
82
86
  Claude Desktop reads this from `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows). Restart the client after editing.
83
87
 
88
+ ### Streamable HTTP
89
+
90
+ For a local HTTP MCP client such as Executor, start `npx -y misp-mcp --http` with the MISP configuration below and a separate `MISP_MCP_HTTP_TOKEN`. Generate a token with `openssl rand -hex 32`. Point the client at `http://127.0.0.1:3000/mcp` and set the `Authorization: Bearer <token>` header. The listener binds only to the IPv4 loopback interface. <!-- content-guard: allow infrastructure/loopback-ipv4 -->
91
+
92
+ Each HTTP POST shares one deadline across request parsing, MISP requests, and reply preparation. The deadline is the lesser of `MISP_TIMEOUT` and 55 seconds. The server checks it before handing the prepared reply to the MCP SDK and aborts upstream I/O on expiry, cancellation, or disconnect. Synchronous work runs until it yields, and socket delivery depends on the SDK and client. Check MISP before retrying a timed-out write because MISP may already have accepted it. HTTP tool results are capped at 90,000 serialized UTF-8 bytes. Oversized results include a fenced preview and truncation metadata, so use narrower filters or smaller pages for the full data.
93
+
94
+ Run `npx -y misp-mcp` for stdio. Both transports use the same tool registry, mutation allowlist, and confirmation gates.
95
+
84
96
  ### Prerequisites
85
97
 
86
98
  - Node.js 20 or later.
@@ -91,47 +103,97 @@ Claude Desktop reads this from `~/Library/Application Support/Claude/claude_desk
91
103
 
92
104
  | Variable | Required | Default | Description |
93
105
  |----------|----------|---------|-------------|
94
- | `MISP_URL` | Yes | - | MISP instance base URL |
106
+ | `MISP_URL` | Yes | - | MISP instance base URL. Must be `https://`; plain `http://` is accepted only for `localhost`, `127.0.0.1`, and `[::1]`. Credentials, query strings, and fragments are rejected. | <!-- content-guard: allow infrastructure/localhost-bare --> <!-- content-guard: allow infrastructure/loopback-ipv4 -->
95
107
  | `MISP_API_KEY` | Yes | - | API authentication key |
96
- | `MISP_VERIFY_SSL` | No | `true` | Set `false` for self-signed certs |
97
- | `MISP_TIMEOUT` | No | `30` | Request timeout in seconds |
98
- | `MISP_ALLOW_DESTRUCTIVE` | No | `false` | Set `true` to pre-authorize destructive tools so the per-call `confirm` flag is not required. Permanent (`hard`) deletes still require `confirmHard`. |
108
+ | `MISP_VERIFY_SSL` | No | `true` | Set `false` (or `0`) for self-signed certs. Accepts `true`, `1`, `false`, `0`, case-insensitive. |
109
+ | `MISP_TIMEOUT` | No | `30` | Request timeout in seconds (positive integer, 1–3600) |
110
+ | `MISP_ALLOWED_MUTATIONS` | No | empty (read-only) | Comma-separated list of state-changing tools the server may run (for example `misp_create_event,misp_add_attribute`), or `*` for all of them. Unknown names fail at startup. |
111
+ | `MISP_MAX_RESPONSE_BYTES` | No | `16777216` | Strict cap on one MISP response body, in bytes (1024–268435456). Larger responses are aborted. |
112
+ | `MISP_ALLOW_DESTRUCTIVE` | No | `false` | Accepts `true`, `1`, `false`, `0`, case-insensitive; any other value stops the server at startup. Set `true` to pre-authorize destructive tools so the per-call `confirm` flag is not required for tools that are already enabled by `MISP_ALLOWED_MUTATIONS`. Permanent (`hard`) deletes still require `confirmHard`. |
113
+ | `MISP_MCP_HTTP_TOKEN` | HTTP only | - | Bearer token of at least 32 characters. Use a different value from `MISP_API_KEY`. |
114
+ | `MISP_MCP_HTTP_PORT` | No | `3000` | Loopback listener port in `--http` mode. |
115
+
116
+ Boolean variables (`MISP_VERIFY_SSL`, `MISP_ALLOW_DESTRUCTIVE`) share one parser: `true`, `1`, `false`, `0`, case-insensitive after trimming; unset or empty means the default. Any other value is rejected at startup with an error that names the variable. The MCP guard and the CLI gate use the same parser, so `MISP_ALLOW_DESTRUCTIVE=1` means the same thing in both.
117
+
118
+ ### Mutation gate and destructive action safety
119
+
120
+ The server starts read-only. Read tools always work. A tool that changes MISP state returns a `Refused:` error and sends no request unless the operator lists it in `MISP_ALLOWED_MUTATIONS` (or sets it to `*`). The allowlist is read from the server's environment, so a model cannot change it.
121
+
122
+ ```
123
+ MISP_ALLOWED_MUTATIONS=misp_create_event,misp_add_attribute,misp_tag_event
124
+ ```
125
+
126
+ **State-changing tools (gated by `MISP_ALLOWED_MUTATIONS`):** `misp_create_event`, `misp_update_event`, `misp_add_event_report`, `misp_publish_event`, `misp_tag_event`, `misp_delete_event`, `misp_add_attribute`, `misp_update_attribute`, `misp_add_attributes_bulk`, `misp_delete_attribute`, `misp_add_sighting`, `misp_add_object`, `misp_delete_object`, `misp_attach_galaxy_cluster`, `misp_toggle_feed`, `misp_fetch_feed`, `misp_cache_feed`.
127
+
128
+ Every one of them accepts `dryRun: true`. A dry run validates the arguments, reports whether the tool is currently allowed, and sends nothing to MISP, so it works in read-only mode too.
129
+
130
+ **Also require `confirm: true` (or `MISP_ALLOW_DESTRUCTIVE=true`):**
131
+
132
+ - `misp_delete_event`
133
+ - `misp_delete_attribute`
134
+ - `misp_delete_object`
135
+ - `misp_publish_event`
136
+ - `misp_tag_event` when `remove: true`
137
+ - `misp_toggle_feed` when `enable: false`
138
+ - `misp_add_sighting` with `type` 1 (false positive) or 2 (expiration)
139
+ - `misp_add_attributes_bulk` with more than 10 attributes
140
+
141
+ Setting `MISP_ALLOW_DESTRUCTIVE=true` pre-authorizes the confirmations above so the per-call `confirm` flag can be omitted (useful for trusted automation). It does not enable any tool by itself; the tool must also be in `MISP_ALLOWED_MUTATIONS`.
142
+
143
+ Permanent **hard** deletes (`hard: true` on `misp_delete_attribute` / `misp_delete_object`) require a **second** confirmation, `confirmHard: true`, in addition to `confirm: true`. The env opt-in does **not** bypass `confirmHard`.
99
144
 
100
- ### Destructive action safety
145
+ Future destructive CLI commands use the same policy: `MISP_ALLOW_DESTRUCTIVE=true` plus `--confirm --destructive`, with `--confirm-hard` still required for permanent deletes.
101
146
 
102
- State-changing and destructive tools are guarded and refuse to run unless explicitly confirmed:
147
+ ### Untrusted MISP content
103
148
 
104
- - `misp_delete_event`, `misp_delete_attribute`, `misp_delete_object`, `misp_publish_event`, and `misp_tag_event` (when `remove: true`) require `confirm: true`.
105
- - Setting `MISP_ALLOW_DESTRUCTIVE=true` pre-authorizes these so the `confirm` flag can be omitted (useful for trusted automation).
106
- - Permanent **hard** deletes (`hard: true` on `misp_delete_attribute` / `misp_delete_object`) require a **second** confirmation, `confirmHard: true`, in addition to `confirm: true`. The env opt-in does **not** bypass `confirmHard`.
107
- - Future destructive CLI commands use the same policy: `MISP_ALLOW_DESTRUCTIVE=true` plus `--confirm --destructive`, with `--confirm-hard` still required for permanent deletes.
149
+ Event titles, comments, IOC values, tags, export bodies, and similar fields are written by other organizations. Tool results wrap them in `<untrusted_misp_data>` markers, the JSON resources carry them under an `untrusted_misp_data` key beside a notice so they stay valid JSON, any marker-like text inside the content is escaped, and tool descriptions and the server instructions tell the model to treat the content as data. Prompt arguments are delimited the same way.
150
+
151
+ ### Bounds
152
+
153
+ - Responses are read through a strict byte cap (`MISP_MAX_RESPONSE_BYTES`) and the request timeout stays active until the body is fully read.
154
+ - `misp_add_attributes_bulk` takes at most 100 attributes and stops after five consecutive failures; the result lists succeeded, failed, and skipped items and warns about partial updates.
155
+ - Event and attribute searches take an integer `limit` from 1 to 500 and an integer `page` from 1 through the largest safe integer. Nonempty pages suggest checking the next page when one can be requested. MISP may apply a lower limit, so a short page can still have a continuation.
156
+ - `misp_get_related_events` accepts `maxAttributes` up to 50 and `perAttributeLimit` up to 500. Tag lists are capped at 20 and object attribute lists at 100.
157
+ - Upstream error bodies are not returned to the model. Errors carry the status class, and for 4xx responses a short, redacted `message` field. The API key is redacted from every error.
108
158
 
109
159
  A guarded call returns an error (`isError: true`) with a `Refused:` message and performs no MISP request.
110
160
 
111
161
  ## Tools
112
162
 
113
- Verified against the server source (36 tools, registered in `src/tools/`).
163
+ Verified against the server source (42 tools, registered in `src/tools/`).
114
164
 
115
165
  ### Event tools (6)
116
166
 
117
167
  | Tool | Description |
118
168
  |------|-------------|
119
- | `misp_search_events` | Search events by IOC value, type, tags, date range, organization |
169
+ | `misp_search_events` | Search events by IOC value, type, tags, date range, organization. `limit` 1-500, `page` from 1 |
120
170
  | `misp_get_event` | Get full event details including attributes, objects, galaxies, related events |
121
171
  | `misp_create_event` | Create a new event with threat level, distribution, and analysis status |
122
172
  | `misp_update_event` | Update event metadata (info, threat level, analysis, publish state) |
123
173
  | `misp_publish_event` | Publish an event to trigger alerts to sharing partners (requires `confirm:true`) |
124
174
  | `misp_tag_event` | Add or remove tags (TLP, MITRE ATT&CK, custom) from an event (removal requires `confirm:true`) |
125
175
 
126
- ### Attribute tools (4)
176
+ ### Event report tools (3)
127
177
 
128
178
  | Tool | Description |
129
179
  |------|-------------|
130
- | `misp_search_attributes` | Search IOCs across all events with type, category, and correlation filters |
180
+ | `misp_list_event_reports` | List the reports attached to an event (no content). The request is scoped to the event on the MISP side and the result is bounded by `limit` (default 50, max 500) |
181
+ | `misp_get_event_report` | Read one report with its Markdown content (cut at 50,000 characters, and the result says so) |
182
+ | `misp_add_event_report` | Add a Markdown report to an event (`name`, `content` up to 1 MB, optional `distribution` 0-3, or 5 to inherit from the event; omit it to use the server default). Additive, no `confirm` flag, runs only when enabled in `MISP_ALLOWED_MUTATIONS` |
183
+
184
+ ### Attribute tools (6)
185
+
186
+ | Tool | Description |
187
+ |------|-------------|
188
+ | `misp_search_attributes` | Search IOCs across all events with type, category, and correlation filters. `limit` 1-500, `page` from 1 |
189
+ | `misp_get_attribute` | Get one attribute by ID with its tags, owning event summary, and up to 20 related attributes; reports when the correlation list is capped |
190
+ | `misp_update_attribute` | Edit an attribute in place (`value`, `type`, `category`, `toIds`, `comment`, `disableCorrelation`, `distribution`); at least one field required, no `confirm` flag, runs only when enabled in `MISP_ALLOWED_MUTATIONS` |
131
191
  | `misp_add_attribute` | Add a single IOC to an event |
132
192
  | `misp_add_attributes_bulk` | Add multiple IOCs to an event in one operation |
133
193
  | `misp_delete_attribute` | Soft or hard delete an attribute (requires `confirm:true`; hard delete also requires `confirmHard:true`) |
134
194
 
195
+ If optional tagging cannot finish after `misp_create_event` or `misp_add_attribute` succeeds, the tool returns the creation details and `tag_results` listing applied, failed, and skipped tags. Each distinct tag is attempted once, and tagging stops at the first failed request. A failed request has an unverified outcome. Check the tags in MISP and apply any missing ones to the existing record with `misp_tag_event` if enabled, or in the MISP UI. If MISP returns no created ID, all requested tags are skipped. If the event refresh fails after tagging succeeds, `tag_results.refresh_warning` explains why the response uses the original creation data.
196
+
135
197
  ### Correlation & intelligence tools (3)
136
198
 
137
199
  | Tool | Description |
@@ -154,10 +216,11 @@ Verified against the server source (36 tools, registered in `src/tools/`).
154
216
  | `misp_export_iocs` | Export IOCs in CSV, STIX, Suricata, Snort, text, or RPZ format |
155
217
  | `misp_export_hashes` | Export file hashes (MD5, SHA1, SHA256) for HIDS integration |
156
218
 
157
- ### Sighting & warninglist tools (2)
219
+ ### Sighting & warninglist tools (3)
158
220
 
159
221
  | Tool | Description |
160
222
  |------|-------------|
223
+ | `misp_list_sightings` | List the sightings recorded on an event (`limit` default 100, max 500; the result says when it was truncated) |
161
224
  | `misp_add_sighting` | Report a sighting, false positive, or expiration for an IOC |
162
225
  | `misp_check_warninglists` | Check if a value appears on known benign/false positive lists |
163
226
 
@@ -364,6 +427,40 @@ docker build -t misp-mcp .
364
427
  docker run -e MISP_URL=https://misp.example.com -e MISP_API_KEY=your-key -e MISP_VERIFY_SSL=false misp-mcp
365
428
  ```
366
429
 
430
+ The image runs as the unprivileged `node` user. Application files under `/app` are owned by root and are read-only. Its writable home is `/run/misp-mcp`, and `/tmp` also remains writable. The image does not make the entire filesystem read-only.
431
+
432
+ The build and runtime stages use the same official `node:22-slim` image pinned by digest.
433
+
434
+ The Proxmox installer creates a `misp-mcp` system user with no login shell. The service runs with a read-only filesystem, a private temporary directory, and a writable `/run/misp-mcp` directory with mode `0700`. Application files in `/opt/misp-mcp` remain owned by root. Credentials are stored in `/etc/misp-mcp/environment` with root ownership and mode `0600`, inside a root-only directory. The systemd manager reads that file before starting the unprivileged service. Edit it as root and restart the service when credentials change.
435
+
436
+ ### Reviewed Proxmox installer inputs
437
+
438
+ Before running the installer, review a local copy of the script and set these
439
+ immutable inputs. There are no defaults:
440
+
441
+ - `MISP_SOURCE_COMMIT`: the full 40-character hexadecimal commit reviewed for
442
+ installation from `https://github.com/lidless-labs/misp-mcp.git`.
443
+ - `NODE_VERSION`: an exact Node 22 version at least `22.12.0`, without a `v` prefix.
444
+ - `NODE_ARCH`: `x64` or `arm64`, matching the guest architecture.
445
+ - `NODE_SHA256`: the 64-character SHA-256 of that version's
446
+ `node-v<VERSION>-linux-<ARCH>.tar.xz` archive.
447
+
448
+ Obtain the archive checksum from the official release's signed
449
+ `SHASUMS256.txt.asc`. Verify its signature with a separately trusted Node release
450
+ keyring using the [official binary verification instructions](https://github.com/nodejs/node#verifying-binaries)
451
+ before supplying the checksum. Do not copy a checksum from the same unverified
452
+ download as the archive.
453
+
454
+ The installer rejects missing or malformed pins before any host command or LXC
455
+ creation. It downloads only from `https://nodejs.org/dist/v<VERSION>/`, checks the
456
+ archive against the supplied checksum before extraction, then fetches the reviewed
457
+ source commit from the canonical repository and checks its exact hash before
458
+ `npm ci --ignore-scripts` or the build. Node is installed in `/usr/local`, including
459
+ the service executable `/usr/local/bin/node`. Ubuntu template and apt prerequisites
460
+ still follow their upstream repositories. This does not freeze the whole OS or
461
+ provide a reproducible apt snapshot. An interrupted install leaves its guest for
462
+ operator inspection. A retry refuses an existing container ID.
463
+
367
464
  ### Standalone
368
465
 
369
466
  ```bash
@@ -401,7 +498,11 @@ misp-mcp/
401
498
  index.ts # Library export surface
402
499
  config.ts # Environment config + validation
403
500
  client.ts # MISP REST API client
404
- guards.ts # Destructive-action confirmation guards
501
+ guards.ts # Mutation allowlist + destructive-action confirmation guards
502
+ tool-specs.ts # Per-tool annotations and mutation flags
503
+ tool-registry.ts # Tool registration: gate, fence, error redaction
504
+ untrusted.ts # <untrusted_misp_data> fencing helpers
505
+ limits.ts # Bulk and fan-out maxima
405
506
  types.ts # MISP API type definitions
406
507
  resources.ts # MCP resources
407
508
  prompts.ts # MCP prompts
@@ -427,6 +528,10 @@ The MISP web UI and PyMISP are excellent for analysts working a console. misp-mc
427
528
  - **Not a credential vault.** It reads `MISP_URL` and `MISP_API_KEY` from the environment; manage and rotate those keys with your own secrets tooling.
428
529
  - **Not an autonomous deleter.** Destructive and publishing actions are confirmation-gated by design.
429
530
 
531
+ ### Container root access
532
+
533
+ The installer creates no guest root password and locks password login after starting the container. Manage the guest from its Proxmox host with `pct enter`. Service API credentials continue to use protected stdin delivery and root-only storage.
534
+
430
535
  ## License
431
536
 
432
537
  [MIT](LICENSE)