Local MCP server for persistent, searchable agent memory
Requires Python >= 3.13 and uv. Dependencies are managed entirely through uv — no system-wide pip installs needed.
Add to your MCP client config (mcp.json for VS Code):
{
"servers": {
"mcpsaver": {
"type": "stdio",
"command": "uv",
"args": [
"--directory", "/path/to/MCPSaver",
"run", "mcpsaver"
]
}
}
}
SQLite FTS5 with porter stemming. Term-OR queries for broad recall across all lessons. Find relevant past corrections in ~50 tokens instead of reading an entire flat file.
Cache detected stack, linter, formatter, and file tree per workspace. Skip redundant project discovery at the start of every session.
Index functions, classes, and methods with file paths. Query find_prior_art before writing new code to check if something similar already exists.
Migrate from flat Markdown memory files. The import_memory_md tool parses the standard format and populates the SQLite database.
Everything runs locally over stdio. No network calls, no cloud storage, no API keys. Your agent memory stays on your machine in a single SQLite file.
Six lesson categories: convention, self_correction, human_correction, api_fact, decision, pattern. Tagged and timestamped for precise retrieval.
Flat Markdown memory files force the agent to read the entire file to find one relevant lesson, burning thousands of tokens on irrelevant history. MCPSaver gives the agent queryable long-term memory with selective retrieval:
| Operation | Flat MEMORY.md | MCPSaver |
|---|---|---|
| Find a past lesson | Read entire file (~2000 tokens) | search_memory("pytest fixture") (~50 tokens) |
| Load project context | Run git status, read manifests (~500 tokens) |
get_workspace_context() (~30 tokens) |
| Record a new lesson | Append to MEMORY.md manually |
record_lesson(...) (indexed, timestamped) |
| Check prior art | Grep codebase (~300 tokens) | find_prior_art(symbol="...") (~20 tokens) |
MCPSaver exposes 9 MCP tools to the agent:
| Tool | Purpose |
|---|---|
record_lesson |
Store a lesson, correction, or convention into persistent memory |
search_memory |
Full-text search across all recorded lessons with FTS5 |
get_workspace_context |
Retrieve cached project context (stack, linter, file tree) |
set_workspace_context |
Cache project context for future sessions |
find_prior_art |
Search indexed code symbols for prior usage |
index_symbols |
Index code symbols for a workspace |
list_lessons |
List recent lessons with optional filters |
get_stats |
Return memory database statistics |
import_memory_md |
Import lessons from a flat MEMORY.md file |
The MCP server speaks JSON-RPC over stdin/stdout. All data lives in a single SQLite file at ~/.local/share/mcpsaver/memory.db.