OpenGrok MCP Server
io.github.IcyHot09/opengrok-mcp-server
v9.6.0Updated Sep 16, 2026stdio · npm
MCP server bridging OpenGrok search engine with AI for instant context across massive codebases.
Install
Replace 1 placeholder with your own values.
Run in your terminal. Replace 1 placeholder.
claude mcp add opengrok-mcp-server -e 'OPENGROK_BASE_URL=<your-opengrok-base-url>' -e OPENGROK_VERIFY_SSL=true -e OPENGROK_CODE_MODE=true -e OPENGROK_ENABLE_MEMORY_TOOLS=false -e OPENGROK_CONTEXT_BUDGET=standard -e OPENGROK_API_VERSION=v1 -e OPENGROK_ENABLE_ELICITATION=true -e OPENGROK_ENABLE_SAMPLING=false -e OPENGROK_ENABLE_FILES_API=false -e OPENGROK_ENABLE_OBSERVATION_MASKER=false -e OPENGROK_OBSERVATION_MASKER_TURNS=10 -e OPENGROK_SAMPLING_MAX_TOKENS=256 -e OPENGROK_RATELIMIT_RPM=60 -e OPENGROK_TIMEOUT=30 -e OPENGROK_DEFAULT_MAX_RESULTS=25 -e OPENGROK_STRICT_SSRF=false -- npx -y [email protected]Configuration
31 settings.
OPENGROK_BASE_URLEnv var· requiredOpenGrok server base URL (e.g. https://opengrok.example.com/source/)OPENGROK_PASSWORDEnv var· optional· secretOpenGrok authentication password. Prefer storing via OS keychain using 'npx opengrok-mcp-server setup'.OPENGROK_USERNAMEEnv var· optionalOpenGrok authentication username. Leave unset for anonymous access.OPENGROK_VERIFY_SSLEnv var· optionalVerify TLS certificates. Set to false for self-signed or internal CA certs.Default:trueOPENGROK_CODE_MODEEnv var· optionalEnable Code Mode: 2-tool sandbox interface with env.opengrok.* JavaScript API. Reduces AI token usage by ~90%.Default:trueOPENGROK_ENABLE_MEMORY_TOOLSEnv var· optionalRegister the 3 memory tools in Code Mode (memory status, read, update). Off = api + execute only.Default:false
Show 25 moreShow fewer
OPENGROK_DEFAULT_PROJECTEnv var· optionalDefault project to scope all searches. Can be overridden per call.OPENGROK_CONTEXT_BUDGETEnv var· optionalResponse size tier controlling token usage.Default:standardOPENGROK_API_VERSIONEnv var· optionalOpenGrok REST API version. Use v2 for call graph features (requires OpenGrok 1.12+).Default:v1HTTP_PROXYEnv var· optionalHTTP/HTTPS proxy URL for all OpenGrok API requests (e.g. http://proxy.company.com:8080). Also set as HTTPS_PROXY.OPENGROK_RESPONSE_FORMAT_OVERRIDEEnv var· optionalForce a specific response format for all tools. Leave unset for per-tool auto-selection (recommended).OPENGROK_MEMORY_BANK_DIREnv var· optionalDirectory where the AI stores investigation notes (active-task.md, investigation-log.md). Defaults to ~/.config/opengrok-mcp/memory-bank/ or workspace-relative when set by the VS Code extension.OPENGROK_LOCAL_COMPILE_DB_PATHSEnv var· optionalComma-separated paths to compile_commands.json for C/C++ compiler flag and include-path extraction. Leave unset for automatic workspace discovery.OPENGROK_ENABLE_ELICITATIONEnv var· optionalInteractive AI Prompts — the AI pauses to ask questions during investigations (project selection, file disambiguation). Requires Claude Code v2.1.76+ or a client that supports MCP Elicitation.Default:trueOPENGROK_ENABLE_SAMPLINGEnv var· optionalAI Sampling — allow the server to request LLM completions for error explanations and summaries. Off by default to avoid consuming premium requests (e.g. GitHub Copilot).Default:falseOPENGROK_SAMPLING_MODELEnv var· optionalModel preference for MCP Sampling (used for error explanation and query reformulation).OPENGROK_ENABLE_FILES_APIEnv var· optionalFiles API Cache — avoids re-uploading unchanged investigation notes. Requires Files API support in the MCP client.Default:falseOPENGROK_ENABLE_OBSERVATION_MASKEREnv var· optionalObservation Masker — prepend compact history summaries to opengrok_execute results after N turns. Disabled by default; has no benefit for clients that retain full context (Claude Code, Cursor).Default:falseOPENGROK_OBSERVATION_MASKER_TURNSEnv var· optionalNumber of most-recent opengrok_execute results to keep as full text before masking older ones. Default: 10.Default:10OPENGROK_SAMPLING_MAX_TOKENSEnv var· optionalMaximum tokens for AI sampling responses (error explanation, query reformulation). Range: 64–4096.Default:256OPENGROK_AUDIT_LOG_FILEEnv var· optionalPath to write structured audit events (CSV/JSON). Appends tool invocations, elicitation events, and errors. Leave unset to disable.OPENGROK_RATELIMIT_RPMEnv var· optionalMaximum requests per minute to the OpenGrok server. Default: 60.Default:60OPENGROK_PER_TOOL_RATELIMITEnv var· optionalPer-tool rate limits in requests per minute, as comma-separated tool:rpm pairs (e.g. opengrok_execute:15,opengrok_search_code:30). Overrides OPENGROK_RATELIMIT_RPM for specific tools.OPENGROK_TIMEOUTEnv var· optionalHTTP request timeout in seconds for OpenGrok API calls. Increase for slow servers. Default: 30.Default:30OPENGROK_DEFAULT_MAX_RESULTSEnv var· optionalDefault maximum number of results returned per search query. Default: 25.Default:25OPENGROK_PASSWORD_FILEEnv var· optionalPath to a file containing the OpenGrok password (file-mounted secret for containers). Takes precedence over the OS keychain when OPENGROK_PASSWORD is unset.OPENGROK_MAX_RESPONSE_BYTESEnv var· optionalHard cap on response payload size in bytes. Overrides the context-budget default. Non-positive values are ignored.OPENGROK_SEARCH_AND_READ_CAPEnv var· optionalCap for the search_and_read compound tool in bytes. Overrides the context-budget default (2–8 KB depending on tier). Non-positive values are ignored.OPENGROK_STRICT_SSRFEnv var· optionalWhen true, reject OPENGROK_BASE_URL values pointing at private/loopback IPs at startup. Default: false (warn only; per-request guards still apply).Default:falseOPENGROK_JWT_ISSUEREnv var· optionalExpected JWT issuer (iss claim) for HTTP transport OAuth. When set, JWTs from other issuers are rejected.OPENGROK_GRAMMAR_DIREnv var· optionalDirectory containing tree-sitter WASM grammars. Overrides the bundled grammar lookup.
Links
Listed in the official MCP Registry since Sep 16, 2026. Mirrored daily; last checked Nov 26, 2026.