ai-memory-mcp

ai-memory-mcp

Provides persistent session memory for AI assistants, enabling them to store, search, and retrieve conversation summaries across sessions via the Model Context Protocol.

Category
Visit Server

README

🧠 AI Memory MCP

Persistent session memory for AI assistants β€” store, search and retrieve conversation summaries via the Model Context Protocol.

Python MCP License: MIT Tests


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.


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:

<details> <summary><b>Claude Desktop</b> β€” <code>~/Library/Application Support/Claude/claude_desktop_config.json</code></summary>

{
  "mcpServers": {
    "ai-memory": {
      "command": "ai-memory-mcp"
    }
  }
}

</details>

<details> <summary><b>Cursor</b> β€” <code>~/.cursor/mcp.json</code></summary>

{
  "mcpServers": {
    "ai-memory": {
      "command": "ai-memory-mcp"
    }
  }
}

</details>

<details> <summary><b>VS Code (GitHub Copilot)</b> β€” <code>.vscode/mcp.json</code></summary>

{
  "servers": {
    "ai-memory": {
      "type": "stdio",
      "command": "ai-memory-mcp"
    }
  }
}

</details>

<details> <summary><b>Windsurf</b> β€” <code>~/.codeium/windsurf/mcp_config.json</code></summary>

{
  "mcpServers": {
    "ai-memory": {
      "command": "ai-memory-mcp"
    }
  }
}

</details>

<details> <summary><b>HTTP mode</b> (remote / Docker / team)</summary>

Start the server:

ai-memory-mcp --http
# or: python service.py start

Then point your client at:

{
  "mcpServers": {
    "ai-memory": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

</details>

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 + all-MiniLM-L6-v2 (optional)
Multi-project Filter by project_name + branch_name
Task lifecycle pending β†’ in_progress β†’ completed / blocked / abandoned
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
save_summary Persist a new session summary
update_summary Update status / content
add_decision Record a key technical decision
search_summaries Keyword / FTS5 / vector search
search_summaries_fts Dedicated FTS5 full-text search
get_summary_by_id Exact lookup by session ID
list_recent_sessions List latest sessions
init_session Restore context at session start
weekly_review Generate Markdown weekly report
maintenance Rebuild index, VACUUM, persist vectors

Configuration

All settings are optional β€” sensible defaults work out of the box.

Env var Default Description
AI_MEMORY_DB_PATH ~/.ai-memory/ai_memory.db SQLite database path
AI_MEMORY_MODEL_PATH ~/.ai-memory/models Embedding model cache
AI_MEMORY_HOST 127.0.0.1 HTTP server bind address
AI_MEMORY_PORT 8000 HTTP server port

Create ~/.ai-memory/.env to persist settings:

AI_MEMORY_DB_PATH=/custom/path/ai_memory.db
AI_MEMORY_PORT=9000

Docker

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 -f

The 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 --http

Project 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.toml

Testing

24 passed in 7s
pytest tests/unit/test_mcp_server.py -v

All 24 unit tests cover: save/update/search/FTS/vector/decisions/maintenance/init/review/schema.


Requirements

  • Python 3.10+
  • mcp >= 1.6.0
  • python-dotenv >= 1.0.0

Optional (vector search):

  • chromadb >= 0.6.0
  • sentence-transformers >= 3.0.0

License

MIT Β© AI Memory Team

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured