I asked Claude to work with my notes. It couldn’t.
There is no Obsidian connector. My options were linking a desktop session to the laptop that holds the vault, or pasting notes into the chat one by one.
But an Obsidian vault is just a folder of markdown files. Anything that can read a folder can serve it. And I already had a home server doing nothing most of the day.
So I built a small MCP server. Claude can search and read every note in my vault, and write only inside one Claude/ folder. This post is how it got there, including the versions that didn’t survive.
I built it pairing with Claude. Which is a slightly strange experience: the thing I was giving access to was helping design its own guardrails.
Should I Even Build This?
Honestly, the “Obsidian MCP server” niche is crowded. When I looked in October there were at least five: a few on GitHub and npm, a plugin that runs one inside Obsidian, and one in Docker’s MCP catalog. Someone launching yet another one on the Obsidian forum opened by saying most of them are unmaintained or overly complicated.
So “Obsidian in Docker” on its own is a tutorial, not a project.
What made it worth doing anyway: almost all of them need the Obsidian desktop app running, with the Local REST API plugin enabled. I wanted something headless. A synced vault on a server, no app anywhere, reachable by any MCP client on my network.
Two Containers and a Folder
The whole thing is two small containers sharing one folder of markdown files.
obsidian-syncruns Obsidian Headless, Obsidian’s own command-line client for Sync. It keeps./vaulton the server identical to the vault on my laptop and phone.vault-mcpis a Python FastMCP server. It reads the same folder and serves MCP over HTTP athttp://server:8765/mcp, on my home network only.
My first idea was running the real Obsidian app in a container and putting an MCP bridge in front of its REST plugin. That works. It’s also a full desktop app you use through a browser, that only serves while it’s open. Obsidian Headless made it unnecessary. Its docs even list giving agents access to a vault, without giving them your whole computer, as a use case.
There’s no tunnel, on purpose. claude.ai calls connectors from Anthropic’s cloud, so it can’t see server:8765. Claude Code is different. It runs on my laptop and makes the calls from there, so the home network is enough.
Claude Doesn’t Live on Your Server
There’s no Claude in the vault-mcp container, and there doesn’t need to be. The server knows nothing about models. Claude only sees my notes when it asks for them.
The model runs in Anthropic’s cloud. Claude Code on my laptop asks my server which tools it has, the model picks one, and Claude Code makes the HTTP call. My server just runs plain Python and returns text.
The easiest way to think about it: MCP is FastAPI for LLMs. FastMCP turns a function’s name, docstring and type hints into a JSON schema:
@mcp.tool
async def recent_notes(n: int = 10) -> list[str]:
"""The n most recently changed notes in the vault, newest first."""
The model never sees the function body. Only the name, the docstring and the parameters. That has two consequences that shaped everything after:
- The docstring is the whole manual. Which tool the model picks, and how, depends on names and descriptions. They are prompts.
- The docstring enforces nothing. Writing “only write in your own folder” in a description proves nothing. The model can send any path it likes. The code has to decide what is reachable.
A Search Tool an LLM Can Actually Use
The smallest working search tool is five lines. Loop over every .md file, return the paths that contain the query.
It works. It’s also a poor tool, because what a tool returns is all the model has to work with. Five changes made it useful:
- Snippets, not just paths. With filenames only, the model has to open every hit to see if it’s relevant. A short snippet lets it pick the right note straight away.
- All words, not the exact phrase.
"sync conflict"should match a note that mentions both words, even when they’re not side by side. - Match the path too. A query like
"work meeting"should findWork/meeting notes.md. Folder names carry meaning in a vault. - A limit. If 400 notes contain “data”, returning all of them floods the context window. Cap it.
- Skip
.obsidian/and.trash/. Plugin config and deleted notes never belong in results.
And one sentence in the docstring that does a lot of work: “Open a result with read_note.” Tell the model what to do next and it stops guessing.
An empty query lists the most recently changed notes. That turned out to be my favourite feature. It doubles as “what have I been working on?”
I Said Prefix, I Meant Folder
Reading is safe-ish. Writing to my second brain is where it gets serious.
My requirement was simple: Claude may create notes, and I must be able to see at a glance which ones it created. So the first version only allowed filenames starting with claude-. The server added the prefix itself, so the model couldn’t forget it.
It worked. And testing found a leak. A symlink called claude-link.md pointing at one of my own notes was refused by read_note, but search_notes read straight through it and would have shown my note in a snippet.
Then I realised I had said “prefix” but meant a directory.
A folder turned out to be simpler. Every write path is resolved first, then checked:
p = (VAULT / rel.parent / f"{rel.name}.md").resolve()
if not p.is_relative_to(WRITE_ROOT):
raise ToolError("You can only write inside the 'Claude/' folder. "
"Use a path like 'Claude/meeting summary'.")
Small lines, a few lessons:
- Resolve before you check.
.resolve()turns../../etc/passwdor a symlink into its real target. Then you check that. is_relative_to, notstartswith. A string check on/vault/Claudealso lets a neighbouringClaudette/folder through. My test vault has aClaudette/folder just to prove it.- The error says what to do instead. “Use a path like…” lets the model fix itself on the next call instead of giving up.
The folder version was too strict, though. Claude could only see its own notes. What I actually wanted was asymmetric: read the whole vault, write only in Claude/. So reading got a looser check (inside the vault, not in .obsidian/ or .trash/), and writing kept the strict one on top.
Docker Says No Too
The code check is the first wall. The second is two lines of YAML:
volumes:
- ./vault:/vault:ro # everything, read-only
- ./vault/Claude:/vault/Claude # Claude/ writable on top
The whole vault is mounted read-only. Only Claude/ is mounted again, writable, on top. Even if my path check has a bug, the operating system refuses the write. I tested that directly by writing to the mount and skipping the server code entirely.
One line of config for a second, independent guarantee. That’s a good deal.
My original request was actually “search and read everywhere on my machine”. I scoped that down to the vault. Read access to the whole server would also expose ~/secrets/, with the keys of every stack on it. That’s not a tool I want an LLM to have.
One Key, and Where I Left It
Every request needs a secret key, sent as a bearer token. Two choices I’m happy with:
- Fail closed. No key, or one shorter than 32 characters, and the server refuses to start. There’s no “no auth” switch to forget about.
- Constant-time comparison.
hmac.compare_digesttakes the same time whether the first or last character is wrong, so nobody can guess the key from response times.
It’s plain HTTP, so the key is the only protection. Fine on a home network with my own devices. Not fine on the internet, which is why this one never goes on my Cloudflare Tunnel.
And then I pasted the full claude mcp add command, key included, into my daily note.
Which is now readable by… the MCP server.
Rotate your keys. Keep them out of your vault.
Check the Disk, Not the Reply
Every guarantee above only counts if something tries to break it. So I tested against a fake vault, where almost every file is a trap:
- a stand-in for one of my notes, that must never change
- the
Claudette/folder next toClaude/ - a symlink inside
Claude/pointing at my note - a symlink pointing outside the vault
- notes in
.obsidian/and.trash/ - a file next to the vault, as a target for
../tricks
The tests use FastMCP’s own client, so they send the same messages Claude does.
The most useful habit: after the tool calls, read the files back. A reply doesn’t prove what happened on disk. In the prefix version, “overwrite my note” returned no error. It returned a path. Only listing the files showed it had created a new claude- note next to mine. Correct, as it happens. But the reply alone couldn’t tell me that.
Besides the symlink leak, the tests caught a trailing slash (Work/ quietly wrote a file called Work.md) and symlinks showing up as duplicate search results.
What I Actually Use It For
Mostly, it’s my study buddy.
- A review after every lesson. When I finish a lesson, I ask Claude to read what I wrote that day and check it. It flags what’s wrong or oversimplified while the lesson is still fresh, not months later when I’m relying on that note.
- Searching my own brain. “Did I write anything about MMR?” Ten seconds later I have my own note, in my own words, instead of a generic explanation from the internet.
- Scattered notes, one summary. A course assignment ended up spread over six notes: one per lesson. Claude read them all and wrote one note with the complete flow, linked back to the originals. In
Claude/, of course. - Notes that talk back. In the middle of a lesson I wrote: “if you read this AI then remind me to think about token use vs this extra llm step”. The next time Claude read that note, it did exactly that.
It writes blog drafts from my notes too, following a style guide that is itself a note.
My notes stay where they are, and Claude’s work lands somewhere I can see it.
What’s Still Open
Right now it’s deliberately plain. Three tools, keyword search, a key on the home network. Next up:
- claude.ai and my phone. That needs a public HTTPS address and real login, not a key in a header.
- Better search. Keyword search won’t connect “hypotheek” to a note that only says “mortgage”. A SQLite full-text index, then embeddings.
- Obsidian-shaped tools. Backlinks, tags, appending to today’s daily note. That’s what makes it an Obsidian server instead of a markdown-folder server.
- Notes are untrusted input too. Web clippings and pasted emails end up in the model’s context. A note can contain instructions aimed at the model. Writing to one folder keeps the blast radius small, but I’ll keep it in mind before adding more powerful tools.
Two Things I’m Taking With Me
The docstring is the interface. The code is the boundary. Descriptions decide how well the model uses a tool. Path checks decide what it can reach. Never let the first do the job of the second.
Check the disk, not the reply. A tool call that “succeeds” can still have done the wrong thing.
Every step in this project gave Claude a bit more access, and every step came with its own check.
And yes, Claude helped write this post. From the Claude/ folder.
Evert