Configuration

All behaviour is configurable via environment variables — no code changes needed.

Environment Variables

Timeouts

VariableDefaultDescription
CODEWIKI_HARD_TIMEOUT60Hard timeout per request (seconds)
CODEWIKI_HTTPX_TIMEOUT30HTTP timeout fallback (seconds)
CODEWIKI_PAGE_LOAD_TIMEOUT30Playwright page load timeout (seconds)
CODEWIKI_ELEMENT_WAIT_TIMEOUT20Element wait timeout (seconds)
CODEWIKI_RESPONSE_WAIT_TIMEOUT45Chat response wait timeout (seconds)

Retry & Limits

VariableDefaultDescription
CODEWIKI_MAX_RETRIES2Max retry attempts
CODEWIKI_RETRY_DELAY3Delay between retries (seconds)
CODEWIKI_RESPONSE_MAX_CHARS30000Max response character count

Cache

VariableDefaultDescription
CODEWIKI_CACHE_TTL300Rendered page cache TTL (seconds)
CODEWIKI_CACHE_MAX_SIZE50Max rendered pages in cache
CODEWIKI_SEARCH_CACHE_TTL120Search result cache TTL (seconds)
CODEWIKI_SEARCH_CACHE_MAX_SIZE30Max search results in cache
CODEWIKI_PARSED_CACHE_MAX_SIZE30Max parsed WikiPage objects in cache
CODEWIKI_TOPIC_CACHE_TTL1800Topic list cache TTL (seconds) — longer since structure rarely changes
CODEWIKI_TOPIC_CACHE_MAX_SIZE30Max topic lists in cache

Rate Limiting

VariableDefaultDescription
CODEWIKI_RATE_LIMIT_WINDOW60Sliding window duration (seconds)
CODEWIKI_RATE_LIMIT_MAX_CALLS10Max calls per repo per window

Session Pool

VariableDefaultDescription
CODEWIKI_SESSION_POOL_SIZE10Max warm browser contexts in the session pool

Chat Polling

VariableDefaultDescription
CODEWIKI_RESPONSE_INITIAL_DELAY5Initial delay before polling chat response (seconds)
CODEWIKI_RESPONSE_POLL_INTERVAL2Interval between chat response polls (seconds)
CODEWIKI_RESPONSE_STABLE_INTERVAL2Stable response detection interval (seconds)

Other

VariableDefaultDescription
CODEWIKI_JS_LOAD_DELAY3Delay for JS/SPA loading (seconds)
CODEWIKI_TOPIC_PREVIEW_CHARS200Max characters per topic preview in codewiki_list_topics
CODEWIKI_VERBOSEfalseEnable debug logging
CODEWIKI_BASE_URLhttps://codewiki.googleCodeWiki 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"
      }
    }
  }
}