ai-memory-mcp
Integrates with GitHub Copilot in VS Code to provide persistent memory, allowing storage and retrieval of session summaries and decisions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ai-memory-mcp Load my memory for project 'ai-memory-mcp'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ง AI Memory MCP
Persistent session memory for AI assistants โ store, search and retrieve conversation summaries via the Model Context Protocol.
What is this?
AI assistants forget everything between sessions. AI Memory MCP solves that by giving your AI a structured long-term memory:
๐ Save session summaries with status, tags, modules and file paths
๐ Search by keyword, full-text (FTS5), or semantic vector similarity
๐ Restore context at the start of each session with one tool call
๐ Generate weekly reports from completed tasks automatically
๐ท๏ธ Multi-project / multi-branch support out of the box
Works with Claude Desktop, Cursor, VS Code, Windsurf, and any MCP-compatible client.
Related MCP server: recall-mcp
Quick Start
1 โ Install
# From PyPI (recommended)
pip install ai-memory-mcp
# With vector search support (adds ~500 MB for embedding model)
pip install "ai-memory-mcp[vector]"
# From source
git clone https://github.com/zhanpu89/ai-memory-mcp
cd ai-memory-mcp
pip install -e .2 โ Configure your AI client
Pick the config snippet for your tool and add it to its MCP settings file:
{
"mcpServers": {
"ai-memory": {
"command": "ai-memory-mcp"
}
}
}{
"mcpServers": {
"ai-memory": {
"command": "ai-memory-mcp"
}
}
}{
"servers": {
"ai-memory": {
"type": "stdio",
"command": "ai-memory-mcp"
}
}
}{
"mcpServers": {
"ai-memory": {
"command": "ai-memory-mcp"
}
}
}Start the server:
ai-memory-mcp --http
# or: python service.py startThen point your client at:
{
"mcpServers": {
"ai-memory": {
"url": "http://localhost:8000/mcp"
}
}
}All config snippets are available in
integrations/.
3 โ Use it
At the start of every session, tell your AI:
Load my memory for project "my-project"The AI will call init_session and restore your previous context automatically.
Features
Feature | Details |
Storage | SQLite โ zero external services, single file |
Full-text search | SQLite FTS5 โ fast, no extra deps |
Semantic search | ChromaDB + |
Multi-project | Filter by |
Task lifecycle |
|
Key decisions | Attach architectural decisions to sessions |
Weekly reports | Auto-generated Markdown report |
Transport | stdio (local) or streamable-HTTP (remote) |
Docker | Single-container deployment included |
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Client (Claude / Cursor โฆ) โ
โ MCP Protocol โ
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ stdio / HTTP
โโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AiMemoryMcpServer (FastMCP) โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ SQLite DB โ โ ChromaDB (optional) โ โ
โ โ FTS5 index โ โ Sentence-Transformersโ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโData lives in ~/.ai-memory/ โ completely separate from your project files.
Tool Reference
โ See TOOLS.md for the full schema of all 10 tools.
Tool | Description |
| Persist a new session summary |
| Update status / content |
| Record a key technical decision |
| Keyword / FTS5 / vector search |
| Dedicated FTS5 full-text search |
| Exact lookup by session ID |
| List latest sessions |
| Restore context at session start |
| Generate Markdown weekly report |
| Rebuild index, VACUUM, persist vectors |
Configuration
All settings are optional โ sensible defaults work out of the box.
Env var | Default | Description |
|
| SQLite database path |
|
| Embedding model cache |
|
| HTTP server bind address |
|
| HTTP server port |
Create ~/.ai-memory/.env to persist settings:
AI_MEMORY_DB_PATH=/custom/path/ai_memory.db
AI_MEMORY_PORT=9000Docker
Optimized for China: Uses Tsinghua pip mirror + HuggingFace mirror for fast downloads.
# Option 1: Core-only (lightweight, ~200 MB image)
docker compose up -d
# Option 2: Full (with vector search)
# Step 1: Pre-download model to avoid large image
python3 scripts/download_model_for_docker.py --output ./models
# Step 2: Build with vector support (~700 MB image + 500 MB external model)
docker compose build --build-arg INSTALL_VECTOR=true
docker compose up -d
# View logs
docker compose logs -fThe MCP endpoint will be available at http://localhost:8000/mcp.
๐ Full deployment guide: See DOCKER.md for:
Image size optimization strategies
Chinese mirror configuration
Model pre-downloading
Production deployment examples
Development
# Clone and install in editable mode with dev extras
git clone https://github.com/zhanpu89/ai-memory-mcp
cd ai-memory-mcp
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=src/mcp_server --cov-report=term-missing
# Start in HTTP mode for manual testing
ai-memory-mcp --httpProject Structure
ai-memory-mcp/
โโโ src/mcp_server/
โ โโโ __init__.py
โ โโโ server.py # All 10 MCP tools + server class
โโโ tests/
โ โโโ unit/ # 24 unit tests
โ โโโ integration/
โโโ scripts/
โ โโโ download_model.py # Manual model download
โ โโโ migrate_db.py # Database migration helper
โ โโโ migrate_vector.py # Vector store migration
โโโ integrations/ # Ready-to-use MCP client configs
โ โโโ claude_desktop_config.json
โ โโโ cursor_mcp.json
โ โโโ vscode_mcp.json
โ โโโ windsurf_mcp.json
โ โโโ http_mode_config.json
โโโ TOOLS.md # Full tool schema reference
โโโ INSTALL.md # Detailed installation guide
โโโ Dockerfile
โโโ docker-compose.yml
โโโ pyproject.tomlTesting
24 passed in 7spytest tests/unit/test_mcp_server.py -vAll 24 unit tests cover: save/update/search/FTS/vector/decisions/maintenance/init/review/schema.
Requirements
Python 3.10+
mcp >= 1.6.0python-dotenv >= 1.0.0
Optional (vector search):
chromadb >= 0.6.0sentence-transformers >= 3.0.0
License
MIT ยฉ AI Memory Team
Available Tools
10 toolsadd_decisionB
ไธบๆๅฎไผ่ฏๆทปๅ ๅ ณ้ฎๅณ็ญ่ฎฐๅฝใ
Args: params (AddDecisionInput): ๅ ๅซ๏ผ - session_id (str): ๅ ณ่็ไผ่ฏ ID - decision_type (str): ๅณ็ญ็ฑปๅ๏ผๅฆ tech_stack / api_design / architecture - description (str): ๅณ็ญๆ่ฟฐ - reasoning (Optional[str]): ๅณ็ญ็็ฑ
Returns: Dict: {"success": bool, "message": str}
Inputs: params (required). Returns: result
get_summary_by_idARead-onlyIdempotent
ๆ นๆฎ session_id ็ฒพ็กฎๆฅ่ฏขๅๆกๆ่ฆ่ฎฐๅฝใ
Args: params (GetSummaryByIdInput): ๅ ๅซ๏ผ - session_id (str): ็ฎๆ ไผ่ฏ ID
Returns: Dict: {"success": bool, "data": Dict}
Inputs: params (required). Returns: result
init_sessionARead-onlyIdempotent
ไผ่ฏๅฏๅจๆถ่ฐ็จ๏ผ่ฟๅๆ่ฟ 3 ๅคฉๅ ่ฟ่กไธญ็ไปปๅกๅ่กจ๏ผๅธฎๅฉๆขๅคไธไธๆใ
Args: params (InitSessionInput): ๅ ๅซ๏ผ - project_name (Optional[str]): ้กน็ฎๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - branch_name (Optional[str]): ๅๆฏๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้
Returns: Dict: {"success": bool, "data": List[Dict], "prompt": str}
Inputs: params (required). Returns: result
list_recent_sessionsARead-onlyIdempotent
ๅๅบๆ่ฟ็ไผ่ฏๆ่ฆ๏ผๆฏๆๆ้กน็ฎๅๅๆฏ่ฟๆปคใ
Args: params (ListRecentSessionsInput): ๅ ๅซ๏ผ - limit (int): ๆๅคง่ฟๅๆกๆฐ๏ผ้ป่ฎค 10 - project_name (Optional[str]): ้กน็ฎๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - branch_name (Optional[str]): ๅๆฏๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้
Returns: Dict: {"success": bool, "data": List[Dict]}
Inputs: params (required). Returns: result
maintenanceAIdempotent
ๆง่กๆฐๆฎๅบ็ปดๆค๏ผ้ๅปบ FTS5 ๅ จๆ็ดขๅผใๅ็ผฉๆฐๆฎๅบ๏ผๅนถๆไน ๅๅ้ๅญๅจใ
Returns: Dict: {"success": bool, "message": str}
Inputs: no named parameters. Returns: result
save_summaryA
ไฟๅญไผ่ฏๆ่ฆๅฐๆฐๆฎๅบ๏ผๅๆญฅๆดๆฐๅ จๆ็ดขๅผๅๅ้็ดขๅผใ
Args: params (SaveSummaryInput): ๅ ๅซ๏ผ - session_id (str): ๅฏไธไผ่ฏ ID๏ผไธๅฏ้ๅค - task_title (str): ไปปๅกๆ ้ข - summary_content (str): ๆ่ฆๆญฃๆๅ ๅฎน - status (TaskStatus): ไปปๅก็ถๆ๏ผ้ป่ฎค completed - next_steps (Optional[str]): ไธไธๆญฅ่ฎกๅ - tags (Optional[str]): ๆ ็ญพ๏ผ้ๅทๅ้ - module (Optional[str]): ๆๅฑๆจกๅ - file_paths (Optional[str]): ๆถๅๆไปถ่ทฏๅพ๏ผ้ๅทๅ้ - project_name (Optional[str]): ้กน็ฎๅ็งฐ - branch_name (Optional[str]): ๅๆฏๅ็งฐ
Returns: Dict: {"success": bool, "message": str}
Inputs: params (required). Returns: result
search_summariesBRead-onlyIdempotent
ๆ็ดขไผ่ฏๆ่ฆ๏ผๆฏๆๅ ณ้ฎ่ฏใๆ ็ญพใๆจกๅใ็ถๆใ้กน็ฎใๅๆฏ่ฟๆปค๏ผไปฅๅ FTS5 ๅ จๆๆฃ็ดขๅๅ้่ฏญไนๆฃ็ดขใ
Args: params (SearchSummariesInput): ๅ ๅซ๏ผ - query (Optional[str]): ๆ็ดขๅ ณ้ฎ่ฏ - tags (Optional[str]): ๆ ็ญพ่ฟๆปค๏ผๆจก็ณๅน้ - module (Optional[str]): ๆจกๅ่ฟๆปค๏ผๆจก็ณๅน้ - status (Optional[TaskStatus]): ็ถๆ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - project_name (Optional[str]): ้กน็ฎๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - branch_name (Optional[str]): ๅๆฏๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - use_fts (bool): ๆฏๅฆไฝฟ็จ FTS5 ๅ จๆๆฃ็ดข๏ผ้ป่ฎค False - use_vector (bool): ๆฏๅฆไฝฟ็จๅ้่ฏญไนๆฃ็ดข๏ผ้ป่ฎค False - limit (int): ๆๅคง่ฟๅๆกๆฐ๏ผ้ป่ฎค 10
Returns: Dict: {"success": bool, "data": List[Dict]}
Inputs: params (required). Returns: result
search_summaries_ftsARead-onlyIdempotent
ไฝฟ็จ FTS5 ๅ จๆ็ดขๅผๆ็ดขไผ่ฏๆ่ฆ๏ผ้ๅ็ฒพ็กฎๅ ณ้ฎ่ฏๅน้ ๅบๆฏใ
Args: params (SearchSummariesFtsInput): ๅ ๅซ๏ผ - query (str): ๅ จๆๆฃ็ดขๅ ณ้ฎ่ฏ๏ผๆฏๆ FTS5 ๆฅ่ฏข่ฏญๆณ - project_name (Optional[str]): ้กน็ฎๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - branch_name (Optional[str]): ๅๆฏๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - status (Optional[TaskStatus]): ็ถๆ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - limit (int): ๆๅคง่ฟๅๆกๆฐ๏ผ้ป่ฎค 10
Returns: Dict: {"success": bool, "data": List[Dict]}
Inputs: params (required). Returns: result
update_summaryAIdempotent
ๆดๆฐๅทฒๆไผ่ฏๆ่ฆ็็ถๆๆๅ ๅฎน๏ผๅๆญฅๆดๆฐๅ จๆ็ดขๅผใ
Args: params (UpdateSummaryInput): ๅ ๅซ๏ผ - session_id (str): ่ฆๆดๆฐ็ไผ่ฏ ID - new_status (Optional[TaskStatus]): ๆฐ็ถๆ - updated_content (Optional[str]): ๆฐ็ๆ่ฆๅ ๅฎน
Returns: Dict: {"success": bool, "message": str}
Inputs: params (required). Returns: result
weekly_reviewARead-onlyIdempotent
็ๆๆฌๅจ้กน็ฎๅจๆฅ๏ผๆฑๆปๅฎๆไปปๅกใๅ ณ้ฎๅณ็ญๅไธไธๆญฅๅปบ่ฎฎใ
Args: params (WeeklyReviewInput): ๅ ๅซ๏ผ - project_name (Optional[str]): ้กน็ฎๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้ - branch_name (Optional[str]): ๅๆฏๅ็งฐ่ฟๆปค๏ผ็ฒพ็กฎๅน้
Returns: Dict: {"success": bool, "data": {"report": str}}
Inputs: params (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 10 tools
Most tools serve distinct purposes, but search_summaries and search_summaries_fts overlap significantly, potentially confusing an agent about which to use for searching summaries.
Names mostly follow verb_noun pattern (add_decision, save_summary) but include a few outliers like maintenance (noun) and longer phrases like get_summary_by_id, deviating from strict consistency.
With 10 tools covering session initialization, CRUD, search, maintenance, and reporting, the count is well-scoped for an AI memory server without being overwhelming.
Covers saving, retrieving, updating, and searching summaries, but lacks delete functionality and has no dedicated tools for retrieving or removing decisions, leaving notable gaps.
Maintenance
Related MCP Connectors
Persistent memory for AI agents. Search, store, and recall across sessions.
Cross-LLM persistent memory: store context once, recall it from any AI model.
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Persistent cloud memory for AI agents. Store and search key-value memories across sessions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides persistent memory for AI coding agents through the Model Context Protocol, enabling them to store and retrieve project knowledge across sessions.27 npmMIT
- AlicenseNot gradedqualityDmaintenancePersistent, searchable memory for AI agents over the Model Context Protocol, enabling memory storage, full-text search with BM25 ranking, and retrieval across sessions.10 npmMIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent, project-specific memory to AI assistants via the Model Context Protocol, enabling context-aware collaboration across sessions without cloud dependencies.33 PyPI1Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA standalone memory service that provides persistent storage for AI assistants via the Model Context Protocol.MIT