local-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., "@local-memory-mcpRecall my preferred tech stack for new projects."
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.
local-memory-mcp
A local-first long-term memory system for AI coding agents, exposed as an MCP server. Built for Kiro CLI but compatible with any MCP-capable client.
Why
AI agents forget everything between sessions. This gives them persistent, searchable, semantically-aware memory — stored entirely on your machine.
Related MCP server: knitbrain
Architecture
┌─────────────────────────────────────────────────┐
│ MCP Server (stdio) │
│ │
│ Tools: store_memory · recall · search_memories │
│ get_memory · forget · relate │
│ query_graph · consolidate · memory_stats│
├─────────────────────────────────────────────────┤
│ Memory Engine │
│ ┌───────────┬──────────┬───────────────────┐ │
│ │ Retrieval │ Embeddings│ Consolidation │ │
│ │ (hybrid) │ (local) │ (decay + merge) │ │
│ └───────────┴──────────┴───────────────────┘ │
├─────────────────────────────────────────────────┤
│ Storage Layer │
│ ┌──────────┬───────────┬────────┬──────────┐ │
│ │ Memories │ Vectors │ FTS5 │ Knowledge│ │
│ │ (SQLite) │(sqlite-vec)│(SQLite)│ Graph │ │
│ └──────────┴───────────┴────────┴──────────┘ │
└─────────────────────────────────────────────────┘Hybrid retrieval combines four signals into a single score:
Signal | Weight | Source |
Vector similarity | 50% | sqlite-vec (L2 distance on 384-dim embeddings) |
Full-text search | 25% | SQLite FTS5 |
Recency | 15% | Exponential decay, 30-day half-life |
Importance | 10% | User-assigned + access-frequency boosting |
Embeddings run fully locally via Transformers.js (ONNX runtime) using all-MiniLM-L6-v2. No API keys. No network calls after first model download.
Knowledge graph stores typed entities and weighted relations in SQLite with BFS traversal up to 3 hops.
Consolidation applies importance decay, merges near-duplicate memories, and prunes forgotten ones.
Dual-scope storage
Every memory lives in one of two scopes:
Global (
~/.local-memory/memory.db) — your preferences, facts, cross-project knowledgeProject (
.local-memory/memory.dbin repo root) — project-specific context, decisions, patterns
The agent can query either scope or both. Project scope auto-detects from .git, package.json, Cargo.toml, pyproject.toml, or go.mod.
Tools
Tool | Description |
| Store a memory with type, scope, importance, and optional entity extraction |
| Semantic recall — hybrid search combining all four signals |
| Keyword-based full-text search |
| Fetch a specific memory by ID |
| Delete a memory and cascade to embeddings + graph |
| Create/strengthen entity relationships in the knowledge graph |
| Traverse the knowledge graph from an entity (BFS, 1-3 hops) |
| Decay old memories, merge duplicates, prune weak ones |
| Counts for memories, entities, and relations per scope |
Quickstart
Install
git clone https://github.com/smankoo/local-memory-mcp.git
cd local-memory-mcp
npm install
npm run buildConfigure Kiro CLI
Option A — Auto-configure:
npx tsx scripts/install-kiro.ts # global
npx tsx scripts/install-kiro.ts --project # project-levelOption B — Manual:
Add to ~/.kiro/settings/mcp.json:
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["/absolute/path/to/local-memory-mcp/dist/index.js"],
"env": {
"MEMORY_DIR": "~/.local-memory"
}
}
}
}Then restart Kiro CLI and run /mcp to verify.
Other MCP clients
Any client that speaks MCP over stdio works. The server binary is dist/index.js:
node /path/to/local-memory-mcp/dist/index.jsEnvironment variables
Variable | Default | Description |
|
| Global data directory |
| auto-detected CWD | Project root override |
|
| HuggingFace model for embeddings |
Configuration
Tuning knobs are in src/utils/config.ts:
Parameter | Default | Description |
| 0.92 | Cosine similarity above which a new memory updates the existing one |
| 0.85 | Similarity above which two memories are merged during consolidation |
| 0.995 | Daily importance multiplier (0.995^30 ≈ 0.86, so ~14% decay/month) |
| 0.05 | Memories below this with <2 accesses get pruned |
Development
npm run dev # watch mode
npm test # run tests (downloads model on first run, ~60s)
npm run build # production buildProject structure
src/
├── index.ts # Entry point — stdio transport
├── server.ts # MCP tool definitions
├── engine/
│ ├── memory-engine.ts # Orchestrator — store, recall, forget, consolidate
│ ├── retrieval.ts # Hybrid scoring (vector + FTS + recency + importance)
│ ├── embeddings.ts # Local embedding via Transformers.js
│ ├── consolidation.ts # Decay, merge, prune lifecycle
│ └── graph.ts # Entity relationship engine
├── storage/
│ ├── database.ts # SQLite + sqlite-vec + FTS5 initialization
│ ├── schema.ts # Drizzle ORM schema
│ ├── memory-store.ts # CRUD for memories table
│ ├── vector-store.ts # sqlite-vec operations
│ ├── fts-store.ts # FTS5 search with query sanitization
│ └── graph-store.ts # Entity + relation tables, BFS traversal
└── utils/
├── config.ts # Environment + defaults
├── scoring.ts # Recency decay, hybrid scoring, cosine similarity
└── id.ts # nanoid generationTech stack
TypeScript + tsup (ESM, Node 22)
better-sqlite3 + Drizzle ORM for structured storage
sqlite-vec for vector similarity search
SQLite FTS5 for full-text search
@huggingface/transformers for local embeddings (ONNX)
@modelcontextprotocol/sdk for the MCP server
Vitest for testing
License
MIT
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.
Latest Blog Posts
- 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/smankoo/local-memory-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server