MCP AI Memory
Enables AI agents to store, retrieve, and manage contextual knowledge across sessions using semantic search with PostgreSQL and vector embeddings. Supports memory relationships, clustering, multi-agent isolation, and intelligent caching for persisten
What is MCP AI Memory?
MCP AI Memory is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to enables ai agents to store, retrieve, and manage contextual knowledge across sessions using semantic search with postgresql and vector embeddings. supports memory relationships, clustering, multi-agen...
Enables AI agents to store, retrieve, and manage contextual knowledge across sessions using semantic search with PostgreSQL and vector embeddings. Supports memory relationships, clustering, multi-agent isolation, and intelligent caching for persisten
This server falls under the Knowledge & Memory category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Enables AI agents to store, retrieve, and manage contextual
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-ai-memoryConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP AI Memory
MCP AI Memory is a TypeScript MCP server that gives AI agents persistent, semantic long-term memory backed by PostgreSQL with the pgvector extension. It stores contextual knowledge as vector embeddings, supports relationship graphs between memories, offers multi-agent isolation so different agents have separate memory namespaces, and includes automatic memory lifecycle management with decay and preservation. Developers building stateful AI agents or workflows that need to remember facts, preferences, or prior interactions across sessions will benefit from this server.
Prerequisites
- Node.js 18+ or Bun runtime
- PostgreSQL database with the pgvector extension installed
- Redis (optional, for caching; an in-memory fallback is available)
- Claude Desktop or another MCP-compatible client
Set up PostgreSQL with pgvector
Install the pgvector extension in your PostgreSQL instance and create a dedicated database for MCP AI Memory.
psql -U postgres -c "CREATE DATABASE mcp_ai_memory;"
psql -U postgres -d mcp_ai_memory -c "CREATE EXTENSION IF NOT EXISTS vector;"Install the package
Install mcp-ai-memory globally via npm so it can be launched with npx.
npm install -g mcp-ai-memoryRun database migrations
If installing from source, run migrations to create the required schema. When using the npm package with DATABASE_URL set, migrations run automatically on first launch.
# From source only:
bun run migrateConfigure environment variables
Set DATABASE_URL at minimum. REDIS_URL is optional. EMBEDDING_MODEL, MIN_SIMILARITY_SCORE, and MAX_MEMORIES_PER_QUERY can be tuned to change retrieval behavior.
DATABASE_URL=postgresql://user:password@localhost:5432/mcp_ai_memory
REDIS_URL=redis://localhost:6379
EMBEDDING_MODEL=Xenova/all-MiniLM-L6-v2
MIN_SIMILARITY_SCORE=0.5
MAX_MEMORIES_PER_QUERY=10Add the server to Claude Desktop
Register mcp-ai-memory in your claude_desktop_config.json, passing the environment variables so the server can connect to the database.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-ai-memory"],
"env": {
"DATABASE_URL": "postgresql://user:password@localhost:5432/mcp_ai_memory",
"REDIS_URL": "redis://localhost:6379"
}
}
}
}MCP AI Memory Examples
Client configuration
Register MCP AI Memory in Claude Desktop with your PostgreSQL and optional Redis connection strings.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-ai-memory"],
"env": {
"DATABASE_URL": "postgresql://user:password@localhost:5432/mcp_ai_memory",
"REDIS_URL": "redis://localhost:6379",
"MIN_SIMILARITY_SCORE": "0.5",
"MAX_MEMORIES_PER_QUERY": "10"
}
}
}
}Prompts to try
Use Claude to store and retrieve information across sessions using the memory tools.
- "Remember that my preferred coding style is tabs, not spaces"
- "Search your memory for anything I told you about my project architecture"
- "What do you remember about my preferences for database design?"
- "List all memories related to my Python projects"
- "Create a relationship between the memory about my project and the one about the database schema"Troubleshooting MCP AI Memory
Connection error: pgvector extension not found
Install pgvector in your PostgreSQL instance: run CREATE EXTENSION IF NOT EXISTS vector; in the target database as a superuser. Ensure your PostgreSQL version is 12 or newer.
Memories are not returned even though they were stored
Lower the MIN_SIMILARITY_SCORE environment variable (e.g., from 0.5 to 0.3) to retrieve memories with lower semantic similarity. Also check that the embedding model downloaded correctly on first run.
Server fails to start with DATABASE_URL errors
Verify the connection string format: postgresql://user:password@host:port/dbname. Ensure the PostgreSQL server is running and the specified user has CREATE TABLE privileges.
Frequently Asked Questions about MCP AI Memory
What is MCP AI Memory?
MCP AI Memory is a Model Context Protocol (MCP) server that enables ai agents to store, retrieve, and manage contextual knowledge across sessions using semantic search with postgresql and vector embeddings. supports memory relationships, clustering, multi-agent isolation, and intelligent caching for persisten It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP AI Memory?
Follow the installation instructions on the MCP AI Memory GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP AI Memory?
MCP AI Memory works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP AI Memory free to use?
Yes, MCP AI Memory is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MCP AI Memory Alternatives — Similar Knowledge & Memory Servers
Looking for alternatives to MCP AI Memory? Here are other popular knowledge & memory servers you can use with Claude, Cursor, and VS Code.
MemPalace
★ 52.6kA local AI memory system that stores all conversations verbatim and organizes them into navigable structures. It provides 19 MCP tools for AI assistants to search and retrieve past decisions, debugging sessions, and architecture debates automatically
Kratos
★ 25.7k🏛️ Memory System for AI Coding Tools - Never explain your codebase again. MCP server with perfect project isolation, 95.8% context accuracy, and the Four Pillars Framework.
Context Mode
★ 15.4kAn MCP server that preserves LLM context by intercepting large data outputs and returning only concise summaries or relevant sections. It enables efficient sandboxed code execution, file processing, and documentation indexing across multiple programm
Memu
★ 13.7kMemory for 24/7 proactive agents like OpenClaw.
MemOS
★ 9.3kMemOS (Memory Operating System) is a memory management operating system designed for AI applications. Its goal is: to enable your AI system to have long-term memory like a human, not only remembering what users have said but also actively invoking, u
Everos
★ 5.4kBuild, evaluate, and integrate long-term memory for self-evolving agents.
Browse More Knowledge & Memory MCP Servers
Explore all knowledge & memory servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP AI Memory in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP AI Memory?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.