Opengrok MCP Server

MCP server bridging OpenGrok search engine with AI for instant context across massive codebases

Local serverstdioPython

What is the Opengrok MCP server?

MCP server bridging OpenGrok search engine with AI for instant context across massive codebases. The opengrok mcp server wraps that behind the Model Context Protocol, so an assistant can use it through 14 defined tools rather than through you.

What it actually does

Install OpenGrok MCP from the VS Code Marketplace, or search "OpenGrok" in the Extensions panel.

Its toolset

Everything the assistant can do here goes through one of these:

  • opengrok_get_symbol_context — 1) searches definition, 2) reads source, 3) fetches headers, 4) gets references
  • opengrok_search_and_read — 1) executes search, 2) immediately fetches surrounding code context
  • opengrok_batch_search — Combines 2-5 individual search queries; deduplicates file:line hits across queries
  • opengrok_index_health — Checks latency, backend connectivity, staleness score, and latency trend
  • opengrok_what_changed — Recent line changes grouped by commit — author, date, SHA, changed lines with context. Parameters: project, path, since_days
  • opengrok_dependency_map — BFS traversal of #include/import chains up to configurable depth (1–3); directed graph with uses/used_by
  • opengrok_search_pattern — Regex code search via regexp=true; returns file:line:content matches
  • opengrok_blame — Git blame with line range (start_line/end_line); returns author, date, commit per line (v5.6+)
  • opengrok_call_graph — Call chain tracing via OpenGrok API v2 /symbol/{name}/callgraph (requires OPENGROK_API_VERSION=v2)
  • opengrok_get_file_diff — Unified diff between two revisions with full context lines — shows surrounding code so AI understands why a change was made; use
  • opengrok_memory_status — Shows both memory files (status, bytes, 3-line preview) — helps LLM decide whether to read
  • opengrok_read_memory — Read active-task.md or investigation-log.md from the Living Document memory bank

Configuration

You will need 5 environment variables: OPENGROK_HTTP_PORT, OPENGROK_BASE_URL, OPENGROK_HTTP_AUTH_TOKEN, OPENGROK_HTTP_CLIENT_ID, OPENGROK_HTTP_CLIENT_SECRET. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Adding it to your client

opengrok-mcp-server on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.

When to reach for it

This sits in the developer tooling group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Opengrok's toolset — opengrok_get_symbol_context, opengrok_search_and_read, opengrok_batch_search and 11 more — is a fair guide to whether it matches your workflow. It is maintained by icyhot09; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Opengrok.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the opengrok mcp server does with a few real requests.

Available tools

ToolWhat it does
opengrok_get_symbol_context1) searches definition, 2) reads source, 3) fetches headers, 4) gets references
opengrok_search_and_read1) executes search, 2) immediately fetches surrounding code context
opengrok_batch_searchCombines 2-5 individual search queries; deduplicates file:line hits across queries
opengrok_index_healthChecks latency, backend connectivity, staleness score, and latency trend
opengrok_what_changedRecent line changes grouped by commit — author, date, SHA, changed lines with context. Parameters: project, path, since_days
opengrok_dependency_mapBFS traversal of #include/import chains up to configurable depth (1–3); directed graph with uses/used_by
opengrok_search_patternRegex code search via regexp=true; returns file:line:content matches
opengrok_blameGit blame with line range (start_line/end_line); returns author, date, commit per line *(v5.6+)*
opengrok_call_graphCall chain tracing via OpenGrok API v2 /symbol/{name}/callgraph (requires OPENGROK_API_VERSION=v2)
opengrok_get_file_diffUnified diff between two revisions with full context lines — shows surrounding code so AI understands *why* a change was made; use opengrok_get_file_history to discover revision hashes
opengrok_memory_statusShows both memory files (status, bytes, 3-line preview) — helps LLM decide whether to read
opengrok_read_memoryRead active-task.md or investigation-log.md from the Living Document memory bank
opengrok_update_memoryWrite or append to memory files; auto-timestamps investigation-log.md entries
VariableValues

How to install the Opengrok MCP server

{
  "mcpServers": {
    "opengrok": {
      "command": "npx",
      "args": ["-y", "opengrok-mcp-server"],
      "env": {
        "OPENGROK_HTTP_PORT": "your-value",
        "OPENGROK_BASE_URL": "your-value",
        "OPENGROK_HTTP_AUTH_TOKEN": "your-value",
        "OPENGROK_HTTP_CLIENT_ID": "your-value",
        "OPENGROK_HTTP_CLIENT_SECRET": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
OPENGROK_HTTP_PORTConfiguration value read at startup.Optional
OPENGROK_BASE_URLEndpoint or connection string the server talks to.Yes
OPENGROK_HTTP_AUTH_TOKENCredential the server authenticates with.Yes
OPENGROK_HTTP_CLIENT_IDConfiguration value read at startup.Optional
OPENGROK_HTTP_CLIENT_SECRETCredential the server authenticates with.Yes

Example prompts to try

  • Use Opengrok to opengrok get symbol context.
  • Use Opengrok to opengrok search and read.
  • Use Opengrok to opengrok batch search.

Frequently asked questions

It connects Opengrok to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (opengrok_get_symbol_context, opengrok_search_and_read, opengrok_batch_search, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Opengrok directly.