Skip to content

Web · devops · AI · 2026

Personal Knowledge MCP.

A self-hosted MCP server that lets Claude, ChatGPT, Claude Code and Codex read my Markdown notes after a passkey sign-in. Agents can propose edits only as GitHub pull requests that I review.

Timeline
Nov 2026 — Dec 2026
Category
Web · devops · AI
Stack
TypeScript · SQLite
Links
GitHub
Personal Knowledge MCP cover
On this page
  1. 01The problem
  2. 02The solution
  3. 03How it works
  4. 04Edits go through review
  5. 05Making four apps agree
  6. 06Architecture
  7. 07Design decisions
  8. 08Outcome
  9. 09Tech stack

The problem

Every AI tool I use starts from zero. Claude, ChatGPT and my coding agents each keep their own memory, so I kept re-explaining my background, my projects and how I like code written. Writing a CV or updating this portfolio meant pasting the same facts into a new chat each time.

What if every AI app I use could read the same notes, written by me, and none of them could quietly rewrite them?

The solution

Personal Knowledge MCP is a small self-hosted Model Context Protocol server. My notes are plain Markdown in a private GitHub repository. The server indexes them and lets Claude.ai, ChatGPT, Claude Code and Codex search and read them after a passkey sign-in. Agents can suggest edits, but only as pull requests that I review and merge.

4

AI apps reading the same notes

5

MCP tools: four read, one propose

1

owner account accepted

~90 s

from a merged edit to a searchable note

graph
graph

It's built for one person, one VPS and one domain. I started it as a private codebase with Obsidian LiveSync, CouchDB and a signed-approval CLI, then rebuilt a simpler version around Git once I saw which parts I actually used. The simpler one is what runs today.

How it works

  1. 01WriteNotes are Markdown with optional frontmatter: type, visibility and tags. I edit them in Obsidian and push to Git.
  2. 02SyncA sidecar container clones the private notes repository every 60 seconds with a read-only token. A failed pull keeps the last good copy.
  3. 03IndexThe server builds a SQLite FTS5 full-text index and a wikilink graph from the notes. The index is disposable; the Markdown is the source of truth.
  4. 04AskAn AI app calls search_notes, read_note, get_related_notes or get_profile_context and gets source excerpts with paths and revision hashes.

The server never runs a model. It returns my own notes with their sources, and the client's model does the writing, so every answer traces back to a specific note and revision.

Edits go through review

Reading is the default. Writing is opt-in and indirect: an agent calls propose_note_change, and the server opens a pull request on the notes repository. Nothing changes until I merge it.

review
review

What a proposal must carry

  • The revision from the agent's last read_note, so a stale edit is refused instead of overwriting newer text
  • A path inside the vault; traversal and hidden files are rejected
  • The full new note body; existing frontmatter is kept

What limits it

  • A separate GitHub token scoped to the notes repository only
  • 20 proposals per hour, 256 KiB each
  • The agent's reason is confined to a code block in the PR body, so it can't pass as my own text
  • No delete tool exists

Making four apps agree

Connecting one client was easy. Connecting four was the real work, because each one handles OAuth a little differently:

Codex

loopback callbackpre-registered public client

Claude Code

requests offline_access for refresh tokens

Claude.ai

hosted connector with its own client

ChatGPT

adds identity scopes that change the token audience

ChatGPT's extra scopes made Pocket ID add the issuer as a second token audience, which the server rejected. Instead of dropping the audience check, I accepted exactly two shapes, [resource] or [resource, issuer], and added tests that still reject every other combination.

A second bug only showed up end to end: Pocket ID sometimes issues one-hour tokens that span 3,601 seconds, which my lifetime check refused. A small clock tolerance and a regression test fixed it.

Architecture

Edge

  • Traefik on one hostname with automatic HTTPS and an HTTP→HTTPS redirect
  • Per-IP rate limits on the login routes and on /mcp

Identity

  • Pocket ID for passkey sign-in, issuing OAuth tokens with PKCE
  • A one-time setup service creates the owner group, the API resource and ready-made clients for all four apps through Pocket ID's admin API
  • Its admin key is removed after setup and never reaches the MCP server

MCP server

  • TypeScript on Node 24 with the official MCP SDK over Streamable HTTP
  • Validates issuer, audience, owner, scope knowledge:read and token lifetime with jose
  • Zod schemas for tool inputs and note frontmatter

Notes

  • A git sidecar keeps a shallow clone; the server mounts it read-only
  • SQLite FTS5 search and a link graph rebuilt from the Markdown

Design decisions

Git instead of a sync database. The first version mirrored an Obsidian vault through LiveSync and CouchDB, with a supervised sync process I had to pause before applying approved edits. Git already gave me history, review and a merge button. Moving to a Git repository removed CouchDB, the sync coordination code and my own approval CLI, and pull requests replaced all three.

Hardened containers. Every service runs with a read-only filesystem, dropped capabilities, no new privileges, and memory and process limits.

Deployable on Coolify without secrets at build time. Coolify interpolates variables while it builds, so I made the Compose file build without any runtime values and report missing settings when the stack starts.

Outcome

The server runs on my VPS, and all four apps read the same notes. When I ask any of them for a CV, a cover letter or a project write-up like this one, they start from my notes instead of from zero.

One source of context, in plain Markdown I own, readable by every AI app I use and editable only through my review.

I'm preparing the rebuilt version as an MIT-licensed open-source repository with setup guides for Coolify and plain Docker.

Tech stack

LayerTechnology
ServerTypeScript, Node.js 24, MCP TypeScript SDK (Streamable HTTP)
ValidationZod, jose
SearchSQLite FTS5 (Node built-in)
IdentityPocket ID, OAuth with PKCE, passkeys
InfrastructureDocker Compose, Traefik, Coolify
NotesObsidian, Git, GitHub API
Testingnode:test