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.
search_memory
Search memories by semantic meaning.
delete_memory
Delete a memory that is outdated, incorrect, or explicitly asked to be forgotten.
Environment Variables
| Variable | Required | Description |
|---|---|---|
| CORTEX_API_KEY | Yes | Your Cortex API key (starts with ctx_) |
| CORTEX_API_URL | No | Custom API endpoint (default: https://cortex-mem.com/api) |