llm-wiki-mcp
Serves markdown knowledge bases stored in GitHub repositories, reading and writing pages as git commits via GitHub OAuth or bot tokens.
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.
llm-wiki-mcp
An MCP server that gives every AI client the same markdown knowledge bases (KBs). A KB is a GitHub repo of markdown pages. Every write is one git commit.
Remote: a Cloudflare Worker on the free plan. Streamable HTTP at
/mcp, GitHub OAuth for people, bearer tokens for bots, D1 full-text search.Local: a stdio server for Claude Code and Codex that works on local clones. No database.
Skills: each KB's
skills/<name>/SKILL.mdfolders are served through the MCP Skills extension (SEP-2640). Clients without it call theguidetool.
The contract is docs/SPEC.md.
Already have a Karpathy-style LLM wiki on GitHub?
You keep raw sources, LLM-maintained pages, an index, a log and a schema file (CLAUDE.md or AGENTS.md) in one or more repos. This server can serve them as they are, after a few moves.
Map your parts to the layout. The server reads any
.mdfile in the repo. It writes only inwiki/,documents/, new files insources/,index.mdandlog.md.raw sources →
sources/(read-only once filed)wiki pages →
wiki/(mapdefaults towiki/;projectreadswiki/projects/)index →
index.md. If it is missing,index_entryfails withNOT_FOUND. Create it with one heading per section first.log →
log.md. If it is missing, the firstappend_logcreates it with a# Logtitle.schema file → copy it to
skills/<kb>-guide/SKILL.mdwith frontmattername: <kb>-guideand adescription. The name must equal the folder name. Keep the originalCLAUDE.mdorAGENTS.mdfor local agents.
The page folder is fixed. Pages at the repo root stay readable and searchable, but the server refuses writes there. Move them:
mkdir -p wiki && git ls-files '*.md' | grep -v / | grep -vxE 'index.md|log.md|CLAUDE.md|AGENTS.md|README.md' | xargs -I{} git mv {} wiki/Page header. On every write to
wiki/*.mdthe server checks for# Title,**Summary**:and**Tags**:, then sets**Created**:(new pages) and**Last Updated**:. Old pages without the header stay readable.edit_pageon such a page fails withHEADER_MISSINGuntil the full header,**Created**:included, exists. To backfill, ask your own LLM: "Add the header block from docs/SPEC.md to every page in wiki/ that has none. Keep the body as it is."Binary files. A KB holds markdown only: writes of other files fail with
BINARY_REFUSED. Install examples/hooks/pre-commit in each repo to block new binaries. Move PDFs and images to a local vault folder. Refer to them in text, for example[[vault:scans/lease.pdf]]: the server keeps such a link as plain text, and the localvault_findtool finds the file.Config. One entry per repo.
readsgives one-way read access:"KB_CONFIG": { "kbs": [ { "id": "work", "repo": "owner/work-wiki", "branch": "main", "reads": [] }, { "id": "notes", "repo": "owner/notes-wiki", "branch": "main", "reads": ["work"] } ] }A
notessession can read and searchworkand link[[work:Page]]. Aworksession cannot seenotes.Token. Create a fine-grained GitHub token for only those repos, with Contents: Read and write. Store it:
npx wrangler secret put GITHUB_TOKEN.Index existing pages. Search,
mapandprojectread the D1 index, so fill it once per KB:REINDEX_SECRET=... npm run reindex -- https://mcp.example.com work --all REINDEX_SECRET=... npm run reindex -- https://mcp.example.com notes --allThen copy examples/.github/workflows/reindex.yml into each repo, so every push updates the index.
Connect and test. Connect a client (see Clients). Call
guidewithkb: "notes", thensearchfor the title of a page you know. The first hit must be that page.
Related MCP server: MindOS
Configuration
Name | Where | What |
|
|
|
| vars | Comma-separated GitHub logins that may sign in. |
| vars | Minutes east of UTC for page and log dates. Default |
| secret | Fine-grained token, Contents read and write on the KB repos only. |
| secret | HMAC key for |
| secret | GitHub OAuth App. Optional. |
| secret | 32+ random characters. Signs remembered consent. Optional. |
Without the three OAuth secrets, the Worker serves bot tokens only. /mcp answers 401 to everything else.
The local server reads a JSON file given by --config or LLM_WIKI_CONFIG. Each KB has path (the local clone) instead of repo. See examples/local-config.json. Relative paths and ~ resolve against the config file.
Local setup
npm install
npm run build
node dist/stdio.js --config ~/kb/config.jsonEach write goes to a temp file, is renamed into place, and is committed alone with git commit --only. Other changes in the clone stay uncommitted. The commit trailer is Client: local; set LLM_WIKI_CLIENT to change it. Search scans the files; no database is needed.
Deploy to Cloudflare
You need a Cloudflare account and, for a custom domain, a zone on Cloudflare.
In a public fork, keep your real values out of git. Copy wrangler.jsonc to wrangler.deploy.jsonc (git-ignored), fill that copy, and add -c wrangler.deploy.jsonc to each wrangler command below. The token script reads the same file from WRANGLER_CONFIG=wrangler.deploy.jsonc.
npm install, thennpx wrangler login.npx wrangler d1 create llm-wiki-mcp. Copy the id to<D1_DATABASE_ID>inwrangler.jsonc.npx wrangler kv namespace create OAUTH_KV. Copy the id to<KV_NAMESPACE_ID>.Set
<KB_DOMAIN>(for examplemcp.example.com),KB_CONFIGandALLOWED_GITHUB_LOGINSinwrangler.jsonc. To use theworkers.devURL, deleteroutesanddev.npm run db:migratecreates the tables in D1.Set the secrets:
npx wrangler secret put GITHUB_TOKEN, thenREINDEX_SECRET, and, for OAuth,GITHUB_CLIENT_ID,GITHUB_CLIENT_SECRET,COOKIE_ENCRYPTION_KEY.npm run deploy. Checkcurl https://mcp.example.com/health.Index each KB:
REINDEX_SECRET=... npm run reindex -- https://mcp.example.com <kb> --all.
GitHub OAuth App
GitHub → Settings → Developer settings → OAuth Apps → New OAuth App.
Homepage URL:
https://mcp.example.comAuthorization callback URL:
https://mcp.example.com/callback
Put the client id and a new client secret into the Worker secrets. The flow: the MCP client registers itself, the user sees a consent page, signs in with GitHub, and the Worker checks the login against ALLOWED_GITHUB_LOGINS. Commits from OAuth sessions carry Client: oauth/<login>.
Bot tokens
npm run token -- create nightly # prints kbt_… once
npm run token -- list
npm run token -- revoke nightlyKV stores only the SHA-256 of a token, with {name, scopes: "*", created}. Commits carry Client: bot/<name>. Add --local to work on the wrangler dev state.
Reindex Action
Search reads D1. The server updates D1 after its own writes. Commits made elsewhere (a local clone, the GitHub web editor) reach D1 through POST /reindex. Copy examples/.github/workflows/reindex.yml into each KB repo and set the secret REINDEX_SECRET and the variables LLM_WIKI_URL and LLM_WIKI_KB. The Action sends changed paths (40 at most per call), or all: true for larger pushes. all: true downloads the repo as one tarball.
Clients
Claude Code, remote with a bot token:
claude mcp add --transport http kb https://mcp.example.com/mcp --header "Authorization: Bearer kbt_..."Leave out --header to sign in with OAuth (/mcp in Claude Code starts the login). Local:
claude mcp add kb -- node /path/to/llm-wiki-mcp/dist/stdio.js --config ~/kb/config.jsonClaude app (web, desktop, mobile): Settings → Connectors → Add custom connector. URL: https://mcp.example.com/mcp. Sign in with GitHub when asked.
Codex (~/.codex/config.toml):
[mcp_servers.kb]
url = "https://mcp.example.com/mcp"
bearer_token_env_var = "KB_TOKEN" # remove this line and run `codex mcp login kb` for OAuthCheck a deployment with a bot token. It writes documents/e2e/E2E Test.md and one log line in the work KB:
LLM_WIKI_URL=https://mcp.example.com LLM_WIKI_TOKEN=kbt_... npm run e2eProject context in a code repo
Give each project hub a remote: line in its frontmatter with the git remote URL, for example remote: git@github.com:owner/shop.git. Several remotes are comma-separated. Then add one rule to your global CLAUDE.md or AGENTS.md:
In a code repo, first call the KB tool `project` with `kb: work` and `repo` set to the output of `git remote get-url origin`.project matches repo against remote: first. Without a match, it compares the last path segment with the repo: and remote: values, so a folder path also works. A git worktree has the same remote as its main repo.
Tools
guide, map, search, read, project, backlinks, write_page, edit_page, append_log, index_entry, vault_find. Every tool except vault_find takes kb. Errors start with a code and end with what to do next, for example REVISION_CONFLICT: … Try instead: read the page, merge your change, and write again with the new sha. Details are in the spec.
Skills over MCP (SEP-2640)
The server declares capabilities.extensions["io.modelcontextprotocol/skills"] = {directoryRead: true} and implements:
skills/listandskills/get: entries withuri, verbatimfrontmatter, andresources(uri,sha256:digest, byte size of every file).resources/listandresources/readfor skill files, andresources/directory/readfor skill folders.
A skill at skills/<name>/ in KB work has the URI skill://work/<name>/SKILL.md: the KB id is the path prefix, and the last segment is the skill name. A skill whose frontmatter name differs from its folder name is not served, as the SEP requires.
Where this differs from the full SEP:
skills/listreturns one page. It never setsnextCursor,ttlMsorcacheScope.Nested skills are served as supporting files of the outer skill. They do not get their own entries.
The listing covers the skills of every configured KB. Skills are read-only rules, so one-way KB access applies to the tools, not to skills.
Limits on the free plan
A Worker request may make 50 subrequests.
POST /reindexreads at most 40 paths one by one; more paths use the tarball.A Worker request gets 10 ms of CPU time. A full reindex of a large KB can exceed it. Re-run it, or index in batches of paths.
No Durable Objects: each MCP request builds a new server (stateless streamable HTTP, JSON responses).
Development
npm test # vitest: tools on temp git clones, GitHub with a mocked fetch, D1 on node:sqlite, MCP, Worker routes
npm run typecheck
npm run build # dist/stdio.js
npm run dev # wrangler dev; put secrets and a test KB_CONFIG in .dev.varsLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Knowledge base MCP for AI agents on iknow.dev. Search, read, and maintain via OAuth.
A second brain for your AI agent. Shared memory for your team's AI agents, plus public and private knowledge bases — works with ChatGPT, Claude, Cursor and any MCP client.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Self-hosted AI workspace: semantic RAG document search, long-term memory, and AI chat via MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides cross-device access to a persistent knowledge graph via Cloudflare Workers, enabling memory storage and retrieval through both MCP protocol and REST API with full-text search capabilities.-
- AlicenseNot gradedqualityAmaintenanceLocal-first knowledge base MCP server. Lets AI agents (Claude Code, Cursor, etc.) read and write your personal knowledge base through 20 MCP tools. Zero cloud dependency — all files stay on your machine.707MIT
- AlicenseNot gradedqualityBmaintenanceMCP server that gives AI coding agents a git-backed markdown wiki to read and update, enabling search, read, write, verify, ingest, promote, and lint operations on versioned knowledge documents with schema validation, staleness tracking, and contradiction detection.4MIT
- AlicenseNot gradedqualityCmaintenanceA machine-local, agent-writable knowledge base MCP server that lets coding agents autonomously record and retrieve hard-won operational facts, incidents, and corrections as markdown pages in a git repo, with provenance, talk pages, and search.7 npmMIT