opengrok_projectsLABSCO SUMMARY
Honest about what OpenGrok is not.
The project states its own ceiling: OpenGrok gives full-text search plus ctags definitions, not a semantic call graph or an AST engine, so structural questions should use it to find the right files and symbols and then be verified with a language-aware tool. That framing is rarer than it should be. The tool-surface setting is the practical lever — the compact surface registers far fewer schemas than the full one, which is a real saving on every session's tool list.
What it is
An agent-oriented front end for OpenGrok. It turns full-text search and ctags definitions into a surface a model can work through safely: tools appear only when the backing OpenGrok feature actually works, results carry citation URLs, and broad or best-effort answers are flagged rather than presented as certain.
What you get
- Code searched across an indexed project, with automatic context expansion around each hit and explicit limits on how far that goes —
opengrok_searchon the default compact surface,search_codeon the full one - A symbol's definitions and its references traced separately —
opengrok_symbols(definitions, references), orsearch_symbol_definitionsandsearch_symbol_referenceson the full surface - Files read with stable pagination cursors, and the context around a specific location fetched on its own —
opengrok_read, orread_fileandget_file_contexton the full surface - The indexed projects and a file's symbols listed —
opengrok_projectsandopengrok_symbols, orlist_projectsandlist_symbolson the full surface - Warnings attached to results that are broad, heuristic, truncated or best-effort, so an agent can tell a confident answer from a partial one
- Three tool surfaces for different agent styles:
compactwith 4 consolidated tools as the default,fullwith 18 fine-grained tools, and an experimentalgatewaypair
Requirements
An OpenGrok instance, with its API base URL ending in /api/v1 in OPENGROK_MCP_BASE_URL — the only required setting. On startup the server discovers projects, probes capabilities and registers only the tools that work. OPENGROK_MCP_API_TOKEN carries the full Authorization value (Bearer … or Basic …) when the instance needs auth; without it, search tools stay gated and the server logs what to fix rather than failing silently. OPENGROK_MCP_DEFAULT_PROJECT sets an implicit project and is filled in automatically when exactly one is discovered. Run a released binary, or go run github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0. HTTP transport is available via OPENGROK_MCP_TRANSPORT but adds no inbound authentication, so keep it on loopback or behind your own controls.
Setup effort
One command — go run github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0
USE CASES
Investigating a codebase too large to clone
Search for the symbol, read the surrounding context, and follow references without pulling the repository down.
Finding where something is defined versus where it is used
Separate the two questions into two tools instead of filtering one noisy result set.
Producing an answer someone else can verify
Keep the citation URL that comes back on each code result so the claim points at the source line.
Keeping the session's tool list small
Stay on the default compact surface, and switch to the fine-grained one only when an agent genuinely needs the extra tools.
4 tools
Listed in project docs. Your client may show a different list.
opengrok_searchopengrok_symbolsopengrok_readBEFORE YOU INSTALL
What to know first
Tools you get
4 tools named in the project's documentation.
Requires
- go on PATH
- OPENGROK_MCP_BASE_URL in your environment
INSTALLATION
Connect your client
Server setup
go run github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0MCP Clients
Claude Code — go run, Cursor — go run
{
"mcpServers": {
"opengrok": {
"command": "go",
"args": [
"run",
"github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0"
],
"env": {
"OPENGROK_MCP_BASE_URL": "https://<YOUR_OPENGROK_HOST>/source/api/v1"
}
}
}
}VS Code — go run
{
"servers": {
"opengrok": {
"command": "go",
"args": [
"run",
"github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0"
],
"env": {
"OPENGROK_MCP_BASE_URL": "https://<YOUR_OPENGROK_HOST>/source/api/v1"
}
}
}
}Claude Code — binary
{
"mcpServers": {
"opengrok": {
"command": "<YOUR_PATH_TO_OPENGROK_GO_MCP>",
"env": {
"OPENGROK_MCP_BASE_URL": "https://<YOUR_OPENGROK_HOST>/source/api/v1"
}
}
}
}OpenCode
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"opengrok": {
"type": "local",
"enabled": true,
"command": [
"go",
"run",
"github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0"
],
"environment": {
"OPENGROK_MCP_BASE_URL": "https://<YOUR_OPENGROK_HOST>/source/api/v1"
}
}
}
}Codex
[mcp_servers.opengrok]
command = "go"
args = ["run", "github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0"]
[mcp_servers.opengrok.env]
OPENGROK_MCP_BASE_URL = "https://<YOUR_OPENGROK_HOST>/source/api/v1"