Obsidian-vault-backed long-term memory for AI coding agents.
An MCP server that gives any MCP-compatible AI agent (Claude Code, Claude Desktop, Cursor, opencode, goose) persistent, human-editable memory stored as plain markdown files in an Obsidian vault.
- Human-editable memory. When the AI remembers something wrong, open the markdown file in Obsidian and fix it. No vector database mystique, no opaque embeddings — just files.
- Obsidian graph for free. Memories cross-reference each other with wiki-links. Obsidian's graph view shows your AI's knowledge network.
- BYO-LLM. The server stores and retrieves notes. It doesn't call any LLM API. Use it with whatever model you already pay for.
- 5 memory types. User facts, feedback/corrections, project context, reference links, and session handoffs — mirroring the mental model of Claude Code's built-in memory.
Requires Python 3.11+ and uv.
git clone https://github.com/dhawal/memorychat-mcp.git
cd memorychat-mcp
uv syncCreate ~/.config/memorychat/config.toml:
[vault]
path = "/path/to/your/obsidian/vault"
memory_subdir = "_memory"
[search]
backend = "keyword"
[dedup]
similarity_threshold = 0.85
[server]
log_level = "INFO"
log_file = "~/.local/state/memorychat/server.log"Create the memory directory structure in your vault:
cd /path/to/your/obsidian/vault
mkdir -p _memory/user _memory/feedback _memory/project _memory/reference _memory/episodicAdd to ~/.claude/mcp.json:
{
"mcpServers": {
"memorychat": {
"command": "uv",
"args": [
"--directory",
"/path/to/memorychat-mcp",
"run",
"python",
"-m",
"memorychat_mcp"
],
"env": {
"MEMORYCHAT_CONFIG": "~/.config/memorychat/config.toml"
}
}
}
}Restart Claude Code. The server provides 10 tools:
| Tool | Purpose |
|---|---|
memory_search |
Find memories by keyword query with weighted scoring |
memory_recall |
Fetch a single memory by UUID (full body) |
memory_write |
Create a new memory note (with dedup check) |
memory_update |
Update an existing memory (partial updates) |
memory_delete |
Move a memory to trash (recoverable) |
memory_list |
List memories by type/project |
session_start |
Load core memory context for a new session |
session_handoff |
Write a structured session handoff note |
memory_link |
Create bidirectional links between memories |
memory_index_rebuild |
Regenerate the INDEX.md from current notes |
| Type | Purpose | Lifetime |
|---|---|---|
user |
Profile facts (role, expertise, preferences) | Long — survives projects |
feedback |
Corrections ("don't do X", "always do Y") | Long — survives projects |
project |
Project-specific context (goals, blockers) | Medium — lives with project |
reference |
Pointers to resources (URLs, paths) | Long, until resource moves |
episodic |
Session handoff notes | Long — append-only history |
You: Remember that I prefer using type hints in all Python code.
Agent: [calls memory_write(type="feedback", name="Always use type hints", ...)]
--- next session ---
Agent: [calls session_start(project="memorychat")]
Agent: I see from your preferences that you want type hints in all Python code.
The memory file at _memory/feedback/always-use-type-hints.md:
---
id: 7e3b1a4c-...
name: Always use type hints
description: User insists on type hints in all Python functions
type: feedback
created: 2026-04-13T18:42:11Z
updated: 2026-04-13T18:42:11Z
project: null
tags: [python, code-style]
links: []
sessions: []
---
The user has stated that every Python function must include type hints.
They consider untyped code to be incomplete.Open it in Obsidian, edit it, and the next session picks up your changes.
When the user explicitly says "remember this," set confidence to "high":
{
"tool": "memory_write",
"arguments": {
"name": "Prefers dark mode",
"description": "User prefers dark themes across all apps",
"type": "user",
"body": "User prefers dark themes",
"confidence": "high"
}
}High-confidence memories rank above medium and low-confidence ones in search results, regardless of recency. If confidence is omitted, it defaults to "medium".
# Run tests
uv run pytest tests/ -v
# Lint
uv run ruff check src/ tests/
# Type check
uv run mypy --strict src/
# Run the server directly (blocks on stdin)
uv run python -m memorychat_mcpMIT