MCP Server

The MCP (Model Context Protocol) server is the recommended way to integrate Cortex memory into any compatible AI agent.

Installation

No installation needed — the server runs via npx:

npx cortex-memory-mcp

Configuration

There are two ways to connect: OAuth (remote HTTP, no key needed) or API key (stdio transport).

Option A: OAuth (recommended)

Point your MCP client at the remote URL. On first connect, you'll sign in with Google or GitHub in your browser. Tokens are cached for 30 days — no re-login between sessions.

{
  "mcpServers": {
    "cortex": {
      "url": "https://cortex-mem.com/api/mcp"
    }
  }
}

Works with any MCP client that supports remote HTTP servers (Claude Code, Cursor, Kiro, Claude Desktop, Windsurf, etc).

Option B: API Key (stdio transport)

Run the MCP server locally with an API key. No browser login needed — useful for headless or programmatic setups.

{
  "mcpServers": {
    "cortex-memory": {
      "command": "npx",
      "args": ["cortex-memory-mcp"],
      "env": {
        "CORTEX_API_KEY": "ctx_your_key_here"
      }
    }
  }
}

Available Tools

The MCP server exposes three tools to the agent:

save_memory

Save important information to persistent memory.

content (required) — The information to remember
tags (optional) — Categorization tags array
importance (optional) — 0.0-1.0, affects decay rate
agent_id (optional) — Scope to specific agent
session_id (optional) — Session identifier

search_memory

Search memories by semantic meaning.

query (required) — Natural language search query
limit (optional) — Max results, default 10
tags (optional) — Filter by comma-separated tags
agent_id (optional) — Filter by agent

delete_memory

Delete a memory that is outdated, incorrect, or explicitly asked to be forgotten.

memory_id (required) — ID of the memory to delete

Environment Variables

VariableRequiredDescription
CORTEX_API_KEYYesYour Cortex API key (starts with ctx_)
CORTEX_API_URLNoCustom API endpoint (default: https://cortex-mem.com/api)