# OpenGrok MCP Server

Connects an AI coding client to an OpenGrok index for symbol search, file reading, blame, history, and call relationships across large codebases.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 10
- Author: IcyHot09
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/IcyHot09/opengrok-mcp-server
- Updated: 2026-09-25
- HTML: https://affpapa.org/en/nevibecode/mcp/opengrok-mcp-server

## What it does

OpenGrok MCP Server gives an MCP client access to an OpenGrok instance through its REST API, with a web fallback. An agent can search source and history, locate files and symbols, read selected code ranges, inspect blame, review file history, and trace calls or dependencies.

Code Mode exposes `opengrok_api` and `opengrok_execute`. The agent writes one JavaScript script for a multi-step investigation, while intermediate results stay inside the sandbox. Two files, `active-task.md` and `investigation-log.md`, can retain investigation state between turns. A working OpenGrok URL, username, and password are required for setup.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `OPENGROK_BASE_URL`, `OPENGROK_USERNAME`, `OPENGROK_PASSWORD`, `OPENGROK_VERIFY_SSL`, `OPENGROK_CODE_MODE`, `OPENGROK_ENABLE_MEMORY_TOOLS`, `OPENGROK_DEFAULT_PROJECT`, `OPENGROK_CONTEXT_BUDGET`, `OPENGROK_API_VERSION`, `HTTP_PROXY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env OPENGROK_BASE_URL=<OPENGROK_BASE_URL> --env OPENGROK_USERNAME=<OPENGROK_USERNAME> --env OPENGROK_PASSWORD=<OPENGROK_PASSWORD> --env OPENGROK_VERIFY_SSL=<OPENGROK_VERIFY_SSL> --env OPENGROK_CODE_MODE=<OPENGROK_CODE_MODE> --transport stdio opengrok-mcp-server -- npx -y opengrok-mcp-server
```
Replace <…> with your own values. 26 more environment variables are in the server README

### Codex

**Platform CLI**
```bash
codex mcp add opengrok-mcp-server --env OPENGROK_BASE_URL=<OPENGROK_BASE_URL> --env OPENGROK_USERNAME=<OPENGROK_USERNAME> --env OPENGROK_PASSWORD=<OPENGROK_PASSWORD> --env OPENGROK_VERIFY_SSL=<OPENGROK_VERIFY_SSL> --env OPENGROK_CODE_MODE=<OPENGROK_CODE_MODE> -- npx -y opengrok-mcp-server
```
Replace <…> with your own values. 26 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "opengrok-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "opengrok-mcp-server"
            ],
            "env": {
                "OPENGROK_BASE_URL": "<OPENGROK_BASE_URL>",
                "OPENGROK_USERNAME": "<OPENGROK_USERNAME>",
                "OPENGROK_PASSWORD": "<OPENGROK_PASSWORD>",
                "OPENGROK_VERIFY_SSL": "<OPENGROK_VERIFY_SSL>",
                "OPENGROK_CODE_MODE": "<OPENGROK_CODE_MODE>"
            }
        }
    }
}
```
Replace <…> with your own values. 26 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "opengrok-mcp-server": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "opengrok-mcp-server"
            ],
            "env": {
                "OPENGROK_BASE_URL": "<OPENGROK_BASE_URL>",
                "OPENGROK_USERNAME": "<OPENGROK_USERNAME>",
                "OPENGROK_PASSWORD": "<OPENGROK_PASSWORD>",
                "OPENGROK_VERIFY_SSL": "<OPENGROK_VERIFY_SSL>",
                "OPENGROK_CODE_MODE": "<OPENGROK_CODE_MODE>"
            }
        }
    }
}
```
Replace <…> with your own values. 26 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e OPENGROK_BASE_URL=<OPENGROK_BASE_URL> -e OPENGROK_USERNAME=<OPENGROK_USERNAME> -e OPENGROK_PASSWORD=<OPENGROK_PASSWORD> -e OPENGROK_VERIFY_SSL=<OPENGROK_VERIFY_SSL> -e OPENGROK_CODE_MODE=<OPENGROK_CODE_MODE> opengrok-mcp-server npx -y opengrok-mcp-server
```
Replace <…> with your own values. 26 more environment variables are in the server README

## When to use it
- find symbol definitions and references
- read a selected range from a large file
- inspect who changed a line or file
- trace callers of a service or method
- map dependencies before a refactor

## Example prompts
- Find every reference to `authenticate` and group the results by file.
- Read the implementation of `PaymentService`, then inspect its change history and authors.
- Trace callers of `parseConfig` and record the findings in `investigation-log.md`.

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
