memory-mcp
Click on "Install 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., "@memory-mcpsearch past sessions about the Postgres migration"
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.
memory-mcp
Local-first MCP server that gives Claude (or any MCP client) long-term memory over past dev sessions. Session metadata is embedded and stored in Postgres/pgvector; semantic search returns cheap metadata hits, and only the sessions you judge relevant get their full content resolved and loaded.
Runs entirely on your machine: local Postgres via Docker, local embedding model via @huggingface/transformers. No external API calls, no data leaves the box.
How it works
Three MCP tools, mirrored 1:1 by MemoryStore (src/core/memoryStore.ts):
Tool | Purpose |
| Embed a session's structured metadata (summary, topics, decisions, files touched) and upsert it, keyed by |
| Vector-similarity search over indexed sessions. Returns metadata only (no file contents), unranked beyond cosine distance — the caller decides what's actually relevant. |
| Resolve chosen session ids to their |
The intended flow: search_sessions first (cheap, metadata-only) → the agent decides which hits matter → get_session_files only for those → read the resolved paths last. This keeps token spend proportional to relevance instead of reading every candidate up front.
This project pairs naturally with a "write a session summary to a file" workflow (e.g. a /session-summary command that writes to an Obsidian vault) — index_session is called after the summary file is written, with sessionPath pointing at it. Sample commands for exactly this are included — see Commands below.
Architecture
src/server.ts— registers the three MCP tools against aMemoryStore, transport-agnostic.src/core/memoryStore.ts— execution layer: SQL + embedding calls, independent of transport.src/transport/stdio.ts— stdio transport (the only one wired up today).src/embeddings/— embedding provider abstraction;workerEmbeddingProvider.tsruns the model (@huggingface/transformers, defaultXenova/bge-small-en-v1.5) in a worker thread so embedding doesn't block the main event loop.src/db/— Postgres client, connection pooling, andschema.sql(pgvector table + HNSW index).src/scripts/— one-off setup scripts (downloadModel.ts,registerMcp.ts).
Related MCP server: AIVectorMemory
Setup
Prerequisites: Node >= 20, pnpm, Docker.
pnpm setupThis runs, in order: pnpm install → start Postgres via Docker (db:up) → download the embedding model locally → tsc build → register the server with the Claude CLI (claude mcp add, prompts for global vs. project scope).
Each step can also be run individually:
pnpm install
pnpm db:up # docker compose up -d --wait
pnpm model:download # caches the embedding model into .models/
pnpm build # tsc + copy schema.sql into dist/
pnpm mcp:register # claude mcp add memory-mcp -> node dist/index.jsmcp:register detects an existing registration and offers to reconfigure it; pass --global or --local to skip the interactive prompt.
pnpm setup then asks a final question — "Register commands?" — see below.
Commands
templates/commands/ ships two sample Claude Code slash commands, generalized for any user:
Command | Does |
| Writes a structured note about the current session to a vault directory, then calls |
| Answers a question from prior sessions: calls |
Both templates reference the vault directory as __VAULT_DIR__ — wherever you want session notes written (an Obsidian vault, a plain folder, anything readable/writable).
Run pnpm commands:register (or answer "yes" at the end of pnpm setup) to install them:
Prompts for the vault directory (defaults to
~/Documents/obsidian/Claude) and substitutes it for every__VAULT_DIR__in the templates.Writes the rendered files to
$CLAUDE_CONFIG_DIR/commands/ifCLAUDE_CONFIG_DIRis set, otherwise~/.claude/commands/— the same resolution order theclaudeCLI itself uses (seemcp:registerabove).Asks before overwriting a command file that already exists at the destination.
Re-run pnpm commands:register any time to update an existing install or point it at a different vault directory.
Migrating pre-existing sessions (opt-in, manual)
If you already have a vault of session notes written before memory-mcp existed (or before /session-summary started calling index_session), templates/commands/session-migrate.md backfills them. It's deliberately not installed by commands:register or pnpm setup — it's a one-off maintenance operation, not part of the standard install:
cp templates/commands/session-migrate.md "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/commands/"Then run /session-migrate and give it the vault directory when asked. It reads each note, extracts the structured fields (date, branch, tags, decisions, files touched), writes a proper summary, and calls index_session — capped at 100 notes per run, since indexing requires reading and summarizing every note in full and the token cost stops being trivial past that. It tracks what it's already indexed in <vault>/.memory-mcp-migrated.json, so re-running only picks up notes added since the last pass.
Configuration
Copy .env.example to .env to override defaults:
Variable | Default | Notes |
|
| Matches |
|
| Must match the embedding model's output dimension and the |
|
| Any |
|
|
|
|
| Populated ahead of time by |
The schema (src/db/schema.sql) is applied automatically on server startup (ensureSchema) — no separate migration step.
Development
pnpm dev # tsx watch src/index.ts
pnpm typecheck # tsc --noEmit
pnpm db:logs # docker compose logs -f postgres
pnpm db:down # docker compose downThe server speaks MCP over stdio (src/index.ts → startStdioTransport), so pnpm dev alone won't do much interactively — point an MCP client (e.g. Claude Code via mcp:register) at it, or drive MemoryStore directly for testing.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenancePersistent memory MCP server for AI coding agents (Claude Code, Codex, Gemini CLI). Hybrid retrieval (vector + BM25), cross-encoder reranking, knowledge graph, session checkpoint/resume, and multi-scope isolation. Local-first with LanceDB.Last updated302815MIT
- AlicenseBqualityBmaintenanceMCP server that provides cross-session persistent memory for AI coding assistants using local vector database and semantic search, enabling automatic recall of project context, issues, and tasks.Last updated991Apache 2.0
- AlicenseAqualityDmaintenanceMCP server for semantic code indexing using vector embeddings, enabling AI agents to maintain persistent memory of codebases through natural language queries and intelligent chunking.Last updated19784MIT
- Flicense-qualityFmaintenanceA local-first, team-ready MCP server providing durable memory for LLM-based coding workflows with multiple storage backends and fast search.Last updated4
Related MCP Connectors
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Local-first RAG engine with MCP server for AI agent integration.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/MateoGuerreroE/mcp-memory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server