icyhot09 avatar

OpenGrok MCP Server

icyhot09/opengrok-mcp-server

Bridges OpenGrok's code search engine to AI assistants through MCP, surfacing definitions, references, file contents, and commit history from massive indexed codebases. You get dedicated tools for symbol lookup, regex pattern search, blame annotation, dependency traversal, and batch operations that collapse multiple queries into one. It ships as a VS Code extension with the server bundled inside, no Python or separate Node install required. Credentials live in your OS keychain. The compound tools are the real win here: `opengrok_get_symbol_context` merges definition search, source fetch, header retrieval, and reference lookup into a single call, cutting token overhead by over 90%. Reach for this when you're working with enterprise scale repos already indexed in OpenGrok and need instant AI context without cloning gigabytes locally.

GitHub stars
11
tools
28
auth
Secret needed
transport
STDIO
env vars
24
last updated
Sep 16, 2026

Tools

28 tools

Public tool metadata for what this MCP can expose to an agent.

opengrok_search_codeFull-text, definition, reference, path, and history search. Supports `file_type` filtering and `cursor` pagination.

Full-text, definition, reference, path, and history search. Supports `file_type` filtering and `cursor` pagination.

No parameter schema in public metadata yet.

opengrok_find_fileLocate files by name or directory pattern. Supports `cursor` pagination.

Locate files by name or directory pattern. Supports `cursor` pagination.

No parameter schema in public metadata yet.

opengrok_get_file_contentRead source code. Use `start_line` / `end_line` for large files.

Read source code. Use `start_line` / `end_line` for large files.

No parameter schema in public metadata yet.

opengrok_get_file_historyCommit history for a file. Supports `cursor` pagination.

Commit history for a file. Supports `cursor` pagination.

No parameter schema in public metadata yet.

opengrok_browse_directoryView folder structure and contained files. Supports `cursor` / `limit` pagination.

View folder structure and contained files. Supports `cursor` / `limit` pagination.

No parameter schema in public metadata yet.

opengrok_list_projectsList all indexed repositories.

List all indexed repositories.

No parameter schema in public metadata yet.

opengrok_get_file_annotateLine-by-line blame annotation. Supports `revision`, `start_line`/`end_line` range, `includeContent`.

Line-by-line blame annotation. Supports `revision`, `start_line`/`end_line` range, `includeContent`.

No parameter schema in public metadata yet.

opengrok_get_file_symbolsExtract classes, functions, macros, and structs from a file. Supports `cursor` pagination.

Extract classes, functions, macros, and structs from a file. Supports `cursor` pagination.

No parameter schema in public metadata yet.

opengrok_search_suggestQuery autocomplete recommendations. Supports `context` passthrough for ranking.

Query autocomplete recommendations. Supports `context` passthrough for ranking.

No parameter schema in public metadata yet.

opengrok_get_symbol_contextSearch definition + read source + fetch headers + get references, merged into one operation.

Search definition + read source + fetch headers + get references, merged into one operation.

No parameter schema in public metadata yet.

opengrok_search_and_readSearch + read surrounding context (cap: `OPENGROK_SEARCH_AND_READ_CAP`).

Search + read surrounding context (cap: `OPENGROK_SEARCH_AND_READ_CAP`).

No parameter schema in public metadata yet.

opengrok_batch_search2–5 parallel searches, deduplicated results.

2–5 parallel searches, deduplicated results.

No parameter schema in public metadata yet.

opengrok_index_healthLatency, connectivity, staleness score.

Latency, connectivity, staleness score.

No parameter schema in public metadata yet.

opengrok_what_changedRecent line changes grouped by commit — author, date, SHA, changed lines with context.

Recent line changes grouped by commit — author, date, SHA, changed lines with context.

No parameter schema in public metadata yet.

opengrok_dependency_mapBFS traversal of `#include`/`import` chains up to depth 3; directed graph with `uses`/`used_by`.

BFS traversal of `#include`/`import` chains up to depth 3; directed graph with `uses`/`used_by`.

No parameter schema in public metadata yet.

opengrok_search_patternRegex code search; returns `file:line:content` matches.

Regex code search; returns `file:line:content` matches.

No parameter schema in public metadata yet.

opengrok_blameBlame with line range (`line_start` / `line_end`) and optional diff.

Blame with line range (`line_start` / `line_end`) and optional diff.

No parameter schema in public metadata yet.

opengrok_call_graphCall chain tracing via OpenGrok API v2 (requires `OPENGROK_API_VERSION=v2`; refs-based fallback on v1).

Call chain tracing via OpenGrok API v2 (requires `OPENGROK_API_VERSION=v2`; refs-based fallback on v1).

No parameter schema in public metadata yet.

opengrok_get_file_diffUnified diff between two revisions with context lines.

Unified diff between two revisions with context lines.

No parameter schema in public metadata yet.

opengrok_get_compile_infoC/C++ compiler flags and include paths from local `compile_commands.json`.

C/C++ compiler flags and include paths from local `compile_commands.json`.

No parameter schema in public metadata yet.

opengrok_get_all_matchesAll matching lines in a file when search shows truncated hits.

All matching lines in a file when search shows truncated hits.

No parameter schema in public metadata yet.

opengrok_get_file_history_with_filesCommit history with co-changed file lists via RSS feed.

Commit history with co-changed file lists via RSS feed.

No parameter schema in public metadata yet.

opengrok_get_download_urlDirect download URL for a file (no HTTP call).

Direct download URL for a file (no HTTP call).

No parameter schema in public metadata yet.

opengrok_list_groupsProject groups (empty when admin auth required).

Project groups (empty when admin auth required).

No parameter schema in public metadata yet.

