Cortical
Cortical is an MCP control plane for sanitizing private context, compressing payloads, and orchestrating local/cloud AI workflows.
Ingest and sanitize local files, directories, or raw text into a Privacy Vault using
auto,fail_closed, orfail_openpolicies and redaction profiles.Read sanitized vault items or task-tagged groups at
light/medium/high/maxdepth while blockingmax_securitycontent from cloud egress.Deterministically compress JSON, XML, YAML, or verbose logs losslessly with TOON and report token savings.
Inspect hardware tier, local models, composed OSS tools, and routing diagnostics.
Offload summarization, analysis, or code review to local LLM runners via roles, explicit models, file paths, or vault aliases at zero cloud token cost.
Generate ROI reports comparing local vs cloud token usage, USD savings, and remaining cloud budget.
Save or load cross-harness working context including goals, summaries, modified files, and next steps.
Synthesize continuation prompts via Prompt Studio, with repo/issue/ADR harvesting, browser/TUI modes, attachment privatization, brain reconciliation, and optional skill curation.
Auto-discovers a running local Ollama inference server on port 11434, allowing the harness to use local models as a zero-extra-VRAM inference backend.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Cortical navigate /README.md at high depth and verify citations"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Cortical
Zero-dependency MCP control plane for private, local-first AI agents.
Cortical is a zero-server, Python 3.10+ standard-library (dependencies = []) MCP server and declarative agent control plane. It protects private files before they ever reach a cloud LLM, compresses structured payloads losslessly with TOON, offloads routine reads and reviews to local models at $0 cloud cost, and synchronizes MCP configuration across 8 coding harnesses.
Live Zero-Install Demo:
ccancellieri.github.io/cortical|settings.html(zero CDNs, 3 one-click hardware presets)Zero External Dependencies:
dependencies = []inpyproject.toml. Auditable Python stdlib only, zero supply-chain bloat.Zero Persistent Daemons: Default
stdioMCP transport. Interactive Prompt Studio (cortical next) binds a one-shot127.0.0.1:0loopback listener guarded by a 256-bit single-use token and shuts down immediately on submit.Works With or Without Local LLMs: Tier-1 Privacy Vault (
.md,.txt,.json,.docx,.xlsx,.pptx, selectable.pdfmetadata strip + PII/secret redaction + SHA-256 audit ledger), losslessTOONcompression,doctor, and 8-harnesssyncrun 100% deterministically in Python stdlib.
90-Second Video Demos
Privacy Vault + Lossless TOON (-78% Tokens) in pi CLI - Zero-LLM
fail_closedPII/metadata masking, deterministic TOON compression, and$0local offload.Sync 8 AI Coding Harnesses with 1 Command + Rollback - Idempotent
--dry-runsync, timestamped--rollback, and the static zero-CDN control plane (settings.html).Run 27B Local Models at 65K Context on a 16GB Laptop - Hardware preflight (
cortical doctor), variable-quant 27B at65,536context in9.08 GiBVRAM, and local offload across 7 runners.
Related MCP server: io.github.admiralpunk/provena-memory
Why Cortical
Most MCP servers are thin API wrappers that introduce heavy runtime dependencies, leave sensitive files exposed to cloud prompts, and force every developer to maintain separate configs for Claude Desktop, Cursor, Windsurf, OpenCode, Codex, and local runners.
Cortical solves the four architectural gaps that standalone wrappers leave open:
Deterministic Fail-Closed Privacy Boundary: Files classified as
max_securityorfail_closedcannot leave the machine. Structured PII, secrets, custom terms, and Office/PDF metadata are stripped locally with a verifiable SHA-256 ledger before any cloud call.Lossless Payload Compression (
TOON): Compresses JSON payloads by-78.12%vs pretty JSON (-62.09%vs compact JSON) with deterministic round-trip fidelity and automatic fallback when savings are below10%.Hardware-Aware Local Offload (7 Runners, 10
@role:*Slots): Never hardcodes model tags. Maps semantic roles (@role:router,@role:daily_coder,@role:reviewer,@role:summarizer,@role:deep_reasoner,@role:vision,@role:tech_communicator) acrossOllama,Unsloth Studio,LM Studio,llama.cpp,Apple MLX,vLLM, and anyopenai_compatibleendpoint.Declarative Cross-Harness Sync + Prompt Studio: Keeps MCP definitions, memory rules, and cross-harness handoffs aligned across
Claude Code,Cursor,Windsurf,Antigravity,OpenCode,Codex,pi,dsh, andUnsloth Studiowith--dry-runpreviews and timestamped--rollback.
Architecture
flowchart LR
subgraph Clients["MCP Clients & Harnesses"]
C1["Claude Desktop / Code"]
C2["Cursor / Windsurf"]
C3["OpenCode / Codex / pi / Antigravity"]
end
subgraph ControlPlane["Cortical MCP Control Plane (Python 3.10+ Stdlib, 0 Deps)"]
MCP["MCP Server (stdio / streamable-http)"]
Vault["Privacy Vault & 3+1 Second Brain (auto | fail_closed | fail_open)"]
TOON["Lossless TOON & Log Compressor"]
Studio["Prompt Studio (127.0.0.1:0 Ephemeral Elicitor)"]
ROI["Zero-Token ROI & Handoff Ledger"]
end
subgraph Execution["Execution Backends"]
Local["Local Runners (Ollama, Unsloth, LM Studio, MLX, llama.cpp, vLLM)"]
Cloud["Remote Cloud LLMs (Sanitized & TOON-Compressed Only)"]
end
Clients -->|"JSON-RPC 2.0"| MCP
MCP --> Vault
MCP --> TOON
MCP --> Studio
MCP --> ROI
Vault -->|"max_security stays local"| Local
TOON -->|"Sanitized + Compressed"| Cloud
MCP -->|"Zero-cloud-token offload"| LocalQuickstart (Copy-Paste, Zero Friction)
Option A: Local Python (Zero External Dependencies)
git clone https://github.com/ccancellieri/cortical.git && cd cortical
python3 -m venv .venv && .venv/bin/pip install --no-deps -e .
# Verify hardware tier, Tier-1 Zero-LLM Privacy Vault & benchmarks
PYTHONPATH=src .venv/bin/python -m cortical.cli doctor
PYTHONPATH=src .venv/bin/python -m cortical.cli bench --compareOption B: Docker (Reproducible Containerized MCP)
docker build -t cortical-mcp .
docker run -i --rm cortical-mcpOption C: Connect Your MCP Client
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"cortical": {
"command": "python3",
"args": ["-m", "cortical.mcp_server"],
"env": {
"PYTHONPATH": "/absolute/path/to/cortical/src",
"CORTICAL_VAULT_DB": "/absolute/path/to/cortical/.cortical_data/vault.db"
}
}
}
}Cursor (.cursor/mcp.json) & Windsurf (~/.codeium/windsurf/mcp_config.json)
{
"mcpServers": {
"cortical": {
"command": "docker",
"args": ["run", "-i", "--rm", "cortical-mcp"]
}
}
}Or run PYTHONPATH=src .venv/bin/python -m cortical.cli sync --dry-run to preview automatic configuration across all 8 supported harnesses (see docs/INTEGRATIONS.md).
MCP Capabilities
Cortical exposes a focused surface of 8 Core Tools (all with MCP annotations and outputSchema), Native Resources, and 3 Reusable Prompts.
Tools (8)
Tool | Purpose | Key Inputs | Example Prompt |
| Sanitize a file, directory, or raw text into the Privacy Vault ( |
| "Ingest |
| Read a sanitized vault item or task-tagged group at 3+1 depth ( |
| "Read |
| Deterministically compress JSON (lossless |
| "Compress this API response JSON using |
| Inspect CPU/RAM/GPU tier, active local runners, and composed OSS tools ( | (none) | "Run |
| Delegate file reading, summarization, or code review to a local runner via |
| "Offload reviewing |
| Compute local vs. cloud token usage, USD savings, and remaining cloud budget at zero cloud token cost. |
| "Generate my session token savings report with |
| Save or load structured task context (goal, modified files, next step) when switching between harnesses. |
| "Save a cross-harness handoff so I can resume this refactor in OpenCode." |
| Harvest repo/issue/ADR state, run the 5-Trigger confidence gate or ephemeral browser questionnaire, and synthesize a high-precision continuation prompt. |
| "Run |
Resources & Prompts
Type | Identifier | Description |
Resource |
| Sanitized read-only view of any vault item (automatically blocks |
Resource |
| Factorized 3+1 Local Second Brain index (concepts, reconciled facts, tasks, curated skills). |
Prompt |
| Inject sanitized |
Prompt |
| Execute a task offline on the configured local model runner without spending cloud tokens. |
Prompt |
| Launch Prompt Studio to synthesize or interactively elicit the next continuation prompt. |
2-Tier Capability Matrix & Reproducible Benchmarks
Measured offline via PYTHONPATH=src .venv/bin/python -m cortical.cli bench --compare and docs/METRICS_LEDGER.md:
Capability | Execution Tier | Local LLM Needed? | Verified Result |
Privacy Vault, Metadata Strip & SHA-256 Ledger | Tier 1 (Zero-LLM Stdlib) | No |
|
Lossless | Tier 1 (Zero-LLM Stdlib) | No |
|
Hardware Preflight & 8-Harness | Tier 1 (Zero-LLM Stdlib) | No |
|
Lean 8-Tool MCP Handshake | Tier 1 (Zero-LLM Stdlib) | No |
|
Local Offload ( | Tier 2 (Local Runner) | Yes ( |
|
Daily CLI Commands & Verification
# Workspace init, IDE integration & drift reconciliation
PYTHONPATH=src .venv/bin/python -m cortical.cli init -y
PYTHONPATH=src .venv/bin/python -m cortical.cli integrate --list
PYTHONPATH=src .venv/bin/python -m cortical.cli reconcile --dry-run --json
# Privacy Vault, Bulk Disk Privatizer & AI Colleague Prompt Studio
PYTHONPATH=src .venv/bin/python -m cortical.cli privatize ./client_docs --tier medium
PYTHONPATH=src .venv/bin/python -m cortical.cli colleague "Prepare an anonymized risk summary" --attach ./client_docs
PYTHONPATH=src .venv/bin/python -m cortical.cli next "Add multi-runner health metrics" --target pi
# Static zero-CDN browser control plane, ROI telemetry & test suite (64/64 passing)
PYTHONPATH=src .venv/bin/python -m cortical.cli dashboard --out-dir html --open
PYTHONPATH=src .venv/bin/python -m cortical.cli roi
PYTHONPATH=src .venv/bin/python -m unittest discover -s tests -qCodebase footprint (v0.3.0, verifiable via wc -l): 7 Python subpackages totaling 22,230 LOC (18,139 Core Python/CLI/Second Brain/Prompt Studio/Wiki + 4,091 embedded zero-CDN SPA modules) backed by 64/64 passing unittest tests (3,224 test LOC). See SECURITY.md for the fail-closed security policy and docs/adr/README.md for Architecture Decision Records.
Author & Vision
Cortical is designed and maintained by Carlo Cancellieri, Software Architect and open-source builder focused on local-first AI infrastructure, privacy-preserving developer tooling, and verifiable multi-agent systems.
The vision behind Cortical is pragmatic: developers and professionals should not have to choose between frontier AI productivity and data sovereignty. By keeping the control plane zero-dependency, auditable, and strictly local-first, Cortical makes privacy guardrails, lossless token economics, and multi-runner orchestration a default layer rather than an afterthought.
GitHub: github.com/ccancellieri
Live Control Plane & Docs: ccancellieri.github.io/cortical
License: Apache-2.0
Available Tools
8 toolscortical_compressBRead-onlyIdempotent
Deterministically compress JSON (to lossless TOON with compact fallback), XML, or verbose logs.
Inputs: text (required), format. Returns: compressed, saving_pct, format_used, raw_tokens_est, +1 more
cortical_doctor_statusARead-onlyIdempotent
Inspect machine hardware tier (incl. 4GB VRAM Hybrid & 16GB Unified 27B), installed local models, and composed OSS tools.
Inputs: no named parameters. Returns: models, routing, hardware, composers
cortical_handoffAIdempotent
Save or load shared working context (goal, modified files, decisions, next_step) across Antigravity, pi, OpenCode, Claude Code & Codex.
Inputs: action (required), goal, summary, next_step, +2 more. Returns: path, found, saved, handoff
cortical_ingest_privateBIdempotent
Ingest a local file or text into Privacy Vault with dynamic auto | fail_closed | fail_open classification.
Inputs: path_or_text (required), alias, policy, profile, +1 more. Returns: uri, alias, profile, local_only, +4 more
cortical_local_offloadARead-only
Delegate summarization/analysis/review to configured local Ollama/Unsloth model (0 cloud tokens).
Inputs: prompt (required), role, model, file_paths, +1 more. Returns: response, model_used, elapsed_sec, completed_locally
cortical_next_promptA
Harvest repo/issue/ADR state + loop_memory, run 5-Trigger confidence gate or open one-shot ephemeral loopback browser questionnaire, and synthesize a high-precision continuation prompt.
Inputs: lang, mode, seed, issue, +9 more. Returns: ok, prompt, target, escalated, +3 more
cortical_roi_reportBRead-onlyIdempotent
Compute local vs cloud token usage, USD savings, and remaining cloud budget (0 cloud tokens).
Inputs: conversation_id, include_local_summary. Returns: markdown, local_note, effective_mode, handoff_recommended, +3 more
cortical_vault_readARead-onlyIdempotent
Read a Vault item by alias OR all items matching a task_tag at 3+1 depth (light, medium, high, max; blocks max_security from cloud).
Inputs: tier, alias, task_tag. Returns: uri, text, tier, alias, +7 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a fairly distinct action: vault read, ingest, compress, local offload, ROI reporting, handoff, next-prompt synthesis, and environment diagnosis. The only mild overlaps are cortical_local_offload vs cortical_compress (both token-saving) and cortical_doctor_status vs cortical_roi_report (both diagnostic), but the descriptions make the boundaries reasonably clear.
All names share a consistent `cortical_` prefix and snake_case, which helps grouping. However, the ordering convention is mixed: some are verb_noun (vault_read, ingest_private, local_offload), others are noun_noun or adjective_noun (doctor_status, roi_report, next_prompt, handoff), so the pattern isn't fully predictable.
Eight tools is well within the ideal range for a focused local/private LLM orchestration server. Each tool maps to a distinct stage of the workflow (ingest → compress → offload → report → handoff → next prompt) with no obvious filler.
The vault surface is lopsided: read and ingest exist but there is no delete, update, or alias-listing operation, which is a real gap for a privacy vault. Likewise cortical_compress produces a lossless TOON form with no corresponding decompress/expand tool, and doctor_status only inspects configuration with no tool to change it.
Maintenance
Related MCP Connectors
Company brain for AI agents — temporal knowledge graph search, exploration, and durable memory.
Shared persistent memory for AI agents to read, verify, continue, and connect knowledge.
Shared knowledge for teams and AI agents: search, brief, and record decisions with provenance.
Machine-native research commons for agent evidence, discovery, rooms, and bounded research quests.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to use a neuro-symbolic memory fabric with bi-temporal knowledge graph and holographic VSA, providing tools for adding, searching, temporal queries, auditing, and proving memories with cryptographic provenance and zero-LLM ingest.2Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides AI agents a shared long-term memory layer with evidence-backed, auditable claims, enabling persistent, explainable, and conflict-aware recall across sessions.10MIT

mcp-hyperspace-memoryofficial
AlicenseBqualityCmaintenanceEnables AI agents to store, semantically recall, update, forget, consolidate, and verify persistent memories with session isolation and hyperbolic concept navigation. It also supports knowledge-graph linking and claim verification for anti-hallucination workflows.16MIT- AlicenseNot gradedqualityBmaintenanceEnables AI agents to store, search, and retrieve durable knowledge through a relationship graph, with on-demand context assembly, history, and cascaded stale marking when underlying facts change.GPL 3.0