cortex-mem-mcp
by @sopaco
Persistent memory enhancement for AI agents. Store conversations, search memories with semantic retrieval, and recall context across sessions. Use this skill...
Step 1: Create Configuration File
Create a config.toml file (e.g., ~/.config/cortex-mem/config.toml):
[cortex]
Data directory for storing memories
data_dir = "~/.cortex-data"[llm]
LLM API configuration
api_base_url = "https://api.openai.com/v1"
api_key = "your-api-key"
model_efficient = "gpt-4o-mini"
temperature = 0.1
max_tokens = 65536[embedding]
Embedding configuration
api_base_url = "https://api.openai.com/v1"
api_key = "your-embedding-api-key"
model_name = "text-embedding-3-small"
batch_size = 10
timeout_secs = 30[qdrant]
Vector database configuration
url = "http://localhost:6333"
collection_name = "cortex_memories"
embedding_dim = 1536
timeout_secs = 30
Step 2: Start Qdrant (Vector Database)
# Using Docker
docker run -d -p 6333:6333 qdrant/qdrantVerify Qdrant is running
curl http://localhost:6333
Step 3: Configure MCP Client
Configure your MCP client (e.g., Claude Desktop, Cursor, etc.) to use cortex-mem-mcp.
#### Claude Desktop
Edit the configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonAdd the following configuration:
{
"mcpServers": {
"cortex-memory": {
"command": "cortex-mem-mcp",
"args": [
"--config", "/path/to/config.toml",
"--tenant", "default"
],
"env": {
"RUST_LOG": "info"
}
}
}
}
If you built from source, use the full path to the binary:
{
"mcpServers": {
"cortex-memory": {
"command": "/path/to/cortex-mem/target/release/cortex-mem-mcp",
"args": [
"--config", "/path/to/config.toml",
"--tenant", "default"
]
}
}
}
#### Cursor IDE
Add to your Cursor MCP settings:
{
"mcpServers": {
"cortex-memory": {
"command": "cortex-mem-mcp",
"args": ["--config", "/path/to/config.toml"]
}
}
}
Step 4: Restart Your MCP Client
After configuration, restart Claude Desktop or your MCP client to load the new server.
Step 5: Verify Installation
Test the MCP server manually:
# Run with debug logging
RUST_LOG=debug cortex-mem-mcp --config /path/to/config.toml --tenant default
1. Use meaningful thread IDs - Use descriptive names like project-alpha or user-123-support instead of generic IDs
2. Commit periodically - Call commit after significant conversation milestones to ensure memory extraction
3. Start with search - Before storing new information, search to avoid duplication
4. Use tiered access - Start with abstract or search to find relevant memories, then use overview or content for details
5. Scope your searches - Use the scope parameter to limit searches to relevant sessions
clawhub install cortex-mem-mcp