mdvault-mcp
Supports Logseq Markdown note collections by exposing search, link-following, backlink graph, and safe rename/refactor operations over the underlying note files.
Provides tools for working with folders of Markdown notes, including parsing frontmatter, indexing and ranked search, parsing wikilinks and Markdown links, building a backlink graph, and safely renaming notes while rewriting incoming links.
Enables AI agents to operate on an Obsidian-style Markdown vault, supporting note search, link and backlink traversal, and safe note renames that preserve file contents and update links.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mdvault-mcp: The Hard Way
Build an MCP server that lets an AI agent work with a folder of markdown notes: search it, follow its links, and safely rename a note while every link to it is rewritten. You start with a text file and end with an agent refactoring a vault. No Obsidian, no framework doing the hard parts for you. Every line explained.
At the end you will have built a small version of mdvault-mcp yourself, and you will understand the two things most MCP tutorials skip: how to edit files you don't own without damaging them, and how to design tools and errors for an agent.
Why This Exists
Most MCP tutorials stop at a weather API. The hard parts of a useful server are elsewhere:
parsing a messy human format (YAML frontmatter, two link syntaxes, Turkish file names) without losing information;
ranking search results so the right note comes first;
making writes safe: confined to one folder, atomic, never a surprise overwrite, line endings preserved;
refactoring across many files and proving you didn't break anything;
failing in ways that tell the agent what to do next.
A folder of notes exercises all of it, and it is something people actually own and care about.
Related MCP server: mcp-notes-server
Who This Is For
Developers who built a "hello world" MCP server and want a real one.
Anyone who keeps notes in Obsidian, Logseq or plain Markdown and wants an agent in the loop.
Anyone curious how a safe multi-file rename works.
Prerequisites: Python and regular expressions. Nothing else; pip install -r requirements.txt.
Modules
# | Module | What You'll Build |
01 | Split YAML off a note, parse the useful subset with line-numbered errors, edit a value without touching another byte | |
02 |
| |
03 | Parse once, cache by mtime, diacritic-folding tokenizer, BM25 checked against a hand calculation | |
04 | Resolve links to notes, report ambiguity instead of guessing, backlinks, broken links, orphans | |
05 | Path confinement incl. symlinks and junctions, atomic writes, CRLF/BOM preservation, exact-once edits | |
06 | Plan, dry-run, apply; rewrite every link form; verify by re-parsing the whole vault | |
07 | Six tools over stdio, errors as instructions, tests over a real MCP connection |
Each module contains:
README.md: the concepts and the design decisions, and why;a code file (
frontmatter.py,links.py,index.py,graph.py,safeio.py,rename.py,server.py) that later modules import;main.py: runs the module against a real vault and checks the results withassert;break-it.md: challenges that break your own code, with hints.
How To Use This Course
Option A: Build along. Read each README, type the code file yourself, run main.py
to see whether you got it right, then do the break-it challenges.
Option B: Reference. Modules build on each other by importing the previous code files
(each main.py sets up its own path), so jump to the module you need and read its file.
Option C: Use the finished tool. uvx mdvault-mcp --vault ~/Notes is what Module 07
grows into.
Run It
Everything runs against sample-vault/: eleven small notes with every case the
course cares about: two notes with the same name, a CRLF note, a Turkish file name, a
note with broken frontmatter, an image embed, links inside code blocks, and a hidden
.obsidian folder. Modules that write do so on a temporary copy.
pip install -r requirements.txt
python 03-index-and-ranking/main.pyEvery Module Is Verified
python verify.pyruns each main.py (and Module 07's pytest file, over a real stdio MCP connection) and
fails if any assertion fails. CI runs it on Linux, macOS and Windows on every push and
weekly, so the code in this course can't silently stop working.
Architecture Overview
AI agent (Claude Code, Claude Desktop, ...)
| MCP over stdio: JSON-RPC tool calls <- Module 07
v
+--------------------------------------------------------+
| MCP server: tools, error design | <- Module 07
| +-- rename: plan / dry run / apply / verify | <- Module 06
| +-- safeio: confine, atomic write, EOL, edits | <- Module 05
| +-- graph: resolve links, backlinks, ambiguity | <- Module 04
| +-- index: parse once, cache, BM25 | <- Module 03
| +-- links: [[wiki]] and [md](links), spans, tags | <- Module 02
| +-- frontmatter: split, parse, splice | <- Module 01
+--------------------------------------------------------+
|
v
a folder of .md filesLicense
MIT
Windows note: the modules print Turkish note names. If a module crashes with a UnicodeEncodeError when you run it by hand, set PYTHONIOENCODING=utf-8 (or use python -X utf8 main.py). erify.py does this for you.
This server cannot be deployed
Maintenance
Related MCP Connectors
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Markdown notes in folders, with files, that your AI assistant can read, write and organise.
Markdown notes in folders, with files, that your AI assistant can read, write and organise.
Search, read, and safely update Markdown notes in your connected Phasoric knowledge vaults.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with a local folder of Markdown notes, supporting listing, reading, searching, creating, and appending to notes with strict security boundaries.5MIT
- AlicenseAqualityBmaintenanceProvides an AI agent with a searchable markdown notes vault, offering tools to create, read, list, search, update, and delete notes stored as plain .md files.6MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to semantically search and retrieve content from a local Markdown vault. Provides tools for fetching specific notes and finding related ones via embeddings and wikilinks.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search, read, and navigate a folder of Markdown notes as a knowledge base, with full-text search, backlinks, tags, metadata, and note resources for conversation attachment.1MIT