org-wiki MCP Server
by sharifli4
README.md
# org-wiki
Turn a GitHub organization into a searchable engineering wiki that updates itself when pull requests merge.
Point `org-wiki` at your GitHub org using your existing `gh auth` login. It reads your repositories, builds a plain-Markdown wiki of your APIs, database tables, queues, CI runners, and env var names, indexes everything locally on your machine, and serves a Web UI plus an MCP server for Cursor and Claude Code.
No SaaS account. No cloud vector database. Secret values are never copied.
## What you need
- Python 3.10 or newer (`uv` or `pipx` recommended, plain `python3` works too)
- `git`
- `gh` (GitHub CLI, logged in with `gh auth login`) — or a `GH_TOKEN` environment variable
## Install
One-line install on Linux or macOS (installs both `org-wiki` and `orgwiki` commands):
```bash
curl -fsSL https://raw.githubusercontent.com/sharifli4/org-wiki/main/install.sh | bash
```
Or install directly with `uv` / `pipx`:
```bash
uv tool install git+https://github.com/sharifli4/org-wiki.git
```
```bash
pipx install git+https://github.com/sharifli4/org-wiki.git
```
## Quickstart (Browser Easy Mode)
Create an empty folder for your company's wiki and run `org-wiki` (or `orgwiki`):
```bash
mkdir acme-wiki && cd acme-wiki
org-wiki
```
Open `http://127.0.0.1:8787`.
1. `org-wiki` detects your `gh auth` session and lists every GitHub organization (and personal account) you belong to.
2. Pick your organization and check the repositories you want tracked.
3. Click **Build & Index Wiki**.
`org-wiki` shallow-clones default branches into a temporary folder, writes the Markdown catalogs, builds a local SQLite + ONNX semantic index, and opens the search and Q&A screen.
## Quickstart (Terminal Mode)
If you prefer the command line over the browser wizard:
```bash
mkdir acme-wiki && cd acme-wiki
org-wiki init --org your-github-org
```
Then search or ask questions offline:
```bash
org-wiki search "billing_invoices"
org-wiki ask "Which service publishes invoice events and which table stores them?"
```
## Single-Box Docker Mode
Run the whole app inside one container (includes `git`, `gh`, and the pre-downloaded ONNX embedding model):
```bash
git clone https://github.com/sharifli4/org-wiki.git
cd org-wiki
GH_TOKEN="$(gh auth token)" docker compose up -d
```
Open `http://127.0.0.1:8787`. Everything is stored in `./wiki-data`.
## Connect Cursor & Claude Code (MCP)
Give your AI coding agent direct access to `wiki_search`, `wiki_ask`, `wiki_read_doc`, `wiki_list_docs`, and `wiki_sync`:
```bash
org-wiki mcp --install cursor
org-wiki mcp --install claude-code
```
Or click **Connect IDE (MCP)** in the top bar of the Web UI.
## What gets created in your workspace
```text
acme-wiki/
├── org-wiki.toml # Tracked org, excluded repos, domain groupings
├── INDEX.md # Entry table routing engineers & AI agents
├── 00-infra-and-access/ # Servers, runners, dashboards, open questions
├── 01-system-map/
│ ├── company-overview.md # Cross-repo topology map
│ └── repo-catalog.md # Auto-harvested active & archived GitHub repos
├── 02-runbooks/ # Step-by-step operational guides
├── 03-features/ # End-to-end feature mechanics
├── 04-decisions/ # Architecture Decision Records (ADRs)
├── 05-reference/ # Auto-harvested from code (never hand-edit)
│ ├── http-apis.md # NestJS, Express/Fastify, Next.js, FastAPI/Flask/Django, Go, Spring
│ ├── data-models.md # Prisma, TypeORM/MikroORM/Sequelize, SQLAlchemy/Django, GORM, SQL
│ ├── messaging-and-queues.md # Exchanges, queues, topics, cross-repo mismatches
│ ├── ci-workflows.md # GitHub Actions workflows & runs-on labels
│ └── env-vars.md # Variable names from .env.example (values stripped)
└── .github/workflows/sync-wiki.yml # Keeps the repo updated automatically on GitHub
```
## How auto-sync works on GitHub
`org-wiki` uses a two-speed update model so factual catalogs never hallucinate and architecture prose stays reviewed by humans:
1. **Publish the wiki repo** to your GitHub org:
```bash
org-wiki publish-repo
```
2. **Add `WIKI_ORG_TOKEN`** on `<org>/<wiki-repo>` (read access to org repos + read/write contents and pull requests on `<wiki-repo>`), plus an org secret **`WIKI_DISPATCH_TOKEN`** scoped to `<wiki-repo>`.
3. **Connect your product repositories** (dry-run first, then `--apply` to open onboarding PRs):
```bash
org-wiki connect-repos
org-wiki connect-repos --apply
```
Whenever a PR merges in a connected repository:
- **Job 1 (`harvest-to-main`)** deterministically re-harvests `05-reference/*` and `01-system-map/repo-catalog.md` from GitHub default branches and commits straight to `main`.
- **Job 2 (`draft-feature-pr`)** reads the merged PR diff and opens a human-reviewed PR on `<wiki-repo>` only when feature mechanics, runbooks, system maps, or ADRs changed.
## Commands
Both `org-wiki` and `orgwiki` run the same CLI:
| Command | Description |
| --- | --- |
| `org-wiki` | Start Web UI on `http://127.0.0.1:8787` (setup wizard + search + Q&A + editor) |
| `org-wiki init --org <owner>` | Interactive or non-interactive workspace setup via `gh auth` |
| `org-wiki search "<query>"` | Offline hybrid search (ONNX `BAAI/bge-small-en-v1.5` + SQLite FTS5 BM25) |
| `org-wiki ask "<question>"` | Cited Q&A (synthesizes prose when an LLM is configured, offline hits otherwise) |
| `org-wiki harvest` | Re-harvest routes, tables, queues, workflows, and env var names from GitHub |
| `org-wiki sync` | Pull or re-harvest latest changes and incrementally update the local index |
| `org-wiki index [--force]` | Build or rebuild the local SQLite + ONNX index |
| `org-wiki mcp [--install cursor\|claude-code]` | Run stdio MCP server or register it in your editor |
| `org-wiki publish-repo [--public]` | Create `<org>/<wiki-repo>` on GitHub via `gh` and push |
| `org-wiki connect-repos [--apply]` | Open PRs across org repos installing merge webhooks & AI rules |
| `org-wiki doctor` | Check Python, `gh auth`, `git`, embedding cache, and LLM configuration |
## Optional AI answer synthesis
Search and MCP retrieval run 100% offline with zero API keys. If you also want synthesized prose answers with inline `[path]` citations in `org-wiki ask`, the Web UI, and `wiki_ask`, set any one of these in `.env` or your shell:
- **Anthropic:** `ANTHROPIC_API_KEY=sk-ant-...`
- **OpenAI / compatible:** `OPENAI_API_KEY=sk-...` (optional `OPENAI_BASE_URL=...`)
- **Local Ollama:** `OLLAMA_MODEL=llama3.2` (optional `OLLAMA_HOST=http://127.0.0.1:11434`)
- **GitHub Models (reuses `gh auth`):** `ORGWIKI_USE_GH_MODELS=1`
## Tests
```bash
python3 -m unittest discover -s tests -v
```
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues