vault-mcp
by R2Vve2
README.md
# vault-mcp
[](https://github.com/R2Vve2/vault-mcp/actions/workflows/ci.yml)
  
**Give Claude (or Cursor, or any MCP client) your second brain.** An MCP server that turns a folder of markdown notes, including an Obsidian vault, into tools an AI assistant can use: full-text search, reading notes with their backlinks, finding related notes, and safely writing new notes or daily-log entries.
> "What did I decide about the minivec API last week?"
> Claude calls `search_notes`, reads `Daily/2026-11-30.md`, and answers with the decision and the note it came from.
## Tools exposed
| Tool | Read-only | What it does |
|---|---|---|
| `search_notes(query, limit, tag, folder)` | yes | BM25 search over heading-level sections; returns the best section of each note with a snippet |
| `read_note(path)` | yes | Full markdown + tags + outgoing `[[links]]` + **backlinks**; accepts a path or just a note name |
| `list_notes(folder, tag)` | yes | Browse by folder or `#tag` |
| `recent_notes(limit)` | yes | What you have been working on |
| `related_notes(path)` | yes | Ranks notes by links, backlinks, shared tags and text similarity |
| `list_tags()` | yes | Every tag with its count |
| `create_note(path, content, tags)` | no | Creates a note; **never overwrites** |
| `append_to_note(path, text, heading)` | no | Appends, optionally under a new `##` heading |
| `daily_note(text)` | no | Adds a timestamped bullet to `Daily/YYYY-MM-DD.md` |
Plus a resource template `note://{path}` and a `weekly_review` prompt. Tools carry MCP annotations (`readOnlyHint`, `destructiveHint`) so clients can auto-approve reads and ask before writes.
## Install and connect
```bash
pip install git+https://github.com/R2Vve2/vault-mcp
```
**Claude Code**
```bash
claude mcp add vault -- vault-mcp --vault "/path/to/your/notes"
```
**Claude Desktop** (`claude_desktop_config.json`)
```json
{
"mcpServers": {
"vault": {
"command": "vault-mcp",
"args": ["--vault", "C:/Users/you/Documents/Obsidian/MyVault", "--read-only"]
}
}
}
```
Use `--read-only` to hide the three write tools entirely. Try it on the bundled sample: `vault-mcp --vault examples/vault`.
## Design decisions
- **Sections, not files, are the search unit.** Notes are split at headings, so a hit in the "Decisions" section of a long project note is returned with that section's heading and snippet. Each note is reported once, with its best section.
- **BM25 written from scratch** (`vault.py`): no index server, starts instantly, Arabic and German text tokenised correctly, stop words removed.
- **Always fresh.** Every call compares file modification times and re-parses only changed notes, so edits you make in Obsidian are visible on the next tool call.
- **Obsidian-compatible parsing**: YAML front matter (`title`, `tags` as list or inline), inline `#tags`, `[[wikilinks]]`, `[[note|alias]]` and `[[note#heading]]`.
- **Safety first** for an LLM that writes to your disk: every path is resolved and must stay inside the vault (`../`, absolute paths and `.obsidian/`, `.git/` are refused), only note extensions are allowed, creation never overwrites, and read-only mode removes write tools from the tool list instead of merely failing them.
- **Errors are returned, not raised**: the model gets `{"error": "note not found: ..."}` and can recover.
## Tests
`pytest -q` runs 14 tests, including end-to-end calls through a real MCP `Client` connected in-process: tool listing and annotations, search ranking, backlinks, path-traversal attempts, read-only mode hiding tools, live refresh after an external edit, the `note://` resource and the prompt. The server was also exercised over stdio as a subprocess.
## Layout
```
vaultmcp/vault.py parsing, BM25 index, search, backlinks, related notes, safe writes
vaultmcp/server.py MCP server (tools, resource template, prompt) on the official Python SDK
examples/vault/ a small sample vault
```
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues