OpenGrok Go MCP
About
Source-code intelligence for agents, powered by OpenGrok and Go.
Details
- Author
- rokasklive
- Categories
- Developer Tools, Search, Knowledge Base
Jump to
Setup
Install OpenGrok Go MCP in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/rokasklive/opengrok-go-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Source-code intelligence for agents, powered by OpenGrok and Go.
Source-code intelligence for agents, powered by OpenGrok and Go.
I have seen things you people wouldn’t grep.— Senior Architect, probably.
Agent-oriented MCP server for searching, navigating, and reading code through OpenGrok.
It turns OpenGrok into a safer code-intelligence surface for LLM agents:
- capability-gated tools that only appear when the backing OpenGrok feature works
- paginated search and file reads with stable cursors
- citation URLs on code results so answers can point back to source
- warnings for broad, heuristic, truncated, or best-effort results (warnings[]codes plus a legacywarningstring)
- automatic context expansion around search hits with explicit limits
- full, compact, and experimental gateway tool surfaces for different agent styles
If you are an AI agent reading this repository, start withAGENTS.mdfor project constraints and agent workflow guidance.
Pre-1.0 note:this MCP server is still evolving. Some tools, responses, and configuration paths may be broken or change before a stable 1.0 release. Please report issues usingdocs/reporting-issues.md.
Useopengrok-go-mcpwhen you want an agent to investigate a large indexed codebase without cloning it locally. It works best for finding symbols, reading files, tracing references, narrowing broad searches, and producing answers with source citations.
It is intentionally honest about OpenGrok's limits. OpenGrok provides full-text search plus ctags definitions, not a full semantic call graph or AST engine. For structural questions, use this server to find the right files and symbols, then verify relationships with language-aware tools when needed.
Required:OPENGROK_MCP_BASE_URL— OpenGrok API base URL ending in/api/v1. On startup the server discovers projects, probes capabilities, and registers only tools that work. A typical reverse-proxied instance needs nothing else.
Copy a block below, replace the URL, restart the client.
The server defaults toOPENGROK_MCP_AGENT_PROFILE=economy(lean payloads, no auto context expansion). SetOPENGROK_MCP_AGENT_PROFILE=richwhen you want expanded search context by default. Internal response diagnostics are off by default; setOPENGROK_MCP_DIAGNOSTICS=trueonly when debugging pagination/search counters. Seedocs/configuration.mdfor the full environment reference.
Download the archive for your OS/arch fromGitHub Releases, verifychecksums.txt, and point your MCP client at the unpackedopengrok-go-mcpbinary. Example (Claude Code):
{ "mcpServers": { "opengrok": { "command": "/path/to/opengrok-go-mcp", "env": { "OPENGROK_MCP_BASE_URL": "https://your-opengrok-host/source/api/v1" } } } }
Add to~/.claude.jsonundermcpServers, or runclaude mcp add:
{ "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" } } } }
{ "$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" } } } }
Add to.codex/config.tomlin the project root or~/.codex/config.toml:
[[mcp_servers]] name = "opengrok" command = ["go", "run", "github.com/rokasklive/opengrok-go-mcp/cmd/opengrok-go-mcp@v0.6.0"] [mcp_servers.env] OPENGROK_MCP_BASE_URL = "https://your-opengrok-host/source/api/v1"
Most stdio MCP clients use the same shape as Claude Code —command,args, and anenvmap (name may vary:environment,env):
{ "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" } } } }
Cursor: project.cursor/mcp.jsonorCursor Settings → MCP. VS Code: MCP extension config with the same server entry.
Use the sameenv/environmentblock as above. Example command for Claude Code:
"command": "sh", "args": [ "-c", "cd /path/to/opengrok-go-mcp && go run ./cmd/opengrok-go-mcp --read-timeout=30s --write-timeout=30s" ]
OPENGROK_MCP_TRANSPORT=http \ OPENGROK_MCP_BASE_URL=https://your-opengrok-host/source/api/v1 \ go run ./cmd/opengrok-go-mcp
If search probes return 401/403 without a token, the server still starts and logs remediation; search tools stay gated untilOPENGROK_MCP_API_TOKENis set.
Context budget overrides:OPENGROK_MCP_BUDGET_{MINIMAL|DEFAULT|MAXIMAL}_{BEFORE|AFTER|RESULTS|FILES}.
Deprecated:OPENGROK_MCP_PROJECT_SCRAPE(useOPENGROK_MCP_DISABLE_PROJECT_SCRAPE). Removed:OPENGROK_MCP_BASIC_AUTH_TOKEN(useOPENGROK_MCP_API_TOKEN="Basic …").
Avoid passing secrets as CLI flags. UseOPENGROK_MCP_API_TOKENfor OpenGrok auth; the server never logs token values.
- HTTP mode does not add inbound client authentication. Keep the default loopback bind address or put it behind trusted network/auth controls.
- OPENGROK_MCP_INSECURE_SKIP_TLS_VERIFY=trueis only for controlled internal instances with broken certificates. Do not use it for public or untrusted hosts.
- Raw file fallback usesOPENGROK_MCP_WEB_BASE_URLwith the same configured credentials. Treat that URL as part of the trusted OpenGrok boundary.
- Memory tools arefull-surface only(stdio). They are process-scoped, ephemeral, and disabled over HTTP because memory is not isolated by client session.
- SetOPENGROK_MCP_CURSOR_SECRETfor shared deployments if cursor integrity matters.
Hermetic stdio evals inevals/— real MCP binary, fake OpenGrok backend, no live instance. CI runs them on every PR (ci.yml). README summaries andΔcolumns compare against committed baselines inevals/baselines/. Refresh locally withscripts/update-eval-results.sh; the optional pre-push hook (scripts/install-githooks.sh) runs tests and updates those files before you push.
go test ./evals/ -count=1 # contract + token benchmark go test ./evals/ -run TestEvalSuite -count=1 # MCP contract only go test ./evals/ -run TestTokenBenchmark -count=1 # token economy only
- Contract eval— hermetic MCP calls against a fake OpenGrok backend; checks outputs, errors, and pagination fields.Δis change vs the committed baseline inevals/baselines/.coverage@Kis the fraction of eval cases exercised.
- Token benchmark— same harness, but measures UTF-8 bytes crossing the MCP wire (tool schemas, requests, responses).Est. tokens= bytes ÷ 4 (rough heuristic, not a specific model tokenizer).
- Surface—full(fine-grained tools),compact(4 consolidated tools, default), orgateway(experimental discover + call).
- ListTools— one-time cost when the client loads the tool list and schemas at session start; usually the largest line item onfull.
- Warm total—ListToolsplus all tool calls in a scenario (request + response bytes). Forgateway,warmexcludes the one-timeopengrok_discovercall;coldincludes it (first session only). Onfullandcompact, cold = warm.
- Min–max— range across the four replay scenarios (symbol lookup, file browse, multi-step symbol search, search-and-read). Per-scenario breakdown is in the collapsed table.
- Δon token rows — change in estimated tokens vs the last committed baseline (evals/baselines/token_report.json).
Last run:2026-06-25· direct-call ·harness docs →
10/10 passed· 100% (Δ ±0) · 100% coverage@K — seeHow to read the tablesfor Δ and coverage@K.
Last run:2026-06-25· deterministic-replay · est. tokens = bytes÷4 (heuristic, not model-exact)
ListToolsdominates session cost on the full surface (18 tools). Compact (4) and gateway (2) register far fewer schemas.
Warm = ListTools + scenario tool traffic. Gateway warm omits one-timediscover; full/compact cold = warm. Compactfile-explorationskipsfiles.list(no compact op).
This project uses GitHub Spec Kit for non-trivial feature planning.
For meaningful behavior changes, new MCP tools, schema changes, configuration changes, or changes that affect agent-facing behavior, contributors should start from the project constitution:
- specs/FEATURE/spec.md
- specs/FEATURE/plan.md
- specs/FEATURE/tasks.md
Small bug fixes, documentation edits, dependency bumps, and mechanical refactors do not require a full Spec Kit workflow unless they affect the public MCP contract.
All changes must preserve the MCP contract, OpenGrok semantics, security posture, compatibility expectations, and documentation requirements described in the constitution.
- Large project traversal is bounded, and some search and discovery operations are best-effort rather than language-semantic.
- HTTP transport is intended for controlled local or internal setups and does not add inbound client authentication.
Seedocs/limitations.mdfor the detailed current list, behavioral impact, and mitigations.
opengrok-go-mcpis licensed under the Apache License 2.0 (Apache-2.0) for new releases starting withv0.3.0-beta.2.
Earlier published releases up to and includingv0.3.0-beta.1were released underCC0-1.0and remain available under those terms.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Structural codebase indexer with 17 query tools. 87% token reduction. Zero dependencies.
A local MCP server providing powerful code analysis and search capabilities for software projects.
Create and read feature flags, review experiments, generate flag types, search docs, and interact with GrowthBook's feature flagging and experimentation platform.
Official MCP server for Stimulsoft Reports & Dashboards documentation. Semantic search across FAQ, Programming Manual, Server/User Manual, and Server/Cloud API for .NET, WPF, Avalonia, WEB, Blazor, Angular, React, JS, PHP, Java, and Python platforms.
Persistent code index using Tree-sitter for fast, precise code search. Replaces grep with ~50 token responses instead of 2000+.
AmazingMCP — MCP Server for .NET / C# Codebases
An MCP server that gives AI agents deep understanding of C# codebases via Roslyn — type search, dependency graphs, usage analysis, and architecture overviews, all from a live in-memory compilation.
Search Apple's official developer documentation for iOS, macOS, SwiftUI, WWDC videos, and more.
Search Apple's Developer Documentation with smart search and wildcard support.
A platform-agnostic code analysis library with semantic search capabilities and MCP server support.
Enforce consistent C++ style and best practices across your codebase. Analyze naming conventions, memory safety, and const correctness, and get actionable modernization suggestions up to C++23. Accelerate reviews with ready-made prompts and quick access to curated guidelines.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




