MCP server for cross-referenced code navigation across the EIC codebase, powered by the LXR engine at BNL.
Provides AI assistants with structured access to 55+ indexed EIC repositories — identifier cross-references, ripgrep search, source file reading, and directory browsing.
Browse the code directly: https://eic-code-browser.sdcc.bnl.gov/lxr/source
| Tool | Description |
|---|---|
lxr_ident |
Find where a symbol (class, function, variable) is defined and referenced across all repos |
lxr_search |
Ripgrep-powered regex/text search across the entire codebase |
lxr_source |
Read source files with line numbers and optional range filtering |
lxr_list |
Browse directory contents and repository structure |
pip install -r requirements.txt
python lxr_mcp_server.py- Clone the repo and install dependencies:
git clone https://github.com/BNLNPPS/lxr-mcp-server.git
pip install -r lxr-mcp-server/requirements.txt- Add to your Claude Code MCP config (
~/.claude/settings.jsonor project.mcp.json):
{
"mcpServers": {
"lxr": {
"command": "python",
"args": ["/path/to/lxr-mcp-server/lxr_mcp_server.py"]
}
}
}- Restart Claude Code.
The LXR code browser at eic-code-browser.sdcc.bnl.gov is accessible from inside the BNL network. From outside BNL, an SSH tunnel works (same approach as for remote SSH access to BNL machines). Set LXR_BASE_URL to point at your tunnel endpoint.
| Variable | Default | Description |
|---|---|---|
LXR_BASE_URL |
https://eic-code-browser.sdcc.bnl.gov/lxr |
LXR instance URL |
LXR_CONFIG |
lxr_config.yaml (next to server script) |
Path to config file |
Find all definitions of a C++ class:
lxr_ident(symbol="CalorimeterHitDigi", definitions_only=True)
Search for a pattern in header files:
lxr_search(pattern="InitPlugin", file_pattern="*.cc", max_results=20)
Read specific lines of a source file:
lxr_source(path="EICrecon/src/algorithms/calorimetry/CalorimeterHitDigi.h", start_line=40, end_line=60)
List top-level repositories:
lxr_list(path="")
Currently parses HTML from the LXR web interface. A future version could run directly on the LXR host and query the cross-reference index natively for better performance.
Apache 2.0 — see LICENSE.