MCP Server
Give Claude, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible AI tool persistent long-term memory via CortexDB.
The CortexDB MCP server is a small bridge process that exposes CortexDB to any Model Context Protocol–compatible client — Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot.
Requires Python 3.10+. cortexdb-mcp doesn't install on Python 3.9 — pip refuses with
"Requires-Python >=3.10". macOS users on Apple's bundled Python 3.9 need a newer interpreter first:
brew install [email protected] (then python3.11 -m pip install …), or use pipx / uv which manage
their own Python.
Installation
# pip (any Python 3.10+ venv)
pip install 'cortexdb-mcp>=0.6.0'
# pipx — recommended on macOS/Linux; auto-isolates the install
pipx install --python python3.11 'cortexdb-mcp>=0.6.0'
# uv — fastest; pulls its own Python if needed
uvx --python 3.11 cortexdb-mcp --helpThe PyPI package is cortexdb-mcp, not cortexdbai-mcp (which does not exist on PyPI). Pin
>=0.6.0 (current release: 0.7.4). 0.2.x releases targeted retired v0 endpoints (/v1/remember,
/v1/recall_memories) which today's API no longer routes — they 404 on every tool call (verified). See
Versioning and SDK compatibility.
Verify it's on your PATH:
cortexdb-mcp --helpWindows: use the full .exe path
On Windows, use the full path to cortexdb-mcp.exe (e.g.
%LOCALAPPDATA%\Programs\Python\Python313\Scripts\cortexdb-mcp.exe) in the MCP config — Windows MCP
clients don't resolve bare command names through PATH reliably.
Setup
Every MCP client uses a JSON config file. The structure is the same everywhere — only the file path differs. There are two ways to set it up.
Option A — Zero-config (anonymous, free tier)
Just point your client at the binary with no env block. On first launch the server posts to
POST /v1/auth/signup, mints an anonymous PASETO bearer + actor + scope, and persists them locally
(see Local state). Every subsequent call reuses that identity.
{
"mcpServers": {
"cortexdb": {
"command": "cortexdb-mcp"
}
}
}This is the recommended path for trying CortexDB. The token has a 7-day TTL; the server refreshes by re-signing-up before expiry.
Option B — Bring your own token (paid tier or your own IdP)
Set three env vars so the server skips signup and uses the credentials you supply:
CORTEXDB_API_KEY— The bearer credential: a PASETO v4 token minted viaPOST /v1/auth/tokens(or by your IdP), or — on a self-hosted server — the server'sCORTEX_API_KEYvalue itself.CORTEXDB_ACTOR— The actor id; must match the token'ssubclaim. Sent asX-Cortex-Actoron every call.CORTEXDB_SCOPE— (optional) The default scope path tools use when one isn't passed explicitly. Defaults to the actor.
Override the endpoint with CORTEXDB_URL if you self-host — http://localhost:3141 for a local
server (default: https://api-v1.cortexdb.ai).
Local state
The server stores its credentials (and only its credentials) under:
- macOS / Linux:
~/.config/cortexdb-mcp/state.json - Windows:
%APPDATA%\cortexdb-mcp\state.json
The file is mode 0600 on POSIX. Contents: {token, user_id, scope, expires_at} — exactly what
POST /v1/auth/signup returned, ~1 KB. No memories are stored locally. Delete the state file to force
a re-signup on next launch.
This path differs from the CLI's state file
The MCP server reads <APPDATA|XDG>/cortexdb-mcp/state.json, while the CLI and connectors use
~/.cortexdb/state.json. The format matches, but reusing one anonymous identity across both tools
means copying the file to the other tool's path — see CLI configuration.
Per-client configuration
The JSON blocks below show Option B (bring-your-own-token). For Option A, drop the env block — just
"command": "cortexdb-mcp" and the server handles signup itself on first launch.
Claude Desktop
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"cortexdb": {
"command": "cortexdb-mcp",
"env": {
"CORTEXDB_API_KEY": "v4.public.eyJpc3MiOi...",
"CORTEXDB_ACTOR": "user:u_019e2f...",
"CORTEXDB_SCOPE": "org:u_019e2f.../user:u_019e2f..."
}
}
}
}Claude Code (CLI)
claude mcp add cortexdb cortexdb-mcp \
-e CORTEXDB_URL=https://api-v1.cortexdb.ai \
-e CORTEXDB_API_KEY=v4.public... \
-e CORTEXDB_ACTOR=user:u_019e... \
-e CORTEXDB_SCOPE=org:u_019e.../user:u_019e...Or edit ~/.claude/mcp.json directly with the same env block.
Cursor
Edit ~/.cursor/mcp.json:
{
"mcpServers": {
"cortexdb": {
"command": "cortexdb-mcp",
"env": {
"CORTEXDB_URL": "https://api-v1.cortexdb.ai",
"CORTEXDB_API_KEY": "v4.public...",
"CORTEXDB_ACTOR": "user:u_019e...",
"CORTEXDB_SCOPE": "org:u_019e.../user:u_019e..."
}
}
}
}Windsurf
Edit ~/.codeium/windsurf/mcp_config.json (same mcpServers block as Cursor).
VS Code (GitHub Copilot)
Add to .vscode/mcp.json (project) or ~/.vscode/mcp.json (global). Note the key is servers, not
mcpServers:
{
"servers": {
"cortexdb": {
"command": "cortexdb-mcp",
"env": {
"CORTEXDB_URL": "https://api-v1.cortexdb.ai",
"CORTEXDB_API_KEY": "v4.public...",
"CORTEXDB_ACTOR": "user:u_019e...",
"CORTEXDB_SCOPE": "org:u_019e.../user:u_019e..."
}
}
}
}Tools exposed
0.7.4 ships 22 tools, mapped to v1 endpoints as follows:
| MCP tool | v1 endpoint | Notes |
|---|---|---|
memory_store | POST /v1/experience | Wraps free-form text in the experience envelope. |
memory_status | GET /v1/experience/status | Did a store land? Check by event_id or idempotency_key after a timeout. |
memory_search | POST /v1/recall | Default view; diagnostics="none" so free-tier tokens succeed. |
get_context | POST /v1/recall | Holistic view tuned for "what should I know before I respond." |
advanced_search | POST /v1/recall | Exposes view / temporal / budgets knobs verbatim. |
memory_forget | POST /v1/forget | General forget — selector passed through. |
memory_delete | POST /v1/forget | Selector preset for memory_ids=[…]. |
memory_bulk_delete | POST /v1/forget + POST /v1/erasures/preview | Subject-targeted delete with dry-run preview. |
forget_preview | POST /v1/forget/preview | Non-destructive dry run of a forget: per-layer estimated deletion counts + a preview_id; memory_forget accepts from_preview_id for the two-phase flow. |
memory_list | GET /v1/events | Scope-aware list of raw events. |
memory_get | GET /v1/events/{id} | Single event by id. |
entity_list | GET /v1/facts | Distinct subjects across facts. |
entity_get | GET /v1/facts | Facts filtered to one subject. |
entity_edges | GET /v1/facts | Predicate-grouped view of facts about one entity. |
entity_link | POST /v1/experience | Records a "X relates to Y" sentence for the LLM extractor. |
belief_declare | POST /v1/beliefs | Declares a belief directly, with optional evidence refs (evt_… / fact_…). |
list_conflicts | GET /v1/conflicts | Detected contradictions for a scope (open or all). |
resolve_conflict | POST /v1/conflicts/{id}/resolve | Resolve by pick / split / new_information / dismiss. |
claim_history | GET /v1/claims/history | Full bi-temporal change-log of one subject+predicate claim. |
health_check | GET /v1/auth/whoami | Auth + reachability check in one call. |
get_usage | GET /v1/auth/whoami | Reads X-RateLimit-* + X-Cortex-Token-Expires-* response headers. |
get_insights | POST /v1/recall | Recall + summarise across topics for a scope. |
Entity/Facts tools need enrichment on self-host
entity_list / entity_get / entity_edges / list_conflicts / claim_history read the Facts
layer, which is empty on a content-only self-hosted instance — those layers need enrichment
configured. memory_store / memory_search / memory_list work regardless. See
Self-hosting defaults.
v0.2.x exposed a different 13-tool set against legacy endpoints (/v1/remember, /v1/admin/health)
which today's API no longer routes — those clients 404 on every call. Pin cortexdb-mcp>=0.6.0.
Future versions may add tools for /v1/answer, /v1/understanding/synthesize and other v1
endpoints — track the server.py decorator list for the source of truth.
Configuration Reference
| Environment variable | Default | Notes |
|---|---|---|
CORTEXDB_URL | https://api-v1.cortexdb.ai | v1 endpoint. |
CORTEXDB_API_KEY | (none) | PASETO v4 bearer — see Auth for how to obtain. |
CORTEXDB_ACTOR | (none) | Required. Must match the token's sub claim. |
CORTEXDB_SCOPE | (actor) | Default scope for tools that don't take an explicit one. |
CORTEXDB_VIEW | holistic | Default recall reach: holistic, descend (scope + all sub-scopes), or granular. |
CORTEXDB_TENANT_ID | (none) | Legacy tenant id (v0 callers only). |
CORTEXDB_TIMEOUT | 30.0 | HTTP request timeout (seconds). |
Architecture
Your Machine CortexDB
┌──────────┐ stdio ┌───────────┐ HTTPS ┌──────────┐
│ Cursor / │ ◄─────────► │ cortexdb- │ ◄─────────► │ v1 API │
│ Claude / │ MCP JSON │ mcp │ REST │ server │
│ VS Code │ │ (bridge) │ │ │
└──────────┘ └───────────┘ └──────────┘The bridge process holds the bearer token in memory, injects Authorization and X-Cortex-Actor
headers on every call, and translates MCP tool invocations into v1 HTTP requests. Nothing is stored
locally except the credentials.
Next steps
- Python SDK — programmatic access,
V1Client+AsyncV1Client. - TypeScript SDK — Node.js and browser apps,
V1Client.signup()one-liner. - Auth — how tokens, actors, and capabilities fit together.
- API Reference — endpoint-by-endpoint reference.