IntelInlet
Studio journal
Local AI and deployment / / 3 min read

Connect local MCP to Obsidian and test whether the knowledge base can survive a move

Keep Markdown authoritative, scope read tools to one vault and perform an offline query and restore drill.

When a vault moves to another machine, absolute paths and plugin indexes often fail first. Make a test vault with three Markdown notes, one image and one internal link. A successful rebuild should produce the same sourced answer from those files.

Procedure

  1. Give notes stable IDs, dates and topics. Use vault-relative attachment paths. Back up notes, attachments and required configuration; separate derived indexes. Open a note in a plain editor to check that its key information survives without plugin rendering.

  2. Register a local stdio server in an MCP-capable client and pass only the test vault root. Begin with read-only search_notes(query, limit) and read_note(id). Resolve IDs through the index and require each resolved real path to remain within the allowed root.

  3. Ask why the previous export used WebP. Require a relative note path, section title and supporting sentence. Disconnect the network and ask again. For content to stay on the machine, the client’s inference and embedding providers must also run locally.

A minimal read-only server

For a small verification service, use the official Python SDK’s v1 FastMCP interface. Install mcp>=1,<2 in a dedicated environment. Put two UTF-8 notes named exports.md and camera.md in the test vault. Save the script outside it. Set the client’s stdio command to that environment’s Python and pass the absolute script and vault paths as separate arguments.

import sys
from pathlib import Path
from mcp.server.fastmcp import FastMCP

root = Path(sys.argv[1]).resolve(strict=True)
files = {"export": "exports.md", "camera": "camera.md"}
app = FastMCP("studio-notes")

def load_note(note_id: str) -> str:
    path = (root / files[note_id]).resolve(strict=True)
    if not path.is_relative_to(root):
        raise ValueError("Outside vault")
    return path.read_text(encoding="utf-8")

@app.tool()
def search_notes(query: str, limit: int = 5) -> list[str]:
    term = query.strip().casefold()
    if not term:
        return []
    return [k for k in files if term in load_note(k).casefold()][:max(0, limit)]

@app.tool()
def read_note(note_id: str) -> str:
    return files[note_id] + "\n" + load_note(note_id)

if __name__ == "__main__":
    app.run(transport="stdio")

List the two tools, search for a phrase unique to exports.md, then pass its returned ID to read_note. This two-note allowlist exercises discovery, reading and attribution. Replace it with an index of stable note IDs when expanding the vault.

Choosing an approach

Layer Preserve Restore
Sources Markdown, attachments and stable IDs Copy from backup
Derived data Index settings and model revision Rescan and encode
Access tools Launch parameters and permissions Set the new vault root

Check the result

Restore into a different directory, rebuild and repeat three fixed questions. Delete an obsolete test note and index again: stale results should disappear. Keep the drill date and failures with the backup. Long-term portability is a property you can test.

If retrieval repeatedly misses context, use the ten-query top-five test to evaluate segmentation.

Frequently asked questions

Does MCP store the knowledge?

It specifies how clients and servers exchange resources and tool calls. Your storage design owns the notes, index and backups.

Does the model need write access to the whole vault?

Search and retrieval need only read capabilities. For new notes, a dedicated inbox can support a separate human merge step.

References

Related reading