Labsco
MCP SERVER

OpenGrok

by IcyHot09

Search a huge indexed codebase through OpenGrok from your assistant — definitions, references, blame, include graphs and diffs, with compound tools that collapse four calls into one.

Code Intelligence & Repository Indexing
Summary
The compound tools are the reason to use it.

Asking "what is this symbol" naively costs four round trips and a great deal of context; the symbol-context tool does the same work in one, and the project puts the saving at roughly 92% fewer tokens. On a codebase where the index is stale, check index health before you trust an empty result — that is the failure mode that otherwise looks like the code not existing.

What it is

A bridge between an existing OpenGrok index and an MCP client. Instead of the model grepping a checkout it does not have, it queries the index your organization already runs — which is what makes this workable on codebases too large to clone, let alone read.

What you get
  • Search and read — `opengrok_search_code` for full-text, definitions, references, path and history with `file_type` filtering, `opengrok_find_file`, `opengrok_get_file_content` (large files need `start_line` and `end_line`), `opengrok_browse_directory`, `opengrok_list_projects`, `opengrok_search_suggest`
  • History — `opengrok_get_file_history` for commit logs, `opengrok_get_file_annotate` and `opengrok_blame` for line-by-line authorship, `opengrok_get_file_diff` for a unified diff with surrounding context
  • Compound tools that merge several round trips: `opengrok_get_symbol_context` finds the definition, reads the source, fetches headers and gets references in one call; `opengrok_search_and_read` searches then immediately reads the context; `opengrok_batch_search` runs 2-5 queries and deduplicates hits across them
  • Investigation tools — `opengrok_what_changed` groups recent line changes by commit with author, date and SHA; `opengrok_dependency_map` walks `#include` and `import` chains up to depth 3 as a directed graph; `opengrok_search_pattern` for regex; `opengrok_call_graph` for call-chain tracing
  • `opengrok_index_health` — latency, backend connectivity, staleness score and latency trend, for when results look wrong
  • A memory bank that survives across turns: `opengrok_memory_status`, `opengrok_read_memory` and `opengrok_update_memory` over `active-task.md` and an append-only `investigation-log.md`
  • Code Mode, enabled with `OPENGROK_CODE_MODE=true`, which replaces the catalog with a small interface — `opengrok_api` for the spec and `opengrok_execute` to run JavaScript in a sandboxed QuickJS VM against `env.opengrok.*`
Requirements

A reachable OpenGrok server: `OPENGROK_BASE_URL` is the one required setting, with `OPENGROK_USERNAME` and `OPENGROK_PASSWORD` only if your instance is not anonymous. The easiest install is the VS Code extension, which ships the server pre-packaged and configures itself. Otherwise `npm install -g opengrok-mcp-server` then `opengrok-mcp setup` — an interactive wizard that collects the URL and credentials and registers the server with your client, storing the password in the OS keychain (macOS Keychain, Windows Credential Manager, Linux libsecret) with an encrypted file fallback for headless machines. Set `OPENGROK_VERIFY_SSL` to false only for internal CA certificates. Package `opengrok-mcp-server` at 9.2.14.

Setup effort

One command plus a key — npm install -g opengrok-mcp-server, then supply credentials