server

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

README

chromium-code-mcp

Go Reference Go Report Card Go Version

An MCP server that provides AI assistants with access to Chromium development services. Covers code search, file retrieval, Gerrit code review, LUCI CI, the issue tracker, and reviewer suggestions — all through a single JSON-RPC interface.

Tools

Tool Description
search_chromium_code Full-text and structural code search using source.chromium.org syntax (class:, function:, symbol:, lang:, file:, etc.)
find_chromium_symbol Look up symbol definitions, class/function declarations, and usage examples
get_chromium_file Fetch a source file by path, optionally limited to a line range
list_chromium_folder List directory contents in the source tree
find_chromium_owners Show OWNERS files for a given path, from most-specific to root
search_chromium_commits Search the commit log by message text, author, or date range
Gerrit (Chromium)
Tool Description
get_gerrit_cl_status CL metadata, submit requirements, and latest LUCI run status
get_gerrit_cl_comments Review comments for a patchset, grouped by file, with inline code context
get_gerrit_cl_diff Changed-file summary or per-file unified diff
get_gerrit_patchset_file Full content of a specific file from a patchset
get_gerrit_cl_trybot_status Try-bot results from the latest LUCI run
get_gerrit_cl_bot_errors Detailed test failures and stack traces from failed bots
list_gerrit_cls List CLs matching a Gerrit search query (requires auth cookie)
suggest_chromium_reviewers Suggest optimal reviewers by analyzing OWNERS files and recent commit activity
Gerrit (PDFium)

Same capabilities as the Chromium tools above, targeting the PDFium review instance: get_pdfium_gerrit_cl_status, get_pdfium_gerrit_cl_comments, get_pdfium_gerrit_cl_diff, get_pdfium_gerrit_patchset_file, get_pdfium_gerrit_cl_trybot_status, list_pdfium_gerrit_cls

CI / Issue Tracker
Tool Description
get_chromium_build_errors Fetch failed tests and error output from a Buildbucket build URL or ID
get_chromium_issue Fetch a single Chromium bug by ID or URL
search_chromium_issues Search issues.chromium.org with pagination support

Installation

Option 1 — Download a pre-built binary

Grab the latest release from the Releases page and pick the archive for your platform:

Platform Archive
Linux (x86-64) chromium-code-mcp-<version>-linux-amd64.tar.gz
Linux (ARM64) chromium-code-mcp-<version>-linux-arm64.tar.gz
macOS (Apple Silicon) chromium-code-mcp-<version>-darwin-arm64.tar.gz
Windows (x86-64) chromium-code-mcp-<version>-windows-amd64.zip

Extract and place the binary somewhere on your PATH, e.g.:

tar xzf chromium-code-mcp-<version>-linux-amd64.tar.gz
mv chromium-code-mcp ~/.local/bin/

Option 2 — go install

Prerequisites: Go 1.25+

go install github.com/dgavrilov/chromium-code-mcp/cmd/chromium-code-mcp@latest

The binary is placed in $GOPATH/bin (usually ~/go/bin). Make sure that directory is on your PATH:

export PATH="$PATH:$(go env GOPATH)/bin"
Build from source
git clone https://github.com/dgavrilov/chromium-code-mcp
cd chromium-code-mcp
go build -ldflags "-X 'github.com/dgavrilov/chromium-code-mcp.Version=1.0.0'" ./cmd/chromium-code-mcp

Configuration

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "chromium": {
      "command": "/path/to/chromium-code-mcp"
    }
  }
}
Claude Code

Add to your project's .mcp.json or run:

claude mcp add chromium /path/to/chromium-code-mcp
Code Search API key (optional)

The server uses a public API key for code search by default. To use your own:

export CHROMIUM_SEARCH_API_KEY=your_key_here

Usage examples

Search for all callers of a function:
  search_chromium_code("TabStripModel::AddWebContents", search_type="function")

Get a file with line range:
  get_chromium_file("chrome/browser/ui/browser.cc", line_start=100, line_end=150)

Check a CL's review status:
  get_gerrit_cl_status("6624568")

See what failed in CI:
  get_gerrit_cl_bot_errors("6624568")

Suggest reviewers:
  suggest_chromium_reviewers("6624568", max_reviewers=3)

Development

Prerequisites: Go 1.25+, Task, golangci-lint

task build                   # build the binary (version = "dev")
task build VERSION=1.0.0     # build with a specific version
task test                    # run all tests
task lint                    # run golangci-lint
task coverage                # generate and display coverage report
task fmt                     # gofmt all source files

Project structure

chromium-code-mcp/     # package server — MCP protocol + tool registry
  server.go            # Run() — starts MCP server over stdio via go-sdk
  tools.go             # registerTools() — wires all 23 tools via mcp.AddTool
  version.go           # Version variable (set via ldflags at build time)
  cmd/chromium-code-mcp/
    main.go            # Binary entry point
  internal/chromium/   # Chromium API clients (package chromium)
    client.go          # HTTP client, bounded FIFO cache, HTTPDoer interface
    utils.go           # Shared utilities (JSON decoding, glob matching, etc.)
    search.go          # Code Search API
    gitiles.go         # Gitiles (file/folder/commits/OWNERS)
    gerrit.go          # Gerrit API
    luci.go            # LUCI / Buildbucket / ResultDB
    issues.go          # Issue tracker
    reviewers.go       # Reviewer suggestion algorithm

Architecture notes

  • All internal/chromium exported methods take context.Context as their first parameter and return (string, error). The string is always Markdown-formatted output ready for the MCP caller. User-visible errors (bad input, HTTP 404) are returned as text with nil error; only unexpected failures propagate as non-nil errors.
  • HTTP responses are cached in a bounded FIFO in-memory cache (100 entries). The HTTPDoer interface (Do(*http.Request) (*http.Response, error)) allows injecting mock transports in tests.
  • Reviewer suggestion uses a greedy set-cover algorithm over OWNERS files, optionally weighted by 6-month commit activity fetched in parallel from Gitiles.

License

BSD 3-Clause. See LICENSE.

Documentation

Overview

Package server implements the MCP server using the official go-sdk.

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is the server version. Set at build time via:

go build -ldflags "-X 'github.com/dgavrilov/chromium-code-mcp.Version=1.2.3'"

Functions

func Run

func Run() error

Run starts the MCP server over stdio.

Types

This section is empty.

Directories

Path Synopsis
cmd
chromium-code-mcp command
Package main is the entry point for the chromium-code-mcp MCP server.
Package main is the entry point for the chromium-code-mcp MCP server.
internal
chromium
Package chromium provides clients for the various Chromium developer APIs: Code Search, Gitiles, Gerrit, LUCI, the issue tracker, and reviewer suggestions.
Package chromium provides clients for the various Chromium developer APIs: Code Search, Gitiles, Gerrit, LUCI, the issue tracker, and reviewer suggestions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL