{
  "markdown": "<div align=\"center\">\n\n# 📚 codewiki-mcp\n\n**MCP server for codewiki.google — search, fetch docs, and ask questions about any open-source repo**\n\n[![CI](https://github.com/izzzzzi/codewiki-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/izzzzzi/codewiki-mcp/actions/workflows/ci.yml)\n[![Release](https://github.com/izzzzzi/codewiki-mcp/actions/workflows/release.yml/badge.svg)](https://github.com/izzzzzi/codewiki-mcp/actions/workflows/release.yml)\n[![npm version](https://img.shields.io/npm/v/codewiki-mcp.svg?style=flat&colorA=18181B&colorB=28CF8D)](https://www.npmjs.com/package/codewiki-mcp)\n[![npm downloads](https://img.shields.io/npm/dm/codewiki-mcp.svg?style=flat&colorA=18181B&colorB=28CF8D)](https://www.npmjs.com/package/codewiki-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat&colorA=18181B&colorB=28CF8D)](LICENSE)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue?style=flat&colorA=18181B&colorB=3178C6)](https://www.typescriptlang.org/)\n[![Node.js](https://img.shields.io/badge/Node.js-ESM-green?style=flat&colorA=18181B&colorB=339933)](https://nodejs.org/)\n\n[🇷🇺 Русский](README.ru.md) | **🇬🇧 English**\n\n<br />\n\n*MCP server that connects any AI assistant to [codewiki.google](https://codewiki.google) — AI-generated wiki documentation for open-source repositories.*\n\n</div>\n\n---\n\n## 📖 Overview\n\n**codewiki-mcp** is a [Model Context Protocol](https://modelcontextprotocol.io/) server that gives AI assistants access to **codewiki.google** — a service that generates comprehensive wiki documentation for any GitHub repository. Search repos, fetch full docs, or ask natural-language questions — all through MCP.\n\n---\n\n## ✨ Features\n\n| Feature | Description |\n|---------|-------------|\n| 🔍 **Search Repos** | Find repositories indexed by codewiki.google |\n| 📄 **Fetch Wiki Docs** | Get full markdown or structured pages for any repo |\n| 💬 **Ask Questions** | Natural-language Q&A with conversation history |\n| 🧠 **NLP Repo Resolution** | Type naturally — wink-nlp extracts keywords and resolves to `owner/repo` |\n| 📡 **Multiple Transports** | stdio (default), Streamable HTTP, SSE |\n| 🔄 **Retry with Backoff** | Automatic retries with exponential backoff on 5xx errors |\n| 🐳 **Docker Support** | Multi-stage Alpine build |\n| 📊 **Response Metadata** | Byte count and elapsed time on every response |\n\n---\n\n## 🚀 Quick Start\n\n### Using npx (no install)\n\n```bash\nnpx -y codewiki-mcp@latest\n```\n\n### From source\n\n```bash\ngit clone https://github.com/izzzzzi/codewiki-mcp.git\ncd codewiki-mcp\nnpm install\nnpm run build\n```\n\n### Transports\n\n```bash\n# stdio (default)\nnode dist/cli.js\n\n# Streamable HTTP\nnode dist/cli.js --http --port 3000\n\n# SSE\nnode dist/cli.js --sse --port 3001\n```\n\n### 🐳 Docker\n\n```bash\ndocker build -t codewiki-mcp .\n\n# stdio\ndocker run -it --rm codewiki-mcp\n\n# HTTP\ndocker run -p 3000:3000 codewiki-mcp --http\n\n# with environment variables\ndocker run -p 3000:3000 \\\n  -e CODEWIKI_REQUEST_TIMEOUT=60000 \\\n  -e CODEWIKI_MAX_RETRIES=5 \\\n  -e GITHUB_TOKEN=ghp_your_token \\\n  codewiki-mcp --http\n```\n\n---\n\n## 🔧 MCP Client Configuration\n\n<details>\n<summary><b>Cursor</b></summary>\n\nAdd to `.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"codewiki-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"codewiki-mcp@latest\"]\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>Claude Desktop</b></summary>\n\nAdd to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"codewiki-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"codewiki-mcp@latest\"]\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>Claude Code</b></summary>\n\n```bash\nclaude mcp add codewiki-mcp -- npx -y codewiki-mcp@latest\n```\n\n</details>\n\n<details>\n<summary><b>Windsurf</b></summary>\n\nAdd to your Windsurf MCP config:\n\n```json\n{\n  \"mcpServers\": {\n    \"codewiki-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"codewiki-mcp@latest\"]\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>VS Code (Copilot)</b></summary>\n\nAdd to `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"codewiki-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"codewiki-mcp@latest\"]\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>Local development</b></summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"codewiki-mcp\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/codewiki-mcp/dist/cli.js\"]\n    }\n  }\n}\n```\n\n</details>\n\n---\n\n## 💡 Usage\n\nPrompts you can use in any MCP-compatible client:\n\n```\ncodewiki fetch how routing works in Next.js\n```\n\n```\ncodewiki search state management libraries\n```\n\n```\ncodewiki ask how does React fiber reconciler work?\n```\n\nFetch complete documentation:\n\n```\ncodewiki fetch vercel/next.js\ncodewiki fetch https://github.com/fastify/fastify\n```\n\nGet structured pages:\n\n```\ncodewiki fetch pages tailwindlabs/tailwindcss\n```\n\nAsk with natural language:\n\n```\ncodewiki ask fastify how to add authentication?\n```\n\n---\n\n## 🛠️ MCP Tools\n\n### 🔍 codewiki_search_repos\n\nSearch repositories indexed by codewiki.google.\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|:--------:|---------|-------------|\n| `query` | string | ✅ | — | Search query |\n| `limit` | number | — | 10 | Max results (1–50) |\n\n### 📄 codewiki_fetch_repo\n\nFetch generated wiki content for a repository.\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|:--------:|---------|-------------|\n| `repo` | string | ✅ | — | `owner/repo`, GitHub URL, or natural-language query |\n| `mode` | string | — | `\"aggregate\"` | `\"aggregate\"` — full markdown; `\"pages\"` — structured JSON |\n\n### 💬 codewiki_ask_repo\n\nAsk a natural-language question about a repository.\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|:--------:|---------|-------------|\n| `repo` | string | ✅ | — | Repository identifier (same formats as fetch) |\n| `question` | string | ✅ | — | Question about the repo |\n| `history` | array | — | `[]` | Conversation history `[{role, content}]` (max 20) |\n\n---\n\n## 📊 Response Format\n\n<details>\n<summary><b>✅ Success — Search</b></summary>\n\n```json\n{\n  \"query\": \"fastify\",\n  \"count\": 1,\n  \"items\": [\n    {\n      \"fullName\": \"fastify/fastify\",\n      \"url\": \"https://github.com/fastify/fastify\",\n      \"description\": \"Fast and low overhead web framework\",\n      \"avatarUrl\": \"https://avatars.githubusercontent.com/u/24939....\",\n      \"extraScore\": 555\n    }\n  ],\n  \"meta\": {\n    \"totalBytes\": 12500,\n    \"totalElapsedMs\": 450\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>✅ Success — Fetch (pages mode)</b></summary>\n\n```json\n{\n  \"repo\": \"fastify/fastify\",\n  \"commit\": \"abc123\",\n  \"canonicalUrl\": \"https://github.com/fastify/fastify\",\n  \"pages\": [\n    {\n      \"title\": \"Overview\",\n      \"level\": 1,\n      \"anchor\": \"#overview\",\n      \"markdown\": \"# Overview\\n\\nFastify is a web framework...\",\n      \"diagramCount\": 1\n    }\n  ],\n  \"meta\": {\n    \"totalBytes\": 25000,\n    \"totalElapsedMs\": 1200\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>✅ Success — Ask</b></summary>\n\n```json\n{\n  \"answer\": \"Fastify uses a plugin-based architecture where...\",\n  \"meta\": {\n    \"totalBytes\": 8500,\n    \"totalElapsedMs\": 2300\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><b>❌ Error Response</b></summary>\n\n```json\n{\n  \"error\": {\n    \"code\": \"RPC_FAIL\",\n    \"message\": \"CodeWiki RPC VSX6ub failed with status 404\",\n    \"rpcId\": \"VSX6ub\",\n    \"statusCode\": 404\n  }\n}\n```\n\nError codes: `VALIDATION`, `RPC_FAIL`, `TIMEOUT`, `NLP_RESOLVE_FAIL`\n\n</details>\n\n---\n\n## ⚙️ How It Works\n\n### Data Flow\n\n```\nAI Assistant → MCP protocol → codewiki-mcp → HTTPS → codewiki.google\n                                                            ↓\nAI Assistant ← MCP protocol ← codewiki-mcp ← JSON  ← Google RPC API\n```\n\n### Google Batchexecute RPC\n\ncodewiki.google uses Google's internal **batchexecute** RPC format (not REST, not GraphQL). The client:\n\n1. Builds a POST request with `f.req=...` body\n2. Sends it to `/_/BoqAngularSdlcAgentsUi/data/batchexecute`\n3. Receives a response with XSSI prefix `)]}'\\n`\n4. Parses `wrb.fr` frames and extracts the typed payload\n\nEach tool maps to an RPC ID:\n\n| Tool | RPC ID |\n|------|:------:|\n| 🔍 Search | `vyWDAf` |\n| 📄 Fetch | `VSX6ub` |\n| 💬 Ask | `EgIxfe` |\n\n### 🧠 NLP Repo Resolution\n\nUsers can type natural language instead of `owner/repo`:\n\n```\n\"the fastify web framework\"\n  → wink-nlp extracts keyword \"fastify\" (POS tag: NOUN/PROPN)\n  → GitHub Search API: GET /search/repositories?q=fastify&sort=stars\n  → top result: \"fastify/fastify\"\n  → normalizeRepoInput(\"fastify/fastify\") → URL for codewiki\n```\n\n### 🔄 Retry with Exponential Backoff\n\n| Attempt | Delay |\n|:-------:|------:|\n| 0 | immediate |\n| 1 | 250ms |\n| 2 | 500ms |\n| 3 | 1000ms |\n\n> 4xx errors (client errors) are never retried.\n\n---\n\n## 🖥️ CLI\n\n```\ncodewiki-mcp [options]\n\nOptions:\n  --http           Streamable HTTP transport\n  --sse            SSE transport\n  --port <number>  Port for HTTP/SSE (default: 3000)\n  --endpoint <str> URL endpoint (default: /mcp)\n  --help, -h       Show help\n```\n\n---\n\n## ⚡ Configuration\n\nEnvironment variables:\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `CODEWIKI_BASE_URL` | `https://codewiki.google` | Base URL |\n| `CODEWIKI_REQUEST_TIMEOUT` | `30000` | Request timeout (ms) |\n| `CODEWIKI_MAX_RETRIES` | `3` | Max retries |\n| `CODEWIKI_RETRY_DELAY` | `250` | Base retry delay (ms) |\n| `GITHUB_TOKEN` | — | GitHub token for NLP repo resolution |\n\nYou can also create a `.env` file in the project root:\n\n```\nCODEWIKI_REQUEST_TIMEOUT=60000\nCODEWIKI_MAX_RETRIES=5\nGITHUB_TOKEN=ghp_your_token\n```\n\n---\n\n## 📁 Project Structure\n\n```\nsrc/\n├── cli.ts                  # CLI entry point\n├── server.ts               # Transport setup (stdio/HTTP/SSE)\n├── index.ts                # Library re-exports\n├── schemas.ts              # Zod input schemas\n├── lib/\n│   ├── codewikiClient.ts   # API client with retry + metadata\n│   ├── batchexecute.ts     # Google RPC response parser\n│   ├── repo.ts             # Repo normalization + NLP resolution\n│   ├── extractKeyword.ts   # NLP keyword extraction (wink-nlp)\n│   ├── resolveRepo.ts      # GitHub Search API resolver\n│   ├── errors.ts           # CodeWikiError + formatMcpError\n│   └── config.ts           # Env-based configuration\n└── tools/\n    ├── searchRepos.ts      # codewiki_search_repos\n    ├── fetchRepo.ts        # codewiki_fetch_repo\n    └── askRepo.ts          # codewiki_ask_repo\n```\n\n---\n\n## ❓ Troubleshooting\n\n<details>\n<summary><b>Permission Denied</b></summary>\n\n```bash\nchmod +x ./node_modules/.bin/codewiki-mcp\n```\n\n</details>\n\n<details>\n<summary><b>Connection Refused (HTTP/SSE)</b></summary>\n\n```bash\n# Check if port is in use\nlsof -i :3000\n```\n\n</details>\n\n<details>\n<summary><b>Timeout Errors</b></summary>\n\nFor large repositories, increase the timeout:\n\n```bash\nCODEWIKI_REQUEST_TIMEOUT=60000 node dist/cli.js\n```\n\n</details>\n\n<details>\n<summary><b>NLP Resolution Fails</b></summary>\n\nIf natural-language input doesn't resolve, use explicit format:\n\n```\n# Instead of \"the fastify framework\"\nfastify/fastify\n# or\nhttps://github.com/fastify/fastify\n```\n\nSet `GITHUB_TOKEN` to avoid GitHub API rate limits for unauthenticated requests.\n\n</details>\n\n---\n\n## 🧑‍💻 Development\n\n```bash\nnpm run dev          # stdio with tsx\nnpm run dev:http     # HTTP with tsx\nnpm run dev:sse      # SSE with tsx\nnpm run typecheck    # type check\nnpm run test         # run tests\nnpm run test:watch   # tests in watch mode\nnpm run build        # compile to dist/\n```\n\n---\n\n## 🤝 Contributing\n\nContributions are welcome! Please:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feat/my-feature`)\n3. Use [Conventional Commits](https://www.conventionalcommits.org/) for commit messages\n4. Run `npm run typecheck && npm run test` before submitting\n5. Open a Pull Request\n\n---\n\n## 📄 License\n\n[MIT](LICENSE) © codewiki-mcp contributors\n",
  "bytes": 11870,
  "sha": "8be8d45d2e4df0266465346488241e910795b6d00c02c576bc6b47872efa12bb",
  "repo_slug": "izzzzzi/codewiki-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_izzzzzi_codewiki_mcp_22b9b9e9/readme"
}