Skip to main content

AI Memory MCP Server โ€” persistent memory for AI assistants via Model Context Protocol. Cross-platform search across ChatGPT, Claude, DeepSeek, Gemini & Kimi.

Project description

AI Memory MCP Server

PyPI version Python versions License: MIT MCP Compatible Smithery Homepage

A Model Context Protocol (MCP) server that gives AI assistants persistent memory. Works with Claude Desktop, Cursor, VS Code, Windsurf, and 113+ MCP clients.


๐Ÿš€ Quick Install (One-Click)

Smithery (Cursor, Windsurf, Claude Desktop)

npx @smithery/cli install aimemory-mcp-server --client cursor
# or for windsurf:
npx @smithery/cli install aimemory-mcp-server --client windsurf

VS Code / Continue

Add to your MCP settings:

{
  "mcpServers": {
    "ai-memory": {
      "command": "npx",
      "args": ["-y", "@smithery/cli@latest", "run", "aimemory-mcp-server", "--client", "vscode"]
    }
  }
}

Installation

Option 1: PyPI Install (Recommended)

pip install aimemory-mcp-server

Option 2: GitHub Install

pip install git+https://github.com/jingchang0623-crypto/aimemory.git#subdirectory=mcp-server

Note: GitHub install provides the latest development version directly from the repository.

That's it! The aimemory-mcp-server command is now available.

Quick Start

Claude Desktop

Add to ~/.config/claude-desktop/claude_desktop_config.json (Linux/macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

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

Cursor

Add to .cursor/mcp.json in your project root or ~/.cursor/mcp.json:

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

VS Code (with Continue or MCP extension)

Add to your MCP configuration file:

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

Windsurf

Add to ~/.windsurf/config.json:

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

Tip: To use a custom database location, add "env": {"AIMEMORY_DB": "/path/to/your/aimemory.db"} to any configuration above.


Features

  • ๐Ÿ” Full-text search โ€” powered by SQLite FTS5 for fast, ranked results
  • ๐Ÿท๏ธ Tag-based organization โ€” categorize memories with tags
  • ๐Ÿ’พ Persistent storage โ€” memories survive restarts (SQLite)
    • ๐Ÿ”ง 15 core tools โ€” save, smart_search, timeline, consolidate, search, list, get, update, delete, stats, export, import, batch_save, get_tags, clear
  • ๐Ÿš€ Easy install โ€” pip install aimemory-mcp-server from PyPI
  • ๐Ÿชถ Zero config โ€” works out of the box with sensible defaults

Available Tools

save_memory โ€” Save a new memory

{
  "content": "The user prefers Python over JavaScript for backend work",
  "tags": ["preferences", "coding"],
  "source": "conversation-123"
}
Parameter Type Required Description
content string โœ… The memory content to store
tags list[str] โŒ Tags for categorization, e.g. ["work", "meeting"]
source string โŒ Source identifier (URL, file path, conversation ID)

search_memories โ€” Full-text search

{
  "query": "python backend",
  "limit": 5
}
Parameter Type Required Description
query string โœ… Search query (supports FTS5 syntax)
limit int โŒ Max results (default: 10, max: 100)

list_memories โ€” List memories

{
  "limit": 20,
  "tag": "coding"
}
Parameter Type Required Description
limit int โŒ Max results (default: 20, max: 200)
tag string โŒ Filter by tag

update_memory โ€” Update a memory

{
  "memory_id": 42,
  "content": "Updated content",
  "tags": ["updated-tag"]
}
Parameter Type Required Description
memory_id int โœ… ID of the memory to update
content string โŒ New content (keeps existing if omitted)
tags list[str] โŒ New tags (keeps existing if omitted)

delete_memory โ€” Delete a memory

{
  "memory_id": 42
}
Parameter Type Required Description
memory_id int โœ… ID of the memory to delete

get_memory โ€” Retrieve a memory by ID

{
  "memory_id": 42
}
Parameter Type Required Description
memory_id int โœ… ID of the memory to retrieve

memory_stats โ€” Get memory store statistics

{}

Returns total memory count, memories created in the last 7 days, and top tags distribution.

export_memories โ€” Export all memories for backup

{}

Returns all memories as a JSON list with count and export timestamp. Use this to backup your knowledge base or migrate to another system.

Returns:

  • count: Number of memories exported
  • memories: List of all memory objects (id, content, tags, source, timestamps)
  • exported_at: UTC timestamp of export

import_memories โ€” Import memories from backup

{
  "memories": [
    {"content": "User prefers dark mode", "tags": ["preferences"]},
    {"content": "Project uses PostgreSQL", "tags": ["tech-stack"]}
  ],
  "skip_duplicates": true
}
Parameter Type Required Description
memories list[dict] โœ… List of memory dicts to import
skip_duplicates bool โŒ Skip memories with existing content (default: true)

Returns: imported count and skipped count (duplicates).

batch_save_memories โ€” Save multiple memories at once

{
  "memories": [
    {"content": "User prefers dark mode", "tags": ["preferences"]},
    {"content": "Project uses PostgreSQL", "tags": ["tech-stack"]},
    {"content": "Team uses GitHub for CI/CD", "tags": ["devops"]}
  ]
}
Parameter Type Required Description
memories list[dict] โœ… List of memory dicts (content required, tags/source optional)

Returns: saved count and ids list of newly created memory IDs.

Use this for bulk operations โ€” much faster than calling save_memory repeatedly. Perfect for extracting key takeaways from a conversation in one call.

get_all_tags โ€” List all unique tags with counts

{}

Returns: total_tags count and tags dict mapping tag name to usage count (sorted by most-used first).

Use this to discover what categories of memories you have stored. Great for building navigation UI or understanding your knowledge base structure.

clear_all_memories โ€” Delete all memories

{}

โš ๏ธ WARNING: This permanently removes every memory. Export first using export_memories if you want to keep a backup.

Returns: success boolean and deleted_count (number of memories removed).


memory_smart_search โ€” ๐Ÿ” Smart search with tag boost & recency

Enhances basic FTS5 search by boosting results that match tags or were created recently.

{
  "query": "react nextjs project",
  "limit": 10,
  "tag_boost": 1.5,
  "recency_days": 30
}
Parameter Type Required Default Description
query string โœ… โ€” Search query (FTS5 syntax supported)
limit int โŒ 10 Max results (max: 100)
tag_boost float โŒ 1.5 Boost factor for tag matches (set to 1.0 to disable)
recency_days int โŒ 30 Memories from last N days get recency boost

Returns: Memories reranked by relevance + tag match + recency.

memory_timeline โ€” ๐Ÿ“… Memory timeline grouped by date

Perfect for visualizing how your memory collection evolved over time. Groups by creation date.

{
  "days": 7,
  "tag": null
}
Parameter Type Required Default Description
days int โŒ 7 Number of days to look back
tag string โŒ null Optional tag filter

Returns: Timeline data grouped by date with count and memory previews.

memory_consolidate โ€” ๐Ÿงฉ Find & consolidate related memories

Analyzes a group of related memories and suggests consolidation strategies.

{
  "query": "tech stack preferences",
  "max_memories": 20
}
Parameter Type Required Default Description
query string โœ… โ€” Search to find related memories
max_memories int โŒ 20 Max memories to analyze (max: 100)

Returns: Memory IDs, shared tags, tag frequency, avg length, and consolidation suggestions.


Search Syntax

The search uses SQLite FTS5 syntax:

Syntax Example Description
Simple python tutorial Words appearing anywhere
AND python AND machine learning Both terms required
OR react OR vue Either term matches
Phrase "exact phrase match" Exact phrase in quotes
NEAR NEAR/3(word1 word2) Words within 3 tokens of each other
Prefix prog* Matches "program", "programming", etc.

Environment Variables

Variable Default Description
AIMEMORY_DB ./aimemory.db Path to the SQLite database file
AIMEMORY_TRANSPORT stdio Transport mode: stdio (local) or http (remote via SSE)
AIMEMORY_PORT 8090 Port for HTTP transport mode
AIMEMORY_HOST 0.0.0.0 Host for HTTP transport mode

Set a custom database path:

export AIMEMORY_DB="/path/to/your/aimemory.db"

HTTP/SSE Transport (Remote Access)

For remote access or integration with web-based MCP clients:

AIMEMORY_TRANSPORT=http AIMEMORY_PORT=8090 aimemory-mcp-server

Then configure your MCP client to connect via SSE:

{
  "mcpServers": {
    "ai-memory": {
      "url": "http://your-server:8090/sse"
    }
  }
}

Or in your MCP client configuration:

{
  "mcpServers": {
    "ai-memory": {
      "command": "aimemory-mcp-server",
      "env": {
        "AIMEMORY_DB": "/path/to/your/aimemory.db"
      }
    }
  }
}

Running Without pip Install

You can also run directly from the repository:

cd mcp-server
pip install -r requirements.txt
python server.py

And configure the MCP client with the full path:

{
  "mcpServers": {
    "ai-memory": {
      "command": "python3",
      "args": ["/path/to/mcp-server/server.py"]
    }
  }
}

Troubleshooting

aimemory-mcp-server: command not found

Make sure the pip install directory is in your PATH:

# Check where it was installed
pip show aimemory-mcp-server

# Common fix: use python -m instead
python -m aimemory_mcp.server

ModuleNotFoundError: No module named 'fastmcp'

pip install fastmcp>=2.0.0

MCP client doesn't see the tools

  1. Restart your MCP client after changing configuration
  2. Verify the server runs: aimemory-mcp-server (should block/wait for stdin)
  3. Check MCP client logs for connection errors

Database locked errors

Only one process should write to the database at a time. If you see lock errors, ensure you don't have multiple server instances running.


๐Ÿ“‹ MCP Registry

Register this server in the official MCP Registry to make it discoverable:

  1. Fork the MCP Registry repository
  2. Add to servers.json:
{
  "io.github.jingchang0623-crypto/ai-memory": {
    "name": "AI Memory MCP Server",
    "description": "Persistent memory for AI assistants with cross-platform conversation search",
    "repository": "https://github.com/jingchang0623-crypto/aimemory",
    "homepage": "https://aimemory.pro",
    "license": "MIT",
    "tags": ["memory", "search", "conversation", "cross-platform"],
    "install": {
      "type": "pip",
      "package": "aimemory-mcp-server"
    }
  }
}
  1. Submit a Pull Request

Contributing

Contributions are welcome! Please see the main repository for details.

git clone https://github.com/jingchang0623-crypto/aimemory.git
cd aimemory/mcp-server
pip install -e ".[dev]"

License

MIT โ€” see LICENSE for details.


Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aimemory_mcp_server-1.6.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aimemory_mcp_server-1.6.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file aimemory_mcp_server-1.6.0.tar.gz.

File metadata

  • Download URL: aimemory_mcp_server-1.6.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for aimemory_mcp_server-1.6.0.tar.gz
Algorithm Hash digest
SHA256 d72f4a0f0cbebff3d57ea815b67f60497e1cf4aca435855e3af017ef0b6496bd
MD5 31f3979599bc9eb16da6e8bd1a031615
BLAKE2b-256 8ad358c000676000c9c8e33d134eba11868e1dfda1b6e0a7a55bc4b75a427a47

See more details on using hashes here.

File details

Details for the file aimemory_mcp_server-1.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aimemory_mcp_server-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c6ac1cfa75f8efb21db5469ac82c3b554ddafd78257c5808e9b0519dd959602
MD5 0a36498dbae24f40528f30f08d3184ee
BLAKE2b-256 e943b16154712d3ade1f50cd507969102bdbbfd5e9db210edb43a0a9cb99a8cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page