A personal code wiki with MCP server integration for AI agents. Provides searchable documentation across GitHub repositories with curated wiki content.
- GitHub-based indexing: Indexes documentation files from your GitHub repositories
- Web interface: Search and browse wiki content and repo documentation
- Curated wiki: Store reusable patterns, utilities, and snippets
- MCP integration: AI agents can search and retrieve code via MCP tools
- Automatic updates: GitHub Actions rebuilds the index daily or on changes
The web interface at your-site.netlify.app provides:
- Full-text search across wiki documents
- Search across documentation files in GitHub repos (toggle on by default)
- Click-to-edit: Search results link directly to GitHub's edit page
- Category browsing for wiki content
- Repository documentation browser
When you set GITHUB_USERNAME (or GITHUB_REPO_OWNER) and GITHUB_TOKEN, the index builder automatically discovers all your GitHub repositories:
- No manual listing required: All public and private repos are found automatically
- Correct visibility on first build: Public/private status comes directly from GitHub
- Stays in sync: Changes to repo visibility on GitHub are picked up on next build
The wiki/projects/repo-locations.md file is optional - use it only if you need to add local paths or notes to specific repos.
cd web
npm install
GITHUB_USERNAME=your-username GITHUB_TOKEN=$(gh auth token) npm run build:indexThis automatically discovers all repos for your GitHub user and fetches their documentation files.
The indexer finds these documentation file types in your repos:
| Extension | Format |
|---|---|
.md |
Markdown |
.txt |
Plain text |
.rst |
reStructuredText |
.adoc, .asciidoc |
AsciiDoc |
.org |
Org Mode |
-
Fork this repository and deploy to Netlify
-
Your repos are discovered automatically - just set
GITHUB_USERNAMEin environment variables (step 3). Optionally, add local paths or notes towiki/projects/repo-locations.md:### my-project - **Local Path:** `/path/to/my-project` - **Notes:** My personal notes about this project
-
Set environment variables in Netlify Dashboard → Site settings → Environment variables:
Note: These Netlify environment variables are different from GitHub repository secrets (step 5). Netlify vars are used by the web app; GitHub secrets are used by GitHub Actions.
Required:
Variable Description GITHUB_REPO_OWNERYour GitHub username - used for repo discovery AND edit authorization GITHUB_TOKENPersonal access token with reposcope - enables auto-discovery of all your repos. Create at GitHub Developer Settings.Required for editing features:
Variable Description GITHUB_CLIENT_IDGitHub OAuth App client ID GITHUB_CLIENT_SECRETGitHub OAuth App secret SESSION_SECRETRandom 32+ character string for session encryption Optional:
Variable Description GITHUB_REPO_NAMERepository name (default: code-wiki)NETLIFY_ACCESS_TOKENFor Netlify site listing in Quick View NETLIFY_BUILD_HOOKTrigger rebuild after edits PRIVATE_REPO_ACCESSAccess mode for private repos (see below) Generate a session secret:
openssl rand -hex 32
Create a GitHub OAuth App:
- Go to GitHub → Settings → Developer settings → OAuth Apps → New
- Set Homepage URL to your Netlify site URL
- Set Authorization callback URL to:
https://your-site.netlify.app/.netlify/functions/oauth-callback
-
GitHub Actions automatically rebuilds the index:
- Daily at midnight UTC
- When
repo-locations.mdchanges - Or trigger manually from the Actions tab
-
(Recommended) Enable auto-discovery in GitHub Actions - Add a Personal Access Token as a repository secret:
Create the token:
- Go to GitHub Developer Settings → Personal Access Tokens
- Click "Generate new token" → "Generate new token (classic)"
- Give it a descriptive name (e.g., "code-wiki auto-discovery")
- Select the
reposcope (full control) - this is required to discover ALL your repos including private ones - Click "Generate token" and copy it immediately
Verify your token: A correct fine-grained PAT starts with
github_pat_. Classic tokens start withghp_.Add as a repository secret:
- Go to your code-wiki repo → Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
REPO_ACCESS_TOKEN - Value: Paste your token (starting with
github_pat_orghp_) - Click "Add secret"
Why this is needed: The default
GITHUB_TOKENin Actions only has access to the current repository.REPO_ACCESS_TOKENallows the workflow to list ALL your repositories for auto-discovery.Without this secret, GitHub Actions will fall back to using repos listed in
repo-locations.md.
Private repositories are automatically detected and hidden from unauthenticated visitors. When you set GITHUB_REPO_OWNER and GITHUB_TOKEN:
- All your repos (public AND private) are discovered automatically
- Visibility is pulled directly from GitHub - no manual marking needed
- Changes to repo visibility on GitHub sync on next build
Choose an access mode via PRIVATE_REPO_ACCESS env var:
| Mode | Description |
|---|---|
owner-only (default) |
Only the wiki owner (GITHUB_REPO_OWNER) sees private repos |
github-permissions |
Users see private repos they have GitHub access to |
owner-only (recommended):
- Fast - no API calls needed
- Simple - you control visibility via
GITHUB_REPO_OWNER - Best for personal wikis
github-permissions:
- Dynamic - respects GitHub collaborator permissions
- Slower - requires GitHub API calls on each page load
- Best for team wikis where multiple people need access
How it works:
- Public visitors see only public repos (from static
index.json) - When logged in, the app fetches from
/.netlify/functions/full-index - The endpoint filters repos based on the access mode
Troubleshooting: Private repos not appearing when logged in
Open your browser's developer console (F12) and look for the log message:
Loaded full index (owner-only, isOwner: true)
If isOwner: false, your GitHub username doesn't match GITHUB_REPO_OWNER:
- Check
GITHUB_REPO_OWNERin Netlify environment variables - Ensure it matches your GitHub login exactly (case-insensitive)
- Redeploy after changing
The MCP server provides local code search for AI agents like Claude Code.
-
Install dependencies:
cd mcp-server npm install -
Configure environment - Edit
mcp-server/.env:SOURCE_DIRS=/path/to/your/repos,/another/path WIKI_DIR=/path/to/code-wiki/wiki GITHUB_USERNAME=your-username GITHUB_TOKEN=ghp_xxx # Optional, for private repos -
Build the server:
cd mcp-server npm run build -
Configure Claude Code - Add to
.mcp.json:{ "mcpServers": { "code-wiki": { "command": "node", "args": ["/path/to/code-wiki/mcp-server/dist/index.js"] } } } -
Install ripgrep (recommended for fast local search):
brew install ripgrep
| Tool | Description |
|---|---|
search_wiki |
Search curated wiki content |
search_repos |
Full-text search across all repositories |
get_document |
Fetch a wiki document with frontmatter |
get_file |
Fetch any file from any repository |
list_repos |
List all indexed repositories |
list_category |
List wiki category contents |
sync_repos |
Trigger GitHub sync |
wiki/
├── AGENTS.md # Instructions for AI agents
├── personal/ # Personal docs (separate local git repo, gitignored)
│ ├── preferences/ # Tech stack, deployment guides, etc.
│ ├── projects/ # Personal to-do lists, project notes
│ └── snippets/ # Personal code snippets
├── patterns/ # Architectural patterns (public scaffolding)
├── utilities/ # Helper functions (public scaffolding)
├── integrations/ # API connectors (public scaffolding)
├── templates/ # Project starters (public scaffolding)
├── snippets/ # Code snippets (public scaffolding)
└── projects/ # Project docs (public scaffolding + repo-locations.md)
The wiki/personal/ directory holds all your personal documents — things like tech stack preferences, project to-do lists, and code snippets that you don't want in the public open-source repo. It is:
- Gitignored by the parent repo — your personal docs won't be pushed to your fork's public remote
- Its own local git repo — your docs have full version control (history, diffs, branching)
- Automatically indexed — the index builder scans
wiki/personal/and assigns categories based on subdirectory names (e.g.,personal/projects/→ category "projects") - Private by default — all docs in
wiki/personal/are automatically markedvisibility: private, so they only appear behind authentication - Preserved across CI rebuilds — GitHub Actions carries forward personal docs from the previous build
-
Create the directory and initialize a local git repo:
mkdir -p wiki/personal cd wiki/personal git init -
Create subdirectories matching wiki categories:
mkdir -p preferences projects snippets
Subdirectory names map to wiki categories. Use any existing category name (preferences, projects, snippets, patterns, utilities, etc.) or create new ones.
-
Add your personal docs — frontmatter is optional since
wiki/personal/docs default to private:--- title: "My Tech Stack" --- # My Tech Stack Preferences Your content here...
-
Commit in the personal repo:
cd wiki/personal git add -A git commit -m "Add personal docs"
-
Rebuild the index to include your personal docs:
cd web npm run build:indexThen commit the updated index files in the parent repo — this deploys your personal docs to your Netlify site (behind authentication).
wiki/personal/is listed in the root.gitignore, so the parent repo ignores it entirely- The index builder scans
wiki/personal/as a separate wiki root — subdirectory names become categories - All docs found in
wiki/personal/are automatically set tovisibility: private(overridable via frontmatter) - Private docs are excluded from
index.json(public) and only appear inindex-full.json(served behind authentication) - When GitHub Actions rebuilds the index (where
wiki/personal/doesn't exist), it preserves private docs from the previousindex-full.json - The public
_index.mdscaffolding files inwiki/projects/,wiki/snippets/, etc. define category metadata for the web UI — personal docs merge into these categories seamlessly
To make your preference docs available to Claude Code via the MCP server's get_preferences tool:
# Symlink preferences to Claude's standard location
rm -rf ~/.claude/preferences
ln -s /path/to/code-wiki/wiki/personal/preferences ~/.claude/preferencesIf you want to back up your personal docs to a private GitHub repo:
cd wiki/personal
git remote add origin git@github.com:your-username/my-wiki-preferences.git
git push -u origin mainCreate markdown files with YAML frontmatter:
---
title: "API Client Pattern"
tags: ["typescript", "api", "fetch"]
language: "typescript"
updated: "2025-01-27"
---
# API Client Pattern
Your content here...# Watch mode
npm run dev
# Type checking
npm run typecheck
# Test with MCP Inspector
npx @modelcontextprotocol/inspector node dist/index.js