Component Inventory -- cortex

August 1, 2026 ยท View on GitHub

Complete listing of all plugin components.

MCP, REST, and CLI are transport surfaces over the shared service layer. The runtime MCP action schema is derived from src/mcp/actions.rs::ACTION_SPECS through src/mcp/schemas.rs::tool_definitions() and exposed as cortex://schema/mcp-tool; maintained Markdown docs are drift-checked rather than automatically generated.

MCP tools

cortex exposes one MCP tool named cortex. The required action argument selects the operation. The authoritative action registry lives in src/mcp/actions.rs::ACTION_SPECS; the runtime schema enum is derived from that registry by src/mcp/schemas.rs::tool_definitions().

ActionDescriptionDestructive
searchFull-text search across syslog messages with FTS5 syntax, host/source_ip/severity/app/time filtersno
filterStructured filter-only log retrieval for indexed fields and source aliasesno
tailGet N most recent log entries, optionally filtered by host, source_ip, and/or applicationno
errorsError/warning summary grouped by hostname and severity level with countsno
hostsList all hosts with first/last seen timestamps and total log countsno
mapCached homelab inventory plus graph-backed topology answersno
host_stateLatest bounded heartbeat state for one hostno
fleet_stateFleet-wide heartbeat snapshot with pressure flags and summary countsno
correlateCross-host event correlation within a time window around a reference timestamp, or one derived from query via AI-session searchno
correlate_stateCorrelate logs with heartbeat window summaries around a reference timeno
statsDatabase statistics: total logs, hosts, time range, DB size, free disk, write-block statusno
statusLightweight runtime status: DB health, queue/backpressure state, listener/writer counters, OTLP countersno
sessionsAI transcript sessions grouped by project/tool/session/hostno
search_sessionsRanked grouped session searchno
abuseAbuse-term detector with same-session contextno
abuse_incidentsGroups abuse hits into scored incident candidatesno
abuse_investigateExpands incidents into deterministic evidence bundlesno
ai_correlateAI transcript anchors cross-referenced against nearby non-AI logsno
topic_correlateResolve a topic to graph entities and correlate all related logs into a unified timelineno
usage_blocksAI transcript activity grouped into deterministic 5-hour UTC blocksno
project_contextSummary and recent entries for one AI project pathno
list_ai_toolsDistinct AI tools with countsno
list_ai_projectsDistinct AI projects with countsno
appsDistinct application names with log and host countsno
source_ipsDistinct source identifiers with hostname breakdownno
timelineBucketed log counts over timeno
patternsNear-duplicate message template clustersno
contextSurrounding logs around a log id or timestampno
getOne log entry by id, including raw frameno
ingest_rateRecent ingest throughput and write-block stateno
silent_hostsHosts whose last_seen is older than a thresholdno
clock_skewPer-host received_at minus timestamp distributionno
anomaliesRecent vs baseline volume/error comparisonno
compareSide-by-side comparison of two time rangesno
compose_statusRedacted Docker Compose runtime projectionno
compose_doctorStrict redacted Docker Compose health diagnosticsno
unaddressed_errorsRepeating unacknowledged error signaturesno
notifications_recentRecent notification firingsno
similar_incidentsFTS5 historical incident clusters with overlapping AI sessionsno
incident_contextWindow bundle of non-AI log aggregates/errors and active AI sessionsno
graphResolve graph entities, neighborhoods, and evidence-backed explanationsno
skill_eventsList extracted AI skill-invocation eventsno
skill_incidentsGroups negative-signal transcript hits following a skill invocation into scored incident candidatesno
skill_investigateExpands skill-usage incidents into deterministic evidence bundles, skill-firstno
mcp_eventsList extracted AI MCP tool-call eventsno
mcp_incidentsGroups negative-signal transcript hits following an MCP tool call into scored incident candidatesno
mcp_investigateExpands MCP-usage incidents into deterministic evidence bundles, server/tool-firstno
hook_eventsList extracted/collected AI hook events (runtime execution and config inventory)no
hook_incidentsGroups hook failures/timeouts and other negative signals into scored incident candidatesno
hook_investigateExpands hook-usage incidents into deterministic evidence bundles, hook-firstno
ack_errorAcknowledge an error signatureyes
unack_errorRevoke an error acknowledgementyes
file_tailsManage Cortex-owned file-tail ingest sourcesyes
notifications_testSend a test Apprise notificationyes
llm_invocationsRecent LLM invocation audit records (concurrency/rate-limit/circuit-breaker denials included)no
helpReturns markdown documentation for all actionsno

