{"id":51196839,"url":"https://github.com/mohith-das/wikimcp","last_synced_at":"2026-06-27T21:08:03.100Z","repository":{"id":351248458,"uuid":"1210184063","full_name":"mohith-das/wikimcp","owner":"mohith-das","description":"Git-backed multi-user wiki MCP server — long-term memory for any AI. Inspired by Karpathy's LLM Wiki pattern.","archived":false,"fork":false,"pushed_at":"2026-06-19T17:28:27.000Z","size":244,"stargazers_count":2,"open_issues_count":20,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-25T04:05:03.690Z","etag":null,"topics":["ai-tools","claude","fastmcp","gitpython","knowledge-base","llm","long-term-memory","mcp","obsidian","open-source","personal-wiki","python","rag-alternative"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/wikimcp/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mohith-das.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-14T06:59:27.000Z","updated_at":"2026-06-19T17:27:06.000Z","dependencies_parsed_at":"2026-06-15T06:03:11.619Z","dependency_job_id":null,"html_url":"https://github.com/mohith-das/wikimcp","commit_stats":null,"previous_names":["mohith-das/wikimcp"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mohith-das/wikimcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohith-das%2Fwikimcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohith-das%2Fwikimcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohith-das%2Fwikimcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohith-das%2Fwikimcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohith-das","download_url":"https://codeload.github.com/mohith-das/wikimcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohith-das%2Fwikimcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34867834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","claude","fastmcp","gitpython","knowledge-base","llm","long-term-memory","mcp","obsidian","open-source","personal-wiki","python","rag-alternative"],"created_at":"2026-06-27T21:08:02.326Z","updated_at":"2026-06-27T21:08:03.094Z","avatar_url":"https://github.com/mohith-das.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI version](https://badge.fury.io/py/wikimcp.svg)](https://pypi.org/project/wikimcp/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# wikimcp\n\n**Long-term memory for AI — a git-backed personal wiki that any AI client can read and write to.**\n\nInspired by [Andrej Karpathy's LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).\n\n---\n\n## Why this exists\n\nMost people's experience with AI and documents is RAG: upload files, the AI retrieves chunks at query time, generates an answer. The AI rediscovers knowledge from scratch on every question. Nothing accumulates.\n\nwikimcp is different. Instead of retrieving from raw documents each time, **the AI incrementally builds and maintains a personal wiki** — a structured, interlinked collection of markdown files. When you discuss a topic, the AI doesn't just respond — it updates topic pages, creates entity entries, cross-references related concepts, and logs what happened. The knowledge is compiled once and kept current, not re-derived every session.\n\n**The wiki is a persistent, compounding artifact.** Cross-references are already there. Contradictions get flagged. The synthesis reflects everything you've ever discussed. It keeps getting richer with every conversation.\n\nYou never write the wiki yourself — the AI writes and maintains all of it. You curate sources, direct the analysis, and ask good questions. The AI does all the bookkeeping — summarising, cross-referencing, filing, and maintenance.\n\n---\n\n## How it works\n\nThree layers:\n\n1. **Raw sources** (`raw/`) — your documents. Articles, papers, notes. The AI reads from these but never modifies them.\n2. **The wiki** (`wiki/`) — AI-generated markdown files. Topic pages, entity pages, chat summaries, the index. The AI owns this layer entirely.\n3. **The schema** (`CLAUDE.md`) — tells the AI how the wiki is structured and what workflows to follow. Delivered automatically at the start of every session via `wiki_info`.\n\nThe AI performs three operations:\n\n- **Ingest** — you drop a source into `raw/`, the AI reads it, extracts key information, creates/updates wiki pages, updates the index and log. A single source can touch 10-15 pages.\n- **Query** — you ask a question, the AI reads the index, navigates to relevant pages, synthesises an answer. Good answers get filed back into the wiki as new pages.\n- **Lint** — periodically health-check for contradictions, orphan pages, stale claims, missing cross-references.\n\nEvery write is auto-committed to git. Full history, branching, and remote sync.\n\n---\n\n## Use cases\n\n- **Personal knowledge** — goals, health, self-improvement, journal entries, article notes. Build a structured picture of yourself over time.\n- **Research** — go deep on a topic over weeks. Read papers, articles, reports. The wiki builds a comprehensive synthesis with an evolving thesis.\n- **Reading a book** — file each chapter, build pages for characters, themes, plot threads. By the end you have a rich companion wiki.\n- **Work** — meeting notes, project decisions, team knowledge. The wiki stays current because the AI does the maintenance nobody wants to do.\n- **Learning** — course notes, concept maps, practice problems. Knowledge accumulates instead of fading.\n\n---\n\n## Quick start\n\n```bash\npip install wikimcp\n```\n\n### Set up the wiki\n\n```bash\n# Default location: ~/llm-wiki\nwikimcp init\n\n# Or pick your own directory\nwikimcp init --wiki-dir ~/my-wiki\n```\n\nThis creates the wiki folder structure, initialises a git repo, and prints a JSON config snippet.\n\n### Connect to Claude Desktop\n\nCopy the printed JSON and paste it into your Claude Desktop config:\n\n**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Linux:** `~/.config/Claude/claude_desktop_config.json`\n\nThe snippet looks like:\n\n```json\n{\n  \"mcpServers\": {\n    \"wikimcp\": {\n      \"command\": \"wikimcp\",\n      \"args\": [\"serve\", \"--wiki-dir\", \"/Users/you/my-wiki\"]\n    }\n  }\n}\n```\n\nRestart Claude Desktop.\n\n### Start using it\n\nOpen a new Claude conversation. The AI will call `wiki_info` at the start and receive the full wiki schema with workflow instructions.\n\nJust have a normal conversation — discuss a topic, share an idea, ask the AI to process a document. At the end of the session, the AI should automatically:\n\n- Create/update topic and entity pages\n- Write a chat summary\n- Append to the activity log\n- Update the index\n\nIf it doesn't do this automatically, tell Claude: **\"update the wiki with what we discussed\"** — or add this to your Claude Desktop system prompt for hands-free operation:\n\n\u003e You have a wiki connected via MCP. Call wiki_info at the start of every conversation. At the end, update relevant wiki pages, write a chat summary, append to the log, and update the index.\n\n### Browse in Obsidian\n\nOpen your wiki folder in [Obsidian](https://obsidian.md/). You'll see every page the AI creates in real time — topics, entities, chat summaries, the index. Use Obsidian's graph view to see how everything connects.\n\n---\n\n## Sync with GitHub\n\nThe wiki is a git repo from the start. To back it up to GitHub:\n\n```bash\ncd ~/my-wiki\ngh repo create my-wiki --private --source=. --remote=origin --push\n```\n\nThen push periodically:\n\n```bash\ncd ~/my-wiki \u0026\u0026 git push\n```\n\nOr set up a cron job to auto-push every 5 minutes:\n\n```bash\n# add to crontab -e\n*/5 * * * * cd ~/my-wiki \u0026\u0026 git push origin main 2\u003e/dev/null\n```\n\n---\n\n## Wiki folder structure\n\n```\n~/my-wiki/\n  CLAUDE.md              ← schema and workflow guide (AI reads this at session start)\n  wiki/\n    index.md             ← master catalog of all pages\n    log.md               ← append-only activity log\n    chats/               ← one page per conversation\n    topics/              ← concept and topic pages\n    entities/            ← people, tools, projects\n  raw/                   ← your source documents (AI never modifies these)\n  .git/                  ← full git history\n```\n\n---\n\n## MCP tools\n\n18 tools exposed to any MCP-compatible AI client.\n\n**Core wiki tools (11):**\n\n| Tool | Arguments | Description |\n|------|-----------|-------------|\n| `wiki_info` | — | Wiki stats + full schema instructions. Called at session start. |\n| `read_index` | — | Read `wiki/index.md` — the master catalog. |\n| `update_index` | `content` | Overwrite `wiki/index.md` and auto-commit. |\n| `write_page` | `path`, `content` | Create or overwrite a wiki page and auto-commit. |\n| `read_page` | `path` | Read a wiki page. |\n| `list_pages` | `subdirectory?` | List all pages (or a subdirectory). |\n| `search_wiki` | `query`, `case_sensitive?` | Hybrid BM25 + vector search when index exists; regex fallback otherwise. |\n| `search_pages` | `query`, `limit?` | Rank wiki pages by relevance and return compact snippets. |\n| `retrieve_context` | `query`, `limit?` | Return contextual snippets from the most relevant pages. |\n| `append_log` | `entry`, `operation?` | Append timestamped entry to `wiki/log.md` and auto-commit. |\n| `delete_page` | `path` | Delete a wiki page and auto-commit. |\n\n**Graph tools (7)** — deterministic and offline (no model calls), see [Page graph](#page-graph--visualization):\n\n| Tool | Arguments | Description |\n|------|-----------|-------------|\n| `get_related` | `page`, `direction?`, `limit?` | Related pages. `out` = pages this page references; `in` = **backlinks**; `both` = labelled. EXTRACTED before INFERRED. |\n| `get_subgraph` | `page`, `depth?`, `max_nodes?`, `direction?` | Bounded neighbourhood (nodes + edges) for **in-chat \"show me the graph around X\"** visualization. Sets a `truncated` flag when capped. |\n| `path` | `page_a`, `page_b`, `max_hops?` | Shortest connection between two pages, reporting each hop's direction and edge type. |\n| `surprising_links` | `limit?` | Likely cross-domain links: inferred-connected, zero shared tags, different sections. |\n| `hubs` | `limit?` | Most-connected pages by degree centrality (distinct in + out neighbours). |\n| `orphans` | — | Zero-edge pages, plus dead-ends (inbound but no outbound). |\n| `wiki_report` | `suggested_questions?`, `write_file?` | Deterministic digest: counts, hubs, orphans, surprising links, recent additions, templated questions. `write_file=true` writes git-tracked `WIKI_REPORT.md`. |\n\nEvery write triggers an auto git commit with author `wikimcp-bot \u003cwikimcp@localhost\u003e`.\n\n---\n\n## Page graph \u0026 visualization\n\nwikimcp builds a **directed page graph** over your wiki — entirely deterministic\nand offline (no embeddings, no model calls). Because edges are directed\n(`source → target`), you get **backlinks** for free: ask \"what references idea\nX?\" and `get_related(X, direction=\"in\")` returns every page that points at it.\n\n**Edges come in two confidence tiers:**\n\n- **EXTRACTED** (author-declared): explicit `[[wikilinks]]` / markdown links, and\n  links under a `## Related` section.\n- **INFERRED** (derived): *title-mention* edges (page B mentions page A's title\n  with no explicit link → `B → A`), guarded so short/common titles like \"Notes\"\n  never explode into a mega-hub; and bidirectional *shared-tag* edges weighted by\n  the number of shared frontmatter tags.\n\n**In-chat visualization.** `get_subgraph` returns a compact, render-ready\n`{nodes, edges}` payload that the AI can turn into a mermaid diagram or SVG on\nthe spot — the backing tool for \"show me the graph around Transformers\".\n\n**Standalone exports** (offline, no CDN, no build step):\n\n```bash\n# Self-contained interactive graph (open the file directly in any browser)\nwikimcp export-graph html --wiki-dir ~/my-wiki      # writes graph.html\n\n# Make the wiki openable as an Obsidian vault (graph view + backlinks)\nwikimcp export-graph obsidian --wiki-dir ~/my-wiki  # writes .obsidian/ config\n```\n\n**Keep it fresh on every commit.** Install a git post-commit hook that\nre-indexes only the changed pages and refreshes any existing `WIKI_REPORT.md` /\n`graph.html`:\n\n```bash\nwikimcp install-graph-hook --wiki-dir ~/my-wiki\n# or refresh manually:\nwikimcp graph-refresh --wiki-dir ~/my-wiki\n```\n\n---\n\n## Server mode (multi-user)\n\nFor teams or hosting wikis for multiple people on a VPS.\n\n### Setup\n\n```bash\n# 1. Install\npip install wikimcp\n\n# 2. Initialise server\nwikimcp server init --dir /data/wikimcp --port 8765\n\n# 3. Add users\nwikimcp add-user alice --dir /data/wikimcp\nwikimcp add-user bob   --dir /data/wikimcp\n\n# 4. Start server\nwikimcp server start --dir /data/wikimcp\n\n# 5. (Optional) Install as system service\nsudo wikimcp install-service --dir /data/wikimcp --port 8765\n```\n\n### What you get\n\n- **MCP endpoint:** `http://host:port/mcp` (bearer-token auth)\n- **Web reader:** `http://host:port/wiki/\u003cusername\u003e` (read-only HTML UI)\n- **Git hosting:** `http://host:port/git/\u003cusername\u003e` (clone/push over HTTP)\n- **Health check:** `http://host:port/health`\n\n### User config\n\nEach user configures their AI client with:\n\n```json\n{\n  \"mcpServers\": {\n    \"wikimcp\": {\n      \"url\": \"https://yourserver.com/mcp\",\n      \"headers\": { \"Authorization\": \"Bearer wikimcp_alice_\u003ctoken\u003e\" }\n    }\n  }\n}\n```\n\n### Auth\n\nBearer token per user. Tokens stored as SHA-256 hashes — never plaintext. Manage with `wikimcp add-user`, `remove-user`, `rotate-token`, `list-users`.\n\n---\n\n## CLI reference\n\n```\nwikimcp init [--wiki-dir ~/llm-wiki]\nwikimcp rebuild-search-index [--wiki-dir ~/llm-wiki]   # full rebuild of the hybrid search index\nwikimcp serve [--wiki-dir] [--transport stdio|http] [--host] [--port] [--allowed-host ...] [--allow-any-host]\n\nwikimcp export-graph html|obsidian [--wiki-dir ~/llm-wiki] [--out PATH]   # graph.html or Obsidian vault\nwikimcp install-graph-hook [--wiki-dir ~/llm-wiki]     # post-commit hook to refresh the graph\nwikimcp graph-refresh [--wiki-dir ~/llm-wiki]          # re-index + refresh artifacts manually\n\nwikimcp server init [--dir /data/wikimcp] [--port 8765]\nwikimcp server start [--dir] [--port] [--host] [--allowed-host ...] [--allow-any-host]\nwikimcp server stop\nwikimcp server status [--dir]\n\nwikimcp add-user \u003cusername\u003e [--dir]\nwikimcp remove-user \u003cusername\u003e [--dir]\nwikimcp list-users [--dir]\nwikimcp rotate-token \u003cusername\u003e [--dir]\n\nwikimcp remote add \u003cusername\u003e \u003cremote-name\u003e \u003cgit-url\u003e [--dir]\nwikimcp remote remove \u003cusername\u003e \u003cremote-name\u003e [--dir]\nwikimcp remote list \u003cusername\u003e [--dir]\nwikimcp remote push \u003cusername\u003e [--remote \u003cname\u003e] [--dir]\n\nwikimcp export \u003cusername\u003e [--format zip|tar] [--out ./] [--dir]\nwikimcp install-service [--dir] [--port]\n```\n\n---\n\n## Transport modes\n\n| Transport | Command | Used by |\n|-----------|---------|---------|\n| stdio | `wikimcp serve` (default) | Claude Desktop, LM Studio, Gemini CLI, Claude Code |\n| HTTP | `wikimcp serve --transport http` | ChatGPT, claude.ai (via ngrok) |\n| HTTP | `wikimcp server start` | All clients (always-on multi-user server) |\n\n### Host header allowlist (HTTP transport)\n\nThe MCP SDK enforces DNS-rebinding protection on the streamable-HTTP transport: by\ndefault it accepts the `Host` header only when it is `localhost` or `127.0.0.1`\n(with any port). Any other host — including `host.docker.internal` from a client\nrunning in a Docker container — is rejected with **HTTP 421 \"Invalid Host header\"**.\n\nTo allow additional hosts, pass `--allowed-host` (repeatable) to `wikimcp serve`\nor `wikimcp server start`:\n\n```bash\n# Allow a LibreChat / Docker client connecting via host.docker.internal\nwikimcp serve --transport http --host 0.0.0.0 --port 8765 \\\n    --wiki-dir ~/llm-wiki \\\n    --allowed-host host.docker.internal --allowed-host 100.85.70.2\n```\n\nOn a fully trusted/isolated network you can disable the check entirely with\n`--allow-any-host`. **Security note:** `--allow-any-host` turns off host/origin\nvalidation completely — only use it behind a firewall or VPN, never on a host\nexposed to untrusted networks.\n\n\u003e **Upgrade note:** Versions before 0.1.5 had a different (and in some\n\u003e deployments hot-patched) host policy. Starting in 0.1.5 the default is\n\u003e localhost-only, so if you connect from a non-localhost client you **must**\n\u003e add `--allowed-host \u003cthat-host\u003e` (or `--allow-any-host`). Operators upgrading\n\u003e an existing deployment must update their launch command — e.g. the systemd\n\u003e `ExecStart`:\n\u003e\n\u003e ```\n\u003e wikimcp serve --transport http --host 0.0.0.0 --port 8765 \\\n\u003e     --wiki-dir /home/ubuntu/wikimcp-data/users/mohith \\\n\u003e     --allowed-host host.docker.internal --allowed-host 100.85.70.2\n\u003e ```\n\n---\n\n## Dependencies\n\n| Package | Purpose |\n|---------|---------|\n| `mcp[cli]` | FastMCP — MCP server framework |\n| `fastapi` | Web reader + HTTP transport |\n| `uvicorn` | ASGI server |\n| `jinja2` | HTML templates |\n| `click` | CLI framework |\n| `gitpython` | Git operations |\n| `rich` | Terminal formatting |\n| `markdown` | Markdown-to-HTML rendering |\n\n---\n\n## Credits\n\nBased on the [LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) by Andrej Karpathy — the idea that LLMs should incrementally build and maintain a persistent wiki rather than re-deriving knowledge on every query.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohith-das%2Fwikimcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohith-das%2Fwikimcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohith-das%2Fwikimcp/lists"}