๐ codewiki-mcp
MCP server for codewiki.google โ search, fetch docs, and ask questions about any open-source repo
๐ท๐บ ะ ัััะบะธะน | ๐ฌ๐ง English
MCP server that connects any AI assistant to codewiki.google โ AI-generated wiki documentation for open-source repositories.
๐ Overview
codewiki-mcp is a Model Context Protocol 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.
โจ Features
๐ Quick Start
Using npx (no install)
npx -y codewiki-mcp@latest
From source
git clone https://github.com/izzzzzi/codewiki-mcp.git
cd codewiki-mcp
npm install
npm run build
Transports
# stdio (default)
node dist/cli.js
# Streamable HTTP
node dist/cli.js --http --port 3000
# SSE
node dist/cli.js --sse --port 3001
๐ณ Docker
docker build -t codewiki-mcp .
# stdio
docker run -it --rm codewiki-mcp
# HTTP
docker run -p 3000:3000 codewiki-mcp --http
# with environment variables
docker run -p 3000:3000 \
-e CODEWIKI_REQUEST_TIMEOUT=60000 \
-e CODEWIKI_MAX_RETRIES=5 \
-e GITHUB_TOKEN=ghp_your_token \
codewiki-mcp --http
๐ง MCP Client Configuration
Add to .cursor/mcp.json:
{
"mcpServers": {
"codewiki-mcp": {
"command": "npx",
"args": ["-y", "codewiki-mcp@latest"]
}
}
}
Add to claude_desktop_config.json:
{
"mcpServers": {
"codewiki-mcp": {
"command": "npx",
"args": ["-y", "codewiki-mcp@latest"]
}
}
}
claude mcp add codewiki-mcp -- npx -y codewiki-mcp@latest
Add to your Windsurf MCP config:
{
"mcpServers": {
"codewiki-mcp": {
"command": "npx",
"args": ["-y", "codewiki-mcp@latest"]
}
}
}
Add to .vscode/mcp.json:
{
"servers": {
"codewiki-mcp": {
"command": "npx",
"args": ["-y", "codewiki-mcp@latest"]
}
}
}
{
"mcpServers": {
"codewiki-mcp": {
"command": "node",
"args": ["/path/to/codewiki-mcp/dist/cli.js"]
}
}
}
๐ก Usage
Prompts you can use in any MCP-compatible client:
codewiki fetch how routing works in Next.js
codewiki search state management libraries
codewiki ask how does React fiber reconciler work?
Fetch complete documentation:
codewiki fetch vercel/next.js
codewiki fetch https://github.com/fastify/fastify
Get structured pages:
codewiki fetch pages tailwindlabs/tailwindcss
Ask with natural language:
codewiki ask fastify how to add authentication?
๐ ๏ธ MCP Tools
๐ codewiki_search_repos
Search repositories indexed by codewiki.google.
๐ codewiki_fetch_repo
Fetch generated wiki content for a repository.
๐ฌ codewiki_ask_repo
Ask a natural-language question about a repository.
๐ Response Format
{
"query": "fastify",
"count": 1,
"items": [
{
"fullName": "fastify/fastify",
"url": "https://github.com/fastify/fastify",
"description": "Fast and low overhead web framework",
"avatarUrl": "https://avatars.githubusercontent.com/u/24939....",
"extraScore": 555
}
],
"meta": {
"totalBytes": 12500,
"totalElapsedMs": 450
}
}
{
"repo": "fastify/fastify",
"commit": "abc123",
"canonicalUrl": "https://github.com/fastify/fastify",
"pages": [
{
"title": "Overview",
"level": 1,
"anchor": "#overview",
"markdown": "# Overview\n\nFastify is a web framework...",
"diagramCount": 1
}
],
"meta": {
"totalBytes": 25000,
"totalElapsedMs": 1200
}
}
{
"answer": "Fastify uses a plugin-based architecture where...",
"meta": {
"totalBytes": 8500,
"totalElapsedMs": 2300
}
}
{
"error": {
"code": "RPC_FAIL",
"message": "CodeWiki RPC VSX6ub failed with status 404",
"rpcId": "VSX6ub",
"statusCode": 404
}
}
Error codes: VALIDATION, RPC_FAIL, TIMEOUT, NLP_RESOLVE_FAIL
โ๏ธ How It Works
Data Flow
AI Assistant โ MCP protocol โ codewiki-mcp โ HTTPS โ codewiki.google
โ
AI Assistant โ MCP protocol โ codewiki-mcp โ JSON โ Google RPC API
Google Batchexecute RPC
codewiki.google uses Google's internal batchexecute RPC format (not REST, not GraphQL). The client:
- Builds a POST request with
f.req=...body - Sends it to
/_/BoqAngularSdlcAgentsUi/data/batchexecute - Receives a response with XSSI prefix
)]}'\n - Parses
wrb.frframes and extracts the typed payload
Each tool maps to an RPC ID:
๐ง NLP Repo Resolution
Users can type natural language instead of owner/repo:
"the fastify web framework"
โ wink-nlp extracts keyword "fastify" (POS tag: NOUN/PROPN)
โ GitHub Search API: GET /search/repositories?q=fastify&sort=stars
โ top result: "fastify/fastify"
โ normalizeRepoInput("fastify/fastify") โ URL for codewiki
๐ Retry with Exponential Backoff
4xx errors (client errors) are never retried.
๐ฅ๏ธ CLI
codewiki-mcp [options]
Options:
--http Streamable HTTP transport
--sse SSE transport
--port <number> Port for HTTP/SSE (default: 3000)
--endpoint <str> URL endpoint (default: /mcp)
--help, -h Show help
โก Configuration
Environment variables:
You can also create a .env file in the project root:
CODEWIKI_REQUEST_TIMEOUT=60000
CODEWIKI_MAX_RETRIES=5
GITHUB_TOKEN=ghp_your_token
๐ Project Structure
src/
โโโ cli.ts # CLI entry point
โโโ server.ts # Transport setup (stdio/HTTP/SSE)
โโโ index.ts # Library re-exports
โโโ schemas.ts # Zod input schemas
โโโ lib/
โ โโโ codewikiClient.ts # API client with retry + metadata
โ โโโ batchexecute.ts # Google RPC response parser
โ โโโ repo.ts # Repo normalization + NLP resolution
โ โโโ extractKeyword.ts # NLP keyword extraction (wink-nlp)
โ โโโ resolveRepo.ts # GitHub Search API resolver
โ โโโ errors.ts # CodeWikiError + formatMcpError
โ โโโ config.ts # Env-based configuration
โโโ tools/
โโโ searchRepos.ts # codewiki_search_repos
โโโ fetchRepo.ts # codewiki_fetch_repo
โโโ askRepo.ts # codewiki_ask_repo
โ Troubleshooting
chmod +x ./node_modules/.bin/codewiki-mcp
# Check if port is in use
lsof -i :3000
For large repositories, increase the timeout:
CODEWIKI_REQUEST_TIMEOUT=60000 node dist/cli.js
If natural-language input doesn't resolve, use explicit format:
# Instead of "the fastify framework"
fastify/fastify
# or
https://github.com/fastify/fastify
Set GITHUB_TOKEN to avoid GitHub API rate limits for unauthenticated requests.
๐งโ๐ป Development
npm run dev # stdio with tsx
npm run dev:http # HTTP with tsx
npm run dev:sse # SSE with tsx
npm run typecheck # type check
npm run test # run tests
npm run test:watch # tests in watch mode
npm run build # compile to dist/
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feat/my-feature) - Use Conventional Commits for commit messages
- Run
npm run typecheck && npm run testbefore submitting - Open a Pull Request
๐ License
MIT ยฉ codewiki-mcp contributors