Most MCP actions are read-only. ack_error, unack_error, file_tails, notifications_test, and llm_invocations require cortex:admin. The first four mutate acknowledgement/audit or notification state through service-owned actor and safety policy; llm_invocations is read-only but is admin-scoped because it exposes operational kill-switch/circuit-breaker state, not log content.

Direct CLI commands

The cortex binary also exposes direct local commands backed by the same service methods as the MCP actions.

CommandMatches MCP actionDescription
cortex searchsearchFull-text search with filters
cortex tailtailRecent log entries
cortex analysis errorserrorsError/warning summary
cortex hostshostsKnown host list
cortex hosts sourcessource_ipsSource identifiers with hostname breakdown
cortex hosts silentsilent_hostsHosts older than a staleness threshold
cortex ingest inventory refresh--Native refresh into ~/.cortex/inventory
cortex ingest inventory status--Cache freshness, collector status, warnings, and artifact paths
cortex filterfilterStructured filter-only log retrieval
cortex correlate eventscorrelateCross-host event correlation
cortex state hosthost_stateLatest bounded heartbeat state for one host
cortex state fleetfleet_stateFleet-wide heartbeat snapshot with pressure flags
cortex correlate statecorrelate_stateLogs plus heartbeat summaries around a reference time
cortex entitygraphResolve a graph entity by canonical key or alias
cortex graph statusgraphInspect graph projection status, freshness, counts, and rebuild progress
cortex graph rebuildgraphExplicitly rebuild the derived graph projection from current source tables
cortex graph aroundgraphOne-hop graph neighborhood with typed relationships and evidence
cortex graph explaingraphEvidence-backed deterministic incident explanation over graph chains
cortex graph evidencegraphInspect one evidence id with relationship endpoints and bounded source proof
cortex sessions correlateai_correlateAI transcript anchors cross-referenced against nearby non-AI logs
cortex sessions incidentsabuse_incidentsGrouped abuse incident candidates
cortex sessions investigateabuse_investigateAbuse incident evidence bundles
cortex sessions similarsimilar_incidentsHistorical incident clusters
cortex sessions incidentcontextincident_contextFull context bundle for a time window
cortex statsstatsDatabase and storage metrics
cortex stats ingestrateingest_rateRecent ingest throughput and write-block state

MCP resources

URIDescriptionMIME type
cortex://schema/mcp-toolJSON schema for the cortex MCP tool and action-based parametersapplication/json

Environment variables

