Configuration
All behaviour is configurable via environment variables — no code changes needed.
Environment Variables
Timeouts
| Variable | Default | Description |
CODEWIKI_HARD_TIMEOUT | 60 | Hard timeout per request (seconds) |
CODEWIKI_HTTPX_TIMEOUT | 30 | HTTP timeout fallback (seconds) |
CODEWIKI_PAGE_LOAD_TIMEOUT | 30 | Playwright page load timeout (seconds) |
CODEWIKI_ELEMENT_WAIT_TIMEOUT | 20 | Element wait timeout (seconds) |
CODEWIKI_RESPONSE_WAIT_TIMEOUT | 45 | Chat response wait timeout (seconds) |
Retry & Limits
| Variable | Default | Description |
CODEWIKI_MAX_RETRIES | 2 | Max retry attempts |
CODEWIKI_RETRY_DELAY | 3 | Delay between retries (seconds) |
CODEWIKI_RESPONSE_MAX_CHARS | 30000 | Max response character count |
Cache
| Variable | Default | Description |
CODEWIKI_CACHE_TTL | 300 | Rendered page cache TTL (seconds) |
CODEWIKI_CACHE_MAX_SIZE | 50 | Max rendered pages in cache |
CODEWIKI_SEARCH_CACHE_TTL | 120 | Search result cache TTL (seconds) |
CODEWIKI_SEARCH_CACHE_MAX_SIZE | 30 | Max search results in cache |
CODEWIKI_PARSED_CACHE_MAX_SIZE | 30 | Max parsed WikiPage objects in cache |
CODEWIKI_TOPIC_CACHE_TTL | 1800 | Topic list cache TTL (seconds) — longer since structure rarely changes |
CODEWIKI_TOPIC_CACHE_MAX_SIZE | 30 | Max topic lists in cache |
Rate Limiting
| Variable | Default | Description |
CODEWIKI_RATE_LIMIT_WINDOW | 60 | Sliding window duration (seconds) |
CODEWIKI_RATE_LIMIT_MAX_CALLS | 10 | Max calls per repo per window |
Session Pool
| Variable | Default | Description |
CODEWIKI_SESSION_POOL_SIZE | 10 | Max warm browser contexts in the session pool |
Chat Polling
| Variable | Default | Description |
CODEWIKI_RESPONSE_INITIAL_DELAY | 5 | Initial delay before polling chat response (seconds) |
CODEWIKI_RESPONSE_POLL_INTERVAL | 2 | Interval between chat response polls (seconds) |
CODEWIKI_RESPONSE_STABLE_INTERVAL | 2 | Stable response detection interval (seconds) |
Other
| Variable | Default | Description |
CODEWIKI_JS_LOAD_DELAY | 3 | Delay for JS/SPA loading (seconds) |
CODEWIKI_TOPIC_PREVIEW_CHARS | 200 | Max characters per topic preview in codewiki_list_topics |
CODEWIKI_VERBOSE | false | Enable debug logging |
CODEWIKI_BASE_URL | https://codewiki.google | CodeWiki base URL |
Passing Environment Variables
Shell
CODEWIKI_VERBOSE=true CODEWIKI_CACHE_TTL=600 codewiki-mcp
Docker
docker run -e CODEWIKI_MAX_RETRIES=5 -e CODEWIKI_VERBOSE=true codewiki-mcp
VS Code MCP config
Pass environment variables via the env field in .vscode/mcp.json:
{
"servers": {
"codewikiMcp": {
"type": "stdio",
"command": "codewiki-mcp",
"env": {
"CODEWIKI_VERBOSE": "true",
"CODEWIKI_CACHE_TTL": "600"
}
}
}
}
Claude Desktop
Similarly, use the env key in claude_desktop_config.json:
{
"mcpServers": {
"codewiki": {
"command": "codewiki-mcp",
"env": {
"CODEWIKI_VERBOSE": "true"
}
}
}
}