ai-memory-mcp
Provides optional semantic search over the stored Markdown notes using a local Ollama embedding model, enabling meaning-based retrieval in addition to exact substring search.
Click on "Deploy 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., "@ai-memory-mcpcheck my memory for what we decided about the database"
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.
ai-memory-mcp
English | 繁體中文
Local, Markdown-first shared memory for AI coding agents, served over MCP.
Every session of every tool (Claude Code, Codex CLI, Copilot CLI, ...) starts with amnesia. This gives them one shared place to record decisions, dead ends and handoffs, and to look them up next time, so you stop re-explaining your project.
Status: feature-complete, provided as-is. This is a small tool I use myself. I do not offer support and I am not taking feature requests. Bug reports may go unanswered. Fork it freely (MIT).
Why this one
Plain Markdown is the source of truth. One
.mdfile per memory: readable, greppable, diffable, committable.The index is disposable. SQLite only accelerates search. Delete
index.dband it is rebuilt from your notes.Local and private. No cloud, no account. Optional semantic search uses a local Ollama model.
Any language. Substring search works for Chinese/Japanese/Korean text, not just space-separated words.
Auditable. Every read is logged (who, when, what query; never the results).
Related MCP server: mcp-chest-memory
Install
Requires Python 3.10+.
git clone https://github.com/bargisula/ai-memory-mcp.git
cd ai-memory-mcp
pipx install . # or: pip install .
ai-memory doctor # checks your setupThen register the server with your MCP client. The command is ai-memory-mcp (stdio transport):
# Claude Code
claude mcp add -s user ai-memory -- ai-memory-mcp
# Codex CLI
codex mcp add ai-memory -- ai-memory-mcpAny client that takes a JSON config (for example ~/.copilot/mcp-config.json):
{ "mcpServers": { "ai-memory": { "command": "ai-memory-mcp" } } }If you use uv, you can skip the install and point the client at
uvx --from git+https://github.com/bargisula/ai-memory-mcp ai-memory-mcp instead.
The server ships usage instructions to the client automatically (check the handoff first, record decisions and failures as you go), so no extra prompt file is required.
Tools
Tool | What it does |
| Save a note. |
| Substring search; every word must match. Returns short snippets. |
| Meaning-based search (needs Ollama, see below). |
| Full text of one note. |
| Newest handoff notes with full text. Call first when resuming work. |
| Latest notes of any type. |
| Projects that have notes. |
| Read audit log. |
Pass your own name in llm (for example "Claude") so entries and reads can be attributed.
Where your data lives
Default: ~/.ai-memory/ (override with AI_MEMORY_HOME).
~/.ai-memory/
notes/<project>/2026-01-05-choose-database.md <- the truth. Back this up / put it in git.
index.db <- disposable search index + audit logA note looks like this, and you can write or edit them by hand:
---
project: my-app
type: decision
llm: Claude
tags: database
ts: 2026-01-05T10:20:00+08:00
---
# Use SQLite
Single file, zero setup. Rejected Postgres: no concurrent writers needed.After hand edits, deletions or copying notes from another machine, run ai-memory reindex. (A missing index.db
is rebuilt automatically the first time the server starts.)
Configuration
All optional, all environment variables:
Variable | Default | Meaning |
|
| Data directory |
|
| Allowed note types, comma separated |
|
|
|
|
| Ollama embeddings endpoint |
|
| Embedding model |
Semantic search (optional)
ollama pull nomic-embed-text
ai-memory reindex --embed # embed notes written before Ollama was availableWithout Ollama everything else works; search_memory_semantic simply reports that it is unavailable.
Vectors are compared by brute force in Python, which is fine up to a few thousand notes.
Command line
ai-memory doctor check the installation
ai-memory reindex [--embed] rebuild the index from notes/
ai-memory handoff <project> print the newest handoff (see hook below)
ai-memory search "<words>" keyword search, JSON output
ai-memory audit read audit log, JSON output
ai-memory web [--port N] open the read-only audit page in your browserAudit page
ai-memory web serves a small page at http://127.0.0.1:8765 showing who read what and when, with filters for
caller, project, tool, status and query text. It is read-only, listens on 127.0.0.1 only, refuses requests whose
Host header is not loopback (DNS-rebinding protection), and follows your browser language (English or 繁體中文).
Make handoffs load automatically (Claude Code)
Relying on the model to remember to call get_handoff is fragile. A SessionStart hook guarantees it. In
.claude/settings.json of your project:
{
"hooks": {
"SessionStart": [
{ "hooks": [ { "type": "command", "command": "ai-memory handoff my-app" } ] }
]
}
}Security notes
Project names are restricted to letters, digits,
_,-,.; anything path-like is rejected, so a prompt-injected agent cannot write outsidenotes/.read_memoryis likewise confined tonotes/*.md.Notes are plain text on disk. Do not store secrets in memories.
The audit log stores tool, caller, project and the query text (first 500 characters), never result contents.
Limits (by design)
Single user, single machine. Concurrent writers are safe (files are created exclusively, SQLite runs in WAL mode), but there is no access control and no built-in sync. To sync, keep
notes/in a git repository.No edit or delete tool. Edit or delete the Markdown file, then
ai-memory reindex.Search is substring matching, not fuzzy or ranked by meaning (use the semantic tool for that).
Coming from a private predecessor?
The note format is unchanged: copy your old notes/ folder into AI_MEMORY_HOME and start the server. The index builds itself.
Development
pip install -e ".[dev]"
pytestLicense
MIT. See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.
Portable AI memory shared across models and harnesses - plain markdown you own.
Persistent AI memory shared across Claude, ChatGPT, coding agents, and compatible MCP clients.
Related MCP Servers
- AlicenseAqualityBmaintenanceLocal, searchable project memory for AI coding agents. Markdown source of truth, MCP interface, safe structured updates310Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides a persistent, local-first memory for coding agents over MCP, enabling automatic recall and recording of past work, failures, and decisions to reduce repetition and token usage.MIT
- AlicenseBqualityBmaintenanceLocal-first memory server for AI coding agents that stores work sessions, tasks, and durable memories in Markdown files, exposed through MCP tools for session management and memory retrieval.106 npm1MIT
- AlicenseNot gradedqualityBmaintenanceProvides persistent, local-first memory for coding agents with Markdown as the source of truth, exposed via CLI, loopback API, MCP, and Codex hooks for context retrieval and durable writes.MIT