| Crates.io | cortex-mem-mcp |
| lib.rs | cortex-mem-mcp |
| version | 1.0.0 |
| created_at | 2025-12-31 07:52:12.854025+00 |
| updated_at | 2025-12-31 07:52:12.854025+00 |
| description | MCP server for cortex-mem memory management system |
| homepage | |
| repository | |
| max_upload_size | |
| id | 2014206 |
| size | 110,582 |
An MCP (Model Context Protocol) server that exposes the cortex-mem memory management capabilities through the MCP stdio protocol, aligned with OpenMemory MCP API design.
This MCP server provides a standardized interface for AI agents to store, query, and retrieve memories. The API design follows the OpenMemory MCP specification for better compatibility and consistency across applications.
This server allows AI agents and applications using the MCP stdio protocol to interact with the Cortex Mem memory system with OpenMemory-aligned tools:
# Clone the repository
git clone <repository-url>
cd cortex-mem/cortex-mem-mcp
# Build and install
cargo install --path .
Download the appropriate binary for your platform and add it to your PATH.
The server uses the same configuration system as memo-core. By default, it will look for config.toml in the following locations in order:
~/.config/memo/config.toml)/usr/local/etc/memo/config.toml/etc/memo/config.tomlC:\ProgramData\memo\config.tomlYou can also specify a custom configuration file path:
# Use default search locations
cortex-mem-mcp
# Specify a custom configuration file
cortex-mem-mcp --config /path/to/your/config.toml
# Use a short form
cortex-mem-mcp -c ~/.memo/config.toml
# Configure agent for automatic agent_id and user_id
cortex-mem-mcp --config /path/to/your/config.toml --agent "my_agent"
Create a config.toml file with the following contents:
[llm]
api_key = "your-openai-api-key"
model = "gpt-3.5-turbo"
[embedding]
model = "text-embedding-ada-002"
[qdrant]
url = "http://localhost:6333"
collection_name = "memories"
[memory]
auto_enhance = true
deduplicate = true
similarity_threshold = 0.7
See the main Cortex Mem documentation for all configuration options.
Add to your Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
"cortex-mem": {
"command": "cortex-mem-mcp",
"args": ["--config", "/path/to/your/config.toml", "--agent", "my_agent"]
}
}
}
Note: Claude Desktop uses the MCP server's working directory (usually where Claude Desktop is running) to resolve relative paths. It's recommended to use absolute paths for the configuration file.
Add to your ~/.cursor/mcp.json:
{
"mcpServers": {
"cortex-mem": {
"command": "cortex-mem-mcp",
"args": ["--config", "/path/to/your/config.toml", "--agent", "my_agent"]
}
}
}
Note: Similar to Claude Desktop, it's recommended to use absolute paths for the configuration file when using Cursor.
To run directly from source:
cd /path/to/cortex-mem/cortex-mem-mcp
cargo run
# Or with custom config
cargo run -- --config /path/to/config.toml
Unified interface for searching memories that replaces both search_memory and recall_context.
Parameters:
query (required, string): Query string for semantic searchk (optional, integer): Maximum number of results to return (default: 10)memory_type (optional, string): Type of memory to filter by (conversational, procedural, factual, semantic, episodic, personal)min_salience (optional, number): Minimum salience/importance score threshold (0-1)topics (optional, array): Topics to filter memories byuser_id (optional, string): User ID to filter memories (defaults to configured agent's user)agent_id (optional, string): Agent ID to filter memories (defaults to configured agent)Special Features:
Store a new memory in the system. API remains the same.
Parameters:
content (required, string): The content of the memory to storeuser_id (optional, string): User ID associated with the memory (required unless --agent was specified on startup)agent_id (optional, string): Agent ID associated with the memory (defaults to configured agent)memory_type (optional, string): Type of memory (conversational, procedural, factual, semantic, episodic, personal)topics (optional, array): Topics to associate with the memoryGet a summarized view of recent memories with filtering options. This is a new tool aligned with OpenMemory's list functionality.
Parameters:
limit (optional, integer): Maximum number of memories to return (default: 20)memory_type (optional, string): Type of memory to filter by (conversational, procedural, factual, semantic, episodic, personal)user_id (optional, string): User ID to filter memories (defaults to configured agent's user)agent_id (optional, string): Agent ID to filter memories (defaults to configured agent)Returns simplified memory objects with preview text rather than full content.
Retrieve a specific memory by its ID. API remains the same but with improved implementation.
Parameters:
memory_id (required, string): ID of the memory to retrieve
## Agent Configuration
The `--agent` parameter allows you to configure a default agent identifier that will be automatically used for all memory operations. When configured:
- **agent_id**: Will be set to the value provided via `--agent`
- **user_id**: Will be automatically generated as `user_of_<agent_id>`
This simplifies memory operations by eliminating the need to specify these parameters in each tool call. For more details, see [AGENT_CONFIG.md](AGENT_CONFIG.md).
cortex-mem-mcp/
├── src/
│ ├── lib.rs # Main implementation
│ └── main.rs # Server entry point
├── Cargo.toml # Dependencies and configuration
└── README.md # This file
# Build for development
cargo build
# Build for release
cargo build --release
# Run tests
cargo test
config.toml is present and validIf you were using the previous API with search_memory and recall_context, here's how to migrate:
// Old search_memory call
{
"name": "search_memory",
"arguments": {
"query": "用户的爱好",
"limit": 10,
"user_id": "user123"
}
}
// New query_memory call
{
"name": "query_memory",
"arguments": {
"query": "用户的爱好",
"k": 10,
"user_id": "user123"
}
}
// Old recall_context call
{
"name": "recall_context",
"arguments": {
"query": "最近的对话",
"limit": 5,
"user_id": "user123"
}
}
// New query_memory call
{
"name": "query_memory",
"arguments": {
"query": "最近的对话",
"k": 5,
"user_id": "user123"
}
}
search_memory → query_memory, recall_context → query_memory (unified)limit → k (for consistency with OpenMemory)min_salience parameter for importance filteringlist_memories for browsing memory overviewQuery memories with salience filtering:
{
"name": "query_memory",
"arguments": {
"query": "用户的爱好和偏好",
"k": 5,
"min_salience": 0.7,
"user_id": "user123"
}
}
List memories by type:
{
"name": "list_memories",
"arguments": {
"memory_type": "episodic",
"limit": 20,
"user_id": "user123"
}
}
This project is licensed under the MIT License.