opengrok_get_suggest_popularityPopular suggestions for a project field (empty when admin auth required).

Popular suggestions for a project field (empty when admin auth required).

No parameter schema in public metadata yet.

opengrok_get_project_repositoriesRepositories for a project (empty when admin auth required).

Repositories for a project (empty when admin auth required).

No parameter schema in public metadata yet.

opengrok_apiReturns the full Code Mode API spec; call once at session start.

Returns the full Code Mode API spec; call once at session start.

No parameter schema in public metadata yet.

opengrok_executeRuns sandboxed code against the Code Mode API.

Runs sandboxed code against the Code Mode API.

No parameter schema in public metadata yet.

Sponsors

Configuration

OPENGROK_BASE_URL*

OpenGrok server base URL (e.g. https://opengrok.example.com/source/)

OPENGROK_USERNAME

OpenGrok authentication username. Leave unset for anonymous access.

OPENGROK_PASSWORDsecret

OpenGrok authentication password. Prefer storing via OS keychain using 'npx opengrok-mcp-server setup'.

OPENGROK_VERIFY_SSLdefault: true

Verify TLS certificates. Set to false for self-signed or internal CA certs.

OPENGROK_CODE_MODEdefault: true

Enable Code Mode: 2-tool sandbox interface with env.opengrok.* JavaScript API. Reduces AI token usage by ~90%.

OPENGROK_ENABLE_MEMORY_TOOLSdefault: false

Register the 3 memory tools in Code Mode (memory status, read, update). Off = api + execute only.

OPENGROK_DEFAULT_PROJECT

Default project to scope all searches. Can be overridden per call.

OPENGROK_CONTEXT_BUDGETdefault: standard

Response size tier controlling token usage.

OPENGROK_API_VERSIONdefault: v1

OpenGrok REST API version. Use v2 for call graph features (requires OpenGrok 1.12+).

HTTP_PROXY

HTTP/HTTPS proxy URL for all OpenGrok API requests (e.g. http://proxy.company.com:8080). Also set as HTTPS_PROXY.

OPENGROK_RESPONSE_FORMAT_OVERRIDE

Force a specific response format for all tools. Leave unset for per-tool auto-selection (recommended).

OPENGROK_MEMORY_BANK_DIR

Directory 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_PATHS

Comma-separated paths to compile_commands.json for C/C++ compiler flag and include-path extraction. Leave unset for automatic workspace discovery.

OPENGROK_ENABLE_ELICITATIONdefault: true

Interactive 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.

OPENGROK_ENABLE_SAMPLINGdefault: false

AI 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).

OPENGROK_SAMPLING_MODEL

Model preference for MCP Sampling (used for error explanation and query reformulation).

OPENGROK_ENABLE_FILES_APIdefault: false

Files API Cache — avoids re-uploading unchanged investigation notes. Requires Files API support in the MCP client.

OPENGROK_ENABLE_OBSERVATION_MASKERdefault: false

Observation 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).

OPENGROK_OBSERVATION_MASKER_TURNSdefault: 10

Number of most-recent opengrok_execute results to keep as full text before masking older ones. Default: 10.

OPENGROK_SAMPLING_MAX_TOKENSdefault: 256

Maximum tokens for AI sampling responses (error explanation, query reformulation). Range: 64–4096.

OPENGROK_AUDIT_LOG_FILE

Path to write structured audit events (CSV/JSON). Appends tool invocations, elicitation events, and errors. Leave unset to disable.

OPENGROK_RATELIMIT_RPMdefault: 60

Maximum requests per minute to the OpenGrok server. Default: 60.

OPENGROK_PER_TOOL_RATELIMIT

Per-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_TIMEOUTdefault: 30

HTTP request timeout in seconds for OpenGrok API calls. Increase for slow servers. Default: 30.

Readme

OpenGrok MCP Server logo

OpenGrok MCP Server

Code intelligence for any OpenGrok-indexed codebase — search, read, blame, symbol navigation, diffs, commit history, call graphs, dependency maps, and guided investigation. Optimized for token efficiency through Code Mode and AST-aware code reads.

npm MCP Registry CI GitHub Release


Quick Start

Option 1 — VS Code Extension


View the full README on GitHub

Details

Repository
github.com/icyhot09/opengrok-mcp-server
Website
github.com/IcyHot09/opengrok-mcp-server
Category
Search & Web Crawling
Package
opengrok-mcp-server
Transport
STDIO
Auth
Required
Registry
MCP registry, active

Related Search & Web Crawling MCP servers

View all
1kylastech avatarKylas CRMkylastech/kylas-crm-mcp-serverMCP server for Kylas CRM: create, search, and manage leads. Requires KYLAS_API_KEY.11stars
2serkan-ozal avatarSerkan Ozal Driflyte Mcp Serverserkan-ozal/driflyte-mcp-serverDiscover available topics and explore up-to-date, topic-tagged web content. Search to surface the…10stars
3haseebkhalid1507 avatarVelociraghaseebkhalid1507/velociragLightning-fast RAG for AI agents. 4-layer fusion, ONNX Runtime, sub-200ms search.10stars
4simonsysun avatarSeekLinksimonsysun/seeklinkLocal read-only semantic search for Markdown vaults through MCP.10stars
5hqkh4nh avatarDejaredhqkh4nh/dejared-mcpJava decompiler MCP server. Explore, search, and decompile JAR, WAR, EAR, and AAR bytecode.9stars
6lvpiggyqq avatarXcatcher — Recent X Postslvpiggyqq/xcatcher-mcp-manifestFetch recent public X/Twitter posts by named handle for monitoring, comparison, OSINT, and research.0stars