wiki-mcp is a wiki that agents keep up to date themselves. Pages are Markdown in a Git repo. A Cloudflare Worker indexes them into D1 and serves them as a remote MCP server: claude.ai and ChatGPT connect over OAuth 2.1, Claude Code and Codex CLI use a bearer token. KV holds OAuth grants and the login throttle.

I cut it out of a private deployment that grew to about 536 pages and swapped the content for a 12-page demo corpus. So the public history has one commit and starts where the private one ended.

Agents write through proposals

An agent never pushes to main. A write is a whole research cycle committed to an agent/** branch. CI runs lint, invariants, tests and the search eval on that branch with read-only permissions and no secrets, and fails it if it touches anything outside wiki/. The agent then calls check_proposal. If the run for that exact commit is green, the Worker fast-forwards main under a merge lock, and a separate publish job rebuilds the index. If it is red, the agent gets the linter errors back and fixes the cycle.

Dates and authors are set by the server. Models get the date wrong often enough that I stopped trusting them with it.

How search is checked

Retrieval is FTS5 BM25 over heading chunks, plus a structured get_state lookup for “what is the current X” questions. Quality is checked against a golden question set, and CI fails if recall@5 drops below 0.80.

On the private wiki the set had 30 questions and recall@5 was 0.83. The ranking weights were tuned on that same corpus, so treat it as one measurement on one wiki. The demo corpus scores higher, but on 12 pages that number says little about ranking.