MCP server bridging OpenGrok search engine with AI for instant context across massive codebases
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.
Install OpenGrok MCP from the VS Code Marketplace, or search "OpenGrok" in the Extensions panel.
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 referencesopengrok_search_and_read — 1) executes search, 2) immediately fetches surrounding code contextopengrok_batch_search — Combines 2-5 individual search queries; deduplicates file:line hits across queriesopengrok_index_health — Checks latency, backend connectivity, staleness score, and latency trendopengrok_what_changed — Recent line changes grouped by commit — author, date, SHA, changed lines with context. Parameters: project, path, since_daysopengrok_dependency_map — BFS traversal of #include/import chains up to configurable depth (1–3); directed graph with uses/used_byopengrok_search_pattern — Regex code search via regexp=true; returns file:line:content matchesopengrok_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; useopengrok_memory_status — Shows both memory files (status, bytes, 3-line preview) — helps LLM decide whether to readopengrok_read_memory — Read active-task.md or investigation-log.md from the Living Document memory bankYou 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.
opengrok-mcp-server on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.
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.
| Tool | What it does |
|---|---|
| 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_get_file_history to discover revision hashes |
| 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 |
| opengrok_update_memory | Write or append to memory files; auto-timestamps investigation-log.md entries |
| Variable | Values |
{
"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.
| Variable | Description | Required |
|---|---|---|
| OPENGROK_HTTP_PORT | Configuration value read at startup. | Optional |
| OPENGROK_BASE_URL | Endpoint or connection string the server talks to. | Yes |
| OPENGROK_HTTP_AUTH_TOKEN | Credential the server authenticates with. | Yes |
| OPENGROK_HTTP_CLIENT_ID | Configuration value read at startup. | Optional |
| OPENGROK_HTTP_CLIENT_SECRET | Credential the server authenticates with. | Yes |
Kill hallucinated APIs — version-accurate, up-to-date library documentation injected straight into context.
Microsoft's official browser automation server — drive a real browser through the accessibility tree, no screenshots needed.
GitHub's official server — repos, issues, pull requests, Actions and code security, straight from your assistant.
Issue tracking at the speed of conversation — Linear's official hosted server with OAuth and zero install.
Local repository surgery — status, diffs, commits, branches and history for any repo on disk.
Timezone sanity for AI — current time anywhere and correct conversions, without the model doing date math.