
cortex-mcp
io.github.lidless-labs/cortex-mcp
Cortex MCP server for running observable analyzers and confirm-gated responders from AI clients.
Documentation
cortex-mcp
What it does
cortex-mcp connects a Model Context Protocol (MCP) client to Cortex. It can submit observables to analyzers, collect job reports and artifacts, and run responders on TheHive entities. It also exposes Cortex administration for analyzers, responders, organizations, and users.
Install
The published package is thehive-cortex-mcp@2.0.0. It requires Node.js 20 or later. The source CI matrix covers Node.js 20, 22, 24, and 26. Package manifest · CI workflow
npm install --global thehive-cortex-mcp@2.0.0
Set the variables below and configure your MCP client to launch cortex-mcp over stdio. The MCP handshake reports the name cortex-mcp and version 2.0.0. To run the same version without a global install, configure the client to launch this command. Stdio entry point · MCP server
npm exec --yes --package=thehive-cortex-mcp@2.0.0 -- cortex-mcp
cortexctl and cortexctrl run the same CLI. It can check Cortex status, list analyzers, submit a single observable, or look up a job. Run cortexctl help for the command list or cortexctl mcp to start the stdio server. CLI source
Configure
Set CORTEX_URL and CORTEX_API_KEY in the server process environment. Use the Cortex base URL without embedded credentials, a query string, or a fragment. Give the API key the Cortex permissions needed for the operations you use. Configuration · API client
export CORTEX_URL='https://cortex.example'
export CORTEX_API_KEY='replace-with-api-key'
| Variable | Default | Use |
|---|---|---|
CORTEX_SUPERADMIN_KEY | Unset | Enables the organization and user tools with a Cortex superadmin key. The client also uses this key for worker definition requests when configured. |
CORTEX_VERIFY_SSL | true | Verifies Cortex TLS certificates. For a private CA, set NODE_EXTRA_CA_CERTS to the CA bundle before Node starts. Setting CORTEX_VERIFY_SSL=false disables verification for Cortex requests. |
CORTEX_TIMEOUT | 30 | Cortex API request timeout in seconds. Accepts integers from 1 to 300. Report waits can use a longer timeout. |
CORTEX_MODE | read-only | Set to write to submit analysis or change Cortex state. |
CORTEX_ALLOW_DESTRUCTIVE | Off | Set to 1 to allow responder execution and deletions in write mode. The MCP call also requires confirmation. |
CORTEX_FILE_BASE_DIR | Unset | Base directory for local files submitted through filePath. |
CORTEX_MAX_FANOUT | 10 | Maximum analyzer submissions per bulk call. Accepts a positive safe integer. |
CORTEX_ALLOW_PRIVATE_TARGETS | false | Set to true to permit private, unresolved, or special-purpose observable targets. |
CORTEX_ALLOW_INSECURE_REMOTE_HTTP | false | Set to true to allow a remote Cortex URL over HTTP. HTTPS is required otherwise. Literal loopback HTTP is allowed. |
Tools
The released stdio server lists 31 tools. Use cortex_list_analyzers to discover enabled analyzers, cortex_get_job_report to read a report, and cortex_get_job_artifacts to retrieve extracted artifacts. Tool registration
Tool inventory
| Area | Tools |
|---|---|
| Status | cortex_get_status |
| Analyzers | cortex_list_analyzers, cortex_get_analyzer, cortex_run_analyzer, cortex_run_analyzer_by_name, cortex_run_analyzer_file |
| Analyzer configuration | cortex_list_analyzer_definitions, cortex_enable_analyzer, cortex_update_analyzer, cortex_disable_analyzer |
| Jobs | cortex_get_job, cortex_get_job_report, cortex_wait_and_get_report, cortex_list_jobs, cortex_get_job_artifacts, cortex_delete_job, cortex_cleanup_jobs |
| Responders | cortex_list_responders, cortex_run_responder, cortex_list_responder_definitions, cortex_enable_responder, cortex_disable_responder |
| Bulk analysis | cortex_analyze_observable |
| Organizations | cortex_list_organizations, cortex_get_organization, cortex_create_organization, cortex_update_organization |
| Users | cortex_list_users, cortex_get_user, cortex_create_user, cortex_renew_user_key |
Bulk analysis and report waits
cortex_analyze_observable uses the supplied data type or infers it from the observable. It filters the analyzers returned by Cortex to those that support that type. Pass an analyzers allowlist of case-insensitive name substrings or set fanOut=true to opt in to submissions across applicable analyzers. The allowlist takes precedence when supplied with entries. maxAnalyzers can lower the per-call cap below CORTEX_MAX_FANOUT. Bulk handler · Analyzer listing
flowchart TD
Type[Use or detect observable type] --> Select[Filter returned analyzers and apply the cap]
Select --> Submit[Submit to selected analyzers concurrently]
Submit -->|Successful job IDs| Wait[Wait for reports concurrently]
Wait --> Summarize[Summarize report taxonomies and job outcomes]
Use cortex_get_job to check status or cortex_wait_and_get_report to let Cortex hold the request until the job finishes or the wait expires. The wait tool and bulk analysis default to 300 seconds per job and accept 1 to 3,600 seconds. The API client allows the larger of CORTEX_TIMEOUT and the requested wait plus 10 seconds. Job tools · API client
Safety
- Read-only mode allows status checks, listings, report reads, and job searches. Analysis submissions, worker configuration changes, and organization and user mutations require
CORTEX_MODE=write. The CLI uses the same write gate for analysis submissions. - Running
cortex_run_responder, deleting jobs, or removing analyzers or responders requires write mode,CORTEX_ALLOW_DESTRUCTIVE=1, andconfirm=true.cortex_cleanup_jobspreviews by default. Deleting matches requiresdryRun=falseand the same gates. - Creating a user and locking an organization require
confirm=truein addition to write mode.cortex_renew_user_keyalso requires confirmation and an operator-configured credential store. The shipped stdio entry point has no store, so rotation stops before contacting Cortex. cortex_run_analyzer_fileacceptsfileBase64or a path to a regular file withinCORTEX_FILE_BASE_DIR. Setting the base directory enables path-based reads. Cortex can pass submitted data to third-party analyzer services.- Cortex responses are capped at 4 MiB. Formatted tool and resource data fits within 64 KiB and marks truncated output. JSON request bodies have a 1 MiB limit, file uploads a 10 MiB limit, and incoming stdio message lines a 16 MiB limit.
API gates · Tool handlers · Result formatting and limits · Stdio limits
Why not cortex4py or clicking analyzers in the Cortex UI?
| Approach | Multi-analyzer enrichment | Responder safety | Local CLI included |
|---|---|---|---|
| cortex-mcp | Submits an observable across matching analyzers and aggregates one verdict | Responders confirm-gated by default | Yes (cortexctrl) |
cortex4py | Python SDK requiring custom polling loops | Caller implements safety checks | No |
| Cortex Web UI | Click each analyzer job manually | Manual review per click | No |
Use cortex4py inside custom Python automation pipelines. Use cortex-mcp when you want an AI client or terminal operator (cortexctrl) to detonate an IP, domain, URL, or hash across your configured Cortex analyzers and return one structured verdict while keeping responders gated.
FAQ
Can an AI agent trigger active Cortex responders automatically? No. Responder execution is gated behind explicit opt-in and confirmation controls so read-only enrichment stays safe.
Does cortex-mcp require TheHive to run?
No. It talks directly to your Cortex API (CORTEX_URL and CORTEX_API_KEY) and also pairs cleanly with thehive-mcp.
Does cortex-mcp work with Claude Code, Claude Desktop, Cursor, and Codex?
Yes. Configure npx -y thehive-cortex-mcp over stdio.
Part of Lidless Labs
cortex-mcp is maintained by Lidless Labs (GitHub). Related SOC and IR tools:
- thehive-mcp - TheHive 5 case management, alerts, and observables over MCP
- misp-mcp - MISP threat intelligence events and IOC correlation over MCP
- wazuh-mcp - read-only Wazuh SIEM/XDR alerts, agents, and CVE queries over MCP
- soc-stack - one-command Proxmox SOC lab with Wazuh, TheHive, Cortex, MISP, Zeek, and Suricata
- mitre-mcp - local MITRE ATT&CK mapping and detection-gap analysis
Development
Run these commands from a source checkout. The verifier runs type checking, offline tests, and the build. Verification script
npm ci
./scripts/verify
thehive-cortex-mcpnpm install thehive-cortex-mcpRelated Servers
io.github.lidless-labs/adguardctrl
AdGuard Home CLI and MCP server for DNS filtering, rewrites, and clients with confirm-gated writes.
io.github.lidless-labs/jellyctrl
Jellyfin CLI and MCP server for libraries, playback sessions, scans, and users with gated writes.
io.github.lidless-labs/librenmsctrl
LibreNMS CLI and MCP server for devices, ports, sensors, and alerts over stdio with gated writes.