The A-MEM MCP Server provides tools for the Agentic Memory System.
Stores a new piece of information in the memory system.
Parameters:
content(string, required): The text of the note/memorysource(string, optional): Source of the information (default: "user_input")
Example:
{
"content": "Python async/await enables non-blocking I/O operations",
"source": "user_input"
}Searches for relevant memories based on semantic similarity.
Parameters:
query(string, required): The search querymax_results(integer, optional): Maximum number of results (default: 5, max: 20)
Example:
{
"query": "Python async programming",
"max_results": 5
}Returns statistics about the memory system.
Parameters: None
Example:
{}Deletes a note from the memory system. Removes the note from Graph and Vector Store as well as all associated connections.
Parameters:
note_id(string, required): The UUID of the note to be deleted
Example:
{
"note_id": "732c8c3b-7c71-42a6-9534-a611b4ffe7bf"
}Stores the content of a file (e.g., .md) as a note in the memory system. Supports automatic chunking for large files (>16KB).
Parameters:
file_path(string, optional): Path to the file to be stored (relative or absolute)file_content(string, optional): Alternatively: Direct file content as string (when file_path is not provided)chunk_size(integer, optional): Maximum size per chunk in bytes (default: 15000, max: 16384)
Note: Either file_path OR file_content must be provided.
Example:
{
"file_path": "documentation.md",
"chunk_size": 15000
}Or with direct content:
{
"file_content": "# Documentation\n\nThis is the content...",
"chunk_size": 15000
}Resets the complete memory system (Graph + Vector Store). Deletes all notes, edges, and embeddings.
Parameters: None
Example:
{}pip install -r requirements.txtpython mcp_server.pyOr directly:
python -m src.a_mem.mainAdd the following configuration to your MCP configuration file:
- Windows:
%USERPROFILE%\.cursor\mcp.json(orC:\Users\<username>\.cursor\mcp.json) - macOS:
~/.cursor/mcp.json - Linux:
~/.cursor/mcp.json
{
"mcpServers": {
"a-mem": {
"command": "python",
"args": ["-m", "src.a_mem.main"],
"cwd": "/path/to/a-mem-mcp-server"
}
}
}Important: Adjust cwd to the absolute path to your project directory!
If an MCP Extension is available, use VSCode Settings (JSON) or an mcp.json file in the project root:
{
"mcpServers": {
"a-mem": {
"command": "python",
"args": ["-m", "src.a_mem.main"],
"cwd": "${workspaceFolder}"
}
}
}The server uses configuration from src/a_mem/config.py and .env file.
Copy .env.example to .env and adjust the values:
Ollama (default):
LLM_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_LLM_MODEL=qwen3:4b
OLLAMA_EMBEDDING_MODEL=nomic-embed-text:latestOpenRouter:
LLM_PROVIDER=openrouter
OPENROUTER_API_KEY=your_api_key_here
OPENROUTER_LLM_MODEL=openai/gpt-4o-mini
OPENROUTER_EMBEDDING_MODEL=openai/text-embedding-3-smallGraph Backend Selection:
# Default: NetworkX (no installation needed)
GRAPH_BACKEND=networkx
# For better performance (3x-100x faster):
# pip install rustworkx
GRAPH_BACKEND=rustworkx
# For persistent storage (production):
# Experimental - Not fully tested (see docs/FALKORDB_POC_README.md)
# Linux/macOS: pip install falkordblite
# Windows: pip install falkordb redis (see docs/WINDOWS_FALKORDB_SETUP.md)
# GRAPH_BACKEND=falkordb # ⚠️ Experimental - Use at your own riskMake sure Ollama is running and both models are installed:
ollama pull qwen3:4b
ollama pull nomic-embed-text:latest# Via MCP Tool
create_atomic_note(
content="Python async/await Patterns",
source="user_input"
)# Via MCP Tool
retrieve_memories(
query="Python concurrency",
max_results=5
)# Via MCP Tool
get_memory_stats()# Via MCP Tool
delete_atomic_note(
note_id="732c8c3b-7c71-42a6-9534-a611b4ffe7bf"
)# Via MCP Tool - Automatic chunking for large files
add_file(
file_path="documentation.md",
chunk_size=15000
)# Via MCP Tool - ⚠️ DELETES EVERYTHING!
reset_memory()The MCP Server is fully implemented and uses:
- ✅ Local Ollama (qwen3:4b for LLM, nomic-embed-text for embeddings) or OpenRouter (cloud)
- ✅ Async I/O for performance
- ✅ Memory Evolution in background
- ✅ Graph-based linking
- ✅ 15 MCP Tools (Core Memory, Note Management, Relations, Graph Operations, Maintenance, Research)
- ✅ Graph Backend Selection (NetworkX, RustworkX, FalkorDB - experimental)
- ✅ Parameter Validation (automatic validation of all tool parameters)
- ✅ Safe Graph Wrapper (edge case handling and data sanitization)
- ✅ Advanced Memory Enzymes (14+ maintenance operations: duplicate merging, edge validation, isolated node linking, keyword normalization, quality scoring, note validation, corrupted node repair, and more)