Cortex
A dynamic, governed memory layer for Markdown notes that serves knowledge to AI clients and humans through a secure MCP server, with scoped access, git-audited changes, and optional LLM-powered semantic search.
README
Cortex
Every mind needs a memory that is dynamic, not stationary.
Cortex is a dynamic, governed memory layer for AI agents, assistants, and chatbots, backed by a real Obsidian vault. Humans keep using ordinary Obsidian-compatible Markdown files; AI clients access that same memory only through a secure Model Context Protocol (MCP) server:
- Obsidian-native — the source of truth is a normal Obsidian vault: Markdown notes, YAML frontmatter, folders, links, and your editor of choice.
- Scoped — each caller (principal) sees only the slice you grant; a path out of scope is invisible, not just unreadable.
- Audited — every change is a git commit tagged with actor and reason. Git is the single audit trail and rollback mechanism.
- Deterministic by default — search, reads, and context packs spend zero
model tokens. Only the one
semantic_searchtool calls an LLM. - Self-improving (later) — an optional, bounded "janitor" AI tidies and watches the vault on a heartbeat, never able to edit its own limits.
Anyone can spin one up — locally, in Docker, or on a homelab — and keep their memory theirs: a fully working Obsidian vault for humans, a governed memory API for agents.
See ARCHITECTURE.md for the full design.
Quick start
Docker (recommended)
git clone https://github.com/pixlflip/cortex.git && cd cortex
cp cortex.example.yaml cortex.yaml # edit to taste
# put your Obsidian vault in ./vault (or point vault.path at one)
docker compose run --rm cortex check # validate setup
docker compose run --rm cortex init # create the git audit baseline
Run cortex sync any time (or on a schedule — see
docs/bare-metal.md) to snapshot pending human edits
into the git audit trail and refresh the search index, so the status tool's
freshness numbers stay current.
Bare metal (Debian / Proxmox / laptop)
git clone https://github.com/pixlflip/cortex.git && cd cortex
python3 -m venv .venv && . .venv/bin/activate
pip install .
cp cortex.example.yaml cortex.yaml # edit to taste
cortex check
cortex init
cortex serve # MCP server over stdio
Full host/service setup (service user, systemd) is in
docs/bare-metal.md.
Connect an MCP client
For a stdio client (e.g. Claude Desktop), register Cortex as a server that runs
cortex serve with CORTEX_CONFIG pointing at your cortex.yaml. It exposes:
| Tool | What it does |
|---|---|
discover_scopes |
What can I (this principal) see? |
status |
Freshness signal: git HEAD/commit time, last index refresh, visible note count |
list_notes |
List visible note paths |
search |
Substring/regex search over visible notes |
read_note |
Read a full note (scope-checked) |
read_frontmatter |
Read a note's YAML frontmatter |
read_section |
Read one section by heading |
context_pack |
Compact, budgeted bundle for a query |
semantic_search |
Fuzzy "comb & synthesize" — the only tool that uses an LLM |
Configuration
cortex.yaml is public-safe: structure only, no secrets. Tokens and API
keys are referenced by env-var name and read at startup. The shipped example
runs locally with no API key and the LLM disabled (deterministic tools only).
Key knobs (see cortex.example.yaml):
vault.path— your Obsidian vault folder.principals— static identities, theirscopes(path globs), andtoken_env.admin— optional web UI state path.cortex initgenerates the admin password; the UI creates roles and per-client tokens for scoped AI clients.sync.adapter—none(default, local-only) ·git·nextcloud·s3.llm.provider—none(default) ·openrouter·openai·anthropic·ollama. OpenRouter (one key, many models; defaulting to the latest Claude Sonnet) is the recommended way to enablesemantic_search.janitor— off by default; report-only before any write mode.
Status
This repo is built in dependency order (see the build sequence in
ARCHITECTURE.md). Working today:
- ✅ Config system (public-safe, env-injected secrets)
- ✅ Obsidian vault store (list / read / frontmatter / section / search) with path-traversal safety
- ✅ Git audit layer (commit-on-mutation with actor + reason)
- ✅ Scoping + auth (token → principal → scopes; directory-bounded globs)
- ✅ MCP server v1, read-only over stdio — all tools above
- ✅ LLM provider layer (OpenRouter default → latest Claude Sonnet; also OpenAI / Anthropic / Ollama / none)
- ✅ Live
semantic_search— scoped retrieve-then-synthesize (the model only sees notes the principal may read) - ✅ Remote Streamable HTTP transport with bearer-token → principal auth, per-request scoping, and Host/Origin protection (TLS via reverse proxy).
- ✅ Admin web UI for HTTP deployments —
cortex initgenerates an admin password, then the UI can create roles and per-client tokens for scoped AI clients. - ✅ OAuth 2.1 authorization server (dynamic client registration + PKCE +
consent) so the one-click Claude.ai / ChatGPT / Grok connector UIs can
authorize. See
docs/http-exposure.md. - ✅ Docker image + Compose, and a bare-metal/systemd path
Next on the roadmap: sync adapters (opt-in) → the bounded janitor.
Development
pip install -e ".[dev]"
pytest
License
Apache-2.0 — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。