OpenCTI MCP Server
A Model Context Protocol server that exposes OpenCTI, the open-source threat-intelligence platform, to AI assistants. Built on the official pycti client, it registers 45 typed tools (91 when writes are enabled) across 15 threat-intel domains — indicators, observables, reports, malware, threat actors, intrusion sets, campaigns, attack patterns, tools, vulnerabilities, incidents, cases, relationships, identities, and labels/markings — plus platform/operations tools (connectors, users, groups, files), STIX bundle import/export, a graphql_query escape-hatch, and cross-cutting search/relationship/observable-lookup tools for anything the typed per-domain tools don't cover.
Tools
| Domain | Reads | Writes | Notable tools |
|---|---|---|---|
| Indicators | 2 | 3 | indicators_list, indicators_get, indicators_create |
| Observables | 2 | 3 | observables_list, observables_get, observables_create |
| Reports | 2 | 3 | reports_list, reports_get, reports_create |
| Malware | 2 | 3 | malware_list, malware_get, malware_create |
| Threat actors | 2 | 3 | threat_actors_list, threat_actors_get, threat_actors_create |
| Intrusion sets | 2 | 3 | intrusion_sets_list, intrusion_sets_get, intrusion_sets_create |
| Campaigns | 2 | 3 | campaigns_list, campaigns_get, campaigns_create |
| Attack patterns | 2 | 3 | attack_patterns_list, attack_patterns_get, attack_patterns_create |
| Tools | 2 | 3 | tools_list, tools_get, tools_create |
| Vulnerabilities | 2 | 3 | vulnerabilities_list, vulnerabilities_get, vulnerabilities_create |
| Incidents | 2 | 3 | incidents_list, incidents_get, incidents_create |
| Cases | 2 | 3 | cases_list, cases_get, cases_create |
| Relationships | 2 | 3 | relationships_list, relationships_get, relationships_create |
| Identities | 2 | 2 | identities_list, identities_get, identities_create (organizations/individuals/systems/sectors), identities_delete |
| Labels & markings | 4 | 3 | labels_list, labels_create, markings_list, markings_get |
Every domain also has an _update and _delete tool once writes are enabled (markings are read-only; identities has _create/_delete but no _update). In addition, graphql_query runs a raw GraphQL query/mutation against the OpenCTI API for anything not covered by a typed tool above — reads always work, mutations are rejected unless OPENCTI_READ_ONLY=false. See docs/ENDPOINTS.md for the full tool-to-pycti-call mapping.
Every *_list tool also accepts order_by (a field name, e.g. "created_at") and descending (default true), so order_by="created_at" gives most-recent-first without any extra filtering.
observables_create also accepts StixFile.* observable keys (normalized to File.*), coerces Autonomous-System.number values to an integer, and takes an optional additional_hashes param (a list of "ALGO:VALUE" entries, e.g. "SHA-1:...") to attach extra hashes to a file observable alongside the primary one.
Cross-cutting read tools
search_all(query, types?, first?)— full-text search across all STIX object types at once, optionally restricted to specifictypes.relationships_for_entity(entity_id, relationship_type?, first?)— lists relationships touching an entity as either source or target, e.g. "what is related to X".observables_by_value(value, first?)— exact-value lookup for an observable (IP, domain, URL, hash, etc.) without knowing its id.
Platform & operations
connectors_list/connectors_get(connector_id)— list connectors and check one's status/health (active, state, queue details).users_list/users_get(id)— list/get OpenCTI users.groups_list/groups_get(id)— list/get OpenCTI groups.files_for_entity(entity_id)— list files/attachments on an entity.stix_export_entity(entity_type, entity_id, mode?)/stix_export_list(entity_type, first=25, mode?)— export a single entity, or up tofirstentities of a type (max 500), as a STIX 2 bundle; large exports are capped byfirst, and if the bundle is still too large a small note (_note,entity_type,first,object_count) is returned instead.stix_import_bundle(bundle_json, update?)— write, requiresOPENCTI_READ_ONLY=false— bulk create/update entities and relationships from a STIX bundle.entity_ask_enrichment(entity_id, connector_id)— write, requiresOPENCTI_READ_ONLY=false— trigger a connector to enrich an entity.
Two related capabilities are intentionally not exposed as typed tools and remain available via graphql_query: OpenCTI status templates, and connector start/stop/reset (pycti exposes no dedicated method for either).
Bundled skill
A Claude Skill lives at skills/opencti-usage/ that teaches an AI agent OpenCTI's model — the STIX data model, entity types, indicators vs observables, relationships, containers, TLP markings, confidence, connectors, and RBAC — and maps each concept to the right MCP tool above. An agent operating the opencti tools loads this skill to understand the platform before creating, relating, or reasoning about OpenCTI data.
skills/opencti-usage/SKILL.mdis the entry point; thereferences/folder holds the per-topic detail.- The content is distilled from the official OpenCTI docs (
docs.opencti.io/latest), distilled 2026-07-10. Each reference file has a## Sourcelink back to the docs it was drawn from, so it can be refreshed later.
Quick start
Install
From PyPI (recommended):
uv tool install opencti-mcp # installs the `opencti-mcp` command
Or with pip, or run it without installing:
pip install opencti-mcp
uvx --from opencti-mcp opencti-mcp --help # run ad hoc, no install
From source (for development):
git clone https://github.com/Space-C0wboy/OpenCTI-MCP-Server.git
cd OpenCTI-MCP-Server
uv venv
uv pip install -e ".[dev]"
Get an API token
In OpenCTI, open your profile menu → API access, then copy your personal access token.
Configuration
Configuration is read from environment variables, or from a .env file in the working directory (either a standard KEY=value dotenv file or a JSON-style fragment). OS environment variables always take precedence over the file.
| Variable | Required | Default | Description |
|---|---|---|---|
OPENCTI_URL |
Yes | — | Base URL of your OpenCTI instance |
OPENCTI_TOKEN |
Yes | — | OpenCTI API token |
OPENCTI_READ_ONLY |
No | true |
When true, hides all write tools and blocks mutations |
OPENCTI_TIMEOUT |
No | 30 |
Request timeout in seconds |
OPENCTI_SSL_VERIFY |
No | true |
Verify TLS certificates |
LOG_LEVEL |
No | INFO |
Logging verbosity |
MCP_HTTP_HOST |
No | 127.0.0.1 |
Bind host when using --transport http |
MCP_HTTP_PORT |
No | 8765 |
Bind port when using --transport http |
Run
Stdio (default, for editor/IDE integrations):
opencti-mcp # if installed via `uv tool install` / `pip`
# from source: uv run opencti-mcp
HTTP transport:
opencti-mcp --transport http --host 127.0.0.1 --port 8765
Read-only mode
OPENCTI_READ_ONLY defaults to true. In read-only mode, only list/get tools and markings_list/markings_get are registered — no *_create, *_update, or *_delete tool is available for any domain, and graphql_query raises an error if the query document contains a mutation. Set OPENCTI_READ_ONLY=false to register the write tools and allow graphql_query to run mutations.
Editor integration
Claude Desktop
Add to claude_desktop_config.json (uses uvx, no install or local path needed):
{
"mcpServers": {
"opencti": {
"command": "uvx",
"args": ["--from", "opencti-mcp", "opencti-mcp"],
"env": {
"OPENCTI_URL": "https://your-opencti-instance.example.com/",
"OPENCTI_TOKEN": "your-api-token"
}
}
}
}
If you installed it (uv tool install opencti-mcp / pip install opencti-mcp), use "command": "opencti-mcp" with "args": [] instead. To run from a source checkout, use "command": "uv", "args": ["--directory", "/absolute/path/to/OpenCTI-MCP-Server", "run", "opencti-mcp"].
Claude Code
claude mcp add opencti -- uvx --from opencti-mcp opencti-mcp
Example prompts
- "List the 10 most recent indicators."
- "Search reports mentioning 'Emotet'."
- "Show me the MITRE ATT&CK technique T1059."
- "Create an IPv4 observable for 1.2.3.4." (requires
OPENCTI_READ_ONLY=false) - "Which threat actors are linked to intrusion set APT29?"
- "Get the full detail on case CASE-ID, including its labels and markings."
- "What are the 10 most recent reports?"
- "Is 1.2.3.4 in OpenCTI?"
- "What is this threat actor related to?"
- "Search across everything for 'Emotet'."
- "Are our OpenCTI connectors healthy?"
- "Export this report as a STIX bundle."
- "List the groups in OpenCTI."
- "Add the victim organization 'Acme Corp' to OpenCTI." (requires
OPENCTI_READ_ONLY=false) - "Create an individual identity for John Doe with a description."
Development
uv run pytest
uv run ruff check .
License
MIT — see LICENSE.
Support
This is a community-maintained project provided as-is, with no guaranteed support SLA. Issues and pull requests are welcome.
Metadata
Release files for opencti-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| opencti_mcp-0.1.1.tar.gz | 204.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opencti_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 232.2 kB
Release files / opencti_mcp-0.1.1.tar.gz
| Download URL | opencti_mcp-0.1.1.tar.gz |
|---|---|
| Size | 204.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7c58c95c65f6ed27d8d717f3395f412f193a4aa739d02c049f445543854570a
|
|
BLAKE2b-256 checksum How to use checksums |
c3307de0f5fee2f86f0cd7f5786dae7682a4aae109d9c1c5c014fe00ec01f9ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logRelease files / opencti_mcp-0.1.1-py3-none-any.whl
| Download URL | opencti_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fc6a931253bc1b2e02276aa422b2150ec6cda4dae4c94b61986ac07da92a8c6
|
|
BLAKE2b-256 checksum How to use checksums |
41fbafe105702d903816ebe25cea2c5c22f046b2984eec077c471836d0b9fd16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logSecurity for opencti-mcp 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for opencti_mcp-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.