VariableRequiredDefaultSensitive
CORTEX_RECEIVER_HOSTno0.0.0.0no
CORTEX_RECEIVER_PORTno1514no
CORTEX_MAX_MESSAGE_SIZEno8192no
CORTEX_BATCH_SIZEno100no
CORTEX_FLUSH_INTERVALno500no
CORTEX_HOSTno127.0.0.1no
CORTEX_PORTno3100no
CORTEX_TOKENno(none)yes
CORTEX_ALLOWED_HOSTSno(none)no
CORTEX_ALLOWED_ORIGINSno(none)no
CORTEX_API_TOKENyes (always-on /api/*)(none)yes
CORTEX_DB_PATHno/data/cortex.dbno
CORTEX_POOL_SIZEno8no
CORTEX_SQLITE_PAGE_CACHE_MBno128no
CORTEX_SQLITE_MMAP_MBno256no
CORTEX_HEAVY_READ_CONCURRENCYno1no
CORTEX_WAL_CHECKPOINT_MBno256no
CORTEX_RETENTION_DAYSno90no
CORTEX_MAX_DB_SIZE_MBno1024no
CORTEX_RECOVERY_DB_SIZE_MBno900no
CORTEX_MIN_FREE_DISK_MBno0 (disabled; breach blocks writes)no
CORTEX_RECOVERY_FREE_DISK_MBno0no
CORTEX_CLEANUP_INTERVAL_SECSno60no
CORTEX_CLEANUP_CHUNK_SIZEno2000no
RUST_LOGnoinfono
CORTEX_INVENTORY_DIRno~/.cortex/inventoryno
CORTEX_INVENTORY_COMPOSE_PATHSno~/.cortex/compose/docker-compose.ymlno
CORTEX_INVENTORY_PROXY_PATHSno(none)no
CORTEX_INVENTORY_ADGUARD_PATHSnocommon AdGuard Home config pathsno
CORTEX_INVENTORY_SSH_CONFIGno~/.ssh/configno
CORTEX_INVENTORY_SSH_HOSTSnoall concrete Host aliases in SSH config except wildcard patterns and github.comno
CORTEX_INVENTORY_PROJECT_ROOTSno~/workspaceno
CORTEX_INVENTORY_REFRESH_INTERVAL_SECSno300 (0 disables server-side periodic refresh)no
CORTEX_INVENTORY_WATCH_ENABLEDnotrueno
CORTEX_INVENTORY_REMOTE_DOCKER_EVENTSnofalseno
CORTEX_UNRAID_URLno(none)no
CORTEX_UNRAID_API_KEYno(none)yes
CORTEX_UNIFI_URLno(none)no
CORTEX_UNIFI_API_KEYno(none)yes
CORTEX_<MEDIA>_URLno(none)no
CORTEX_<MEDIA>_API_KEY / TOKEN / USERNAME / PASSWORDno(none)yes

Homelab inventory refresh

cortex ingest inventory refresh writes the private cache consumed by MCP action=map under ~/.cortex/inventory. The server also refreshes that cache automatically: one refresh runs shortly after startup, then every CORTEX_INVENTORY_REFRESH_INTERVAL_SECS seconds. Set the interval to 0 to disable background refresh.

When background refresh is enabled, Cortex also watches local configured Compose/proxy config paths and refreshes after a short debounce when they change. AdGuard Home paths are collected during each refresh; configure them with CORTEX_INVENTORY_ADGUARD_PATHS when the defaults do not match. Set CORTEX_INVENTORY_WATCH_ENABLED=false to disable local file watching. To use container events as refresh triggers, explicitly set CORTEX_INVENTORY_REMOTE_DOCKER_EVENTS=true; Cortex then opens docker events streams over SSH for selected hosts.

Remote collection is SSH-backed and uses concrete aliases from ~/.ssh/config unless CORTEX_INVENTORY_SSH_HOSTS is set. It collects host facts, listener ports, storage summaries, Compose YAML artifacts, reverse proxy conf artifacts, redacted AdGuard Home configuration, and compact Docker inspect data including container status/health, image, published ports, networks, mounts, compose/route labels, and environment key names only. One bounded config sweep runs per host. A slow or unreachable host is reported without discarding completed host results. Cortex does not store Docker environment values.

SSH targets are validated before invoking OpenSSH, option-like hosts are rejected, and the command builder inserts -- before the host argument. Inventory collectors and remote Docker event streams share strict host-key defaults, a fleet-wide concurrency budget, and retry backoff. Deploy helpers share host validation, the -- delimiter, and the host-key argument policy, but they do not use the inventory retry/concurrency context. The default is StrictHostKeyChecking=yes; bootstrap TOFU is available only when explicitly opted in with CORTEX_INVENTORY_SSH_TRUST_ON_FIRST_USE=true. Set CORTEX_INVENTORY_SSH_KNOWN_HOSTS when automation should use a managed known-hosts file.

Optional provider collectors are activated only when their URL/credential env vars are present. The UniFi collector includes sites, devices, network settings, and normalized DHCP assignments such as gateway, pool, lease time, and DNS servers. Supported media prefixes are SONARR, RADARR, PROWLARR, SABNZBD, QBITTORRENT, PLEX, TAUTULLI, and OVERSEERR.

Safe provider configuration is exposed in typed services[].details and networks[].details objects. Raw artifact bodies remain private and redacted.

The MCP map action defaults to the bounded snapshot. Set mode to ask topology questions backed by the graph projection:

{"action":"map","mode":"host_services","host":"squirts"}
{"action":"map","mode":"domain_routes","domain":"adguard.tootie.tv"}
{"action":"map","mode":"service_dependencies","host":"squirts","service":"swag"}
{"action":"map","mode":"findings","finding_limit":25}

Non-snapshot responses include graph_answer.answer_status, bounded rows, safe evidence samples, map-native next_queries, and graph proof_queries. mode=findings instead fills graph_answer.findings with supported topology findings: potential_public_route, risky_mounts, and collector_health. These findings use relationship-specific graph proof for configured routes and mounts, normalized inventory for mount source/target/read-only detail, and cache/collector state for degraded-confidence context. Evidence is intentionally safe: no raw config bodies, raw cache paths, credential-bearing upstream URLs, raw collector warnings, raw frames, or metadata_json are returned.

Plugin surfaces

SurfacePresentPath
Skillsyesplugins/cortex/skills/
Agentsno--
Commandsno--
Hooksyesplugins/cortex/hooks/
Channelsno--
Output stylesno--
Schedulesno--

Network ports

PortProtocolPurpose
1514UDP + TCPSyslog receiver (RFC 3164/5424)
3100TCPRMCP Streamable HTTP endpoint

HTTP endpoints

EndpointMethodAuth requiredDescription
/mcpPOSTyes (when token set)RMCP stateless Streamable HTTP endpoint
/mcpGET, DELETEyes (when token set)401 first if token auth is enabled and the bearer token is missing/invalid; otherwise 405 in stateless mode
/healthGETnoHealth check -- verifies DB connectivity
/api/searchGETyes when API enabledPlain JSON log search
/api/tailGETyes when API enabledPlain JSON recent logs
/api/errorsGETyes when API enabledPlain JSON error summary
/api/hostsGETyes when API enabledPlain JSON host list
/api/correlateGETyes when API enabledPlain JSON event correlation
/api/statsGETyes when API enabledPlain JSON database stats
/api/filterGETyes when API enabledPlain JSON structured log filtering
/api/timelineGETyes when API enabledPlain JSON bucketed timeline
/api/patternsGETyes when API enabledPlain JSON message pattern clusters
/api/notifications/recentGETyes when API enabledRecent notification firings

Docker

ComponentValue
Imageghcr.io/dinglebear-ai/cortex:latest
Syslog port1514/udp, 1514/tcp
MCP port3100/tcp
Health endpointGET /health (unauthenticated)
Compose filedocker-compose.yml
Entrypointcortex binary
User1000:1000
Data volume/data (SQLite database)

CI/CD workflows

WorkflowTriggerPurpose
ci.ymlpush, PRLint (clippy), check, test
docker-publish.ymltag pushBuild and publish Docker image to GHCR
publish-crates.ymltag pushPublish to crates.io
codex-plugin-scanner.ymlPRValidate Codex plugin manifest

Scripts

ScriptPurpose
scripts/smoke-test.shLive smoke test -- current MCP action set via mcporter
scripts/backup.shWAL-safe SQLite backup (checkpoint + .backup method)
scripts/reset-db.shWAL-safe backup + destructive DB reset for dev recovery

Dependencies

Runtime

CratePurpose
tokioAsync runtime (full features)
axumHTTP framework for MCP server
tower-httpCORS and tracing middleware
rusqliteSQLite driver (bundled, with FTS5)
r2d2 / r2d2_sqliteConnection pooling
syslog_looseRFC 3164/5424 syslog parsing
serde / serde_jsonSerialization
chronoTimestamps
tomlConfig file parsing
tracing / tracing-subscriberStructured logging
anyhowError handling
subtleConstant-time token comparison
rustixFilesystem stats (free disk space)

Development

CratePurpose
tempfileTemporary directories for test databases
serial_testSerialized test execution for env var tests
towerHTTP testing utilities