CERN GitLab MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add cern-gitlab-mcp -- uvx cerngitlab-mcp
README.md

Connects LLMs to CERN GitLab for discovering HEP code and documentation.

CERN GitLab MCP Server

An MCP server that connects LLMs to CERN GitLab for discovering HEP code, documentation, and analysis examples.

Features

  • 14 MCP tools for searching, browsing, and analyzing CERN GitLab repositories
  • CLI tool (cerngitlab-cli) for direct command-line usage
  • Public access — works without authentication for public repositories
  • HEP-focused — dependency parsing for Python and C++ ecosystems, binary detection for .root files, issue search
  • Robust — rate limiting, retries with exponential backoff, graceful error handling

Installation

Requires Python 3.10+.

Quickstart (recommended)

No installation needed — just use `uvx` to run directly:

uvx cerngitlab-mcp

From PyPI

pip install cerngitlab-mcp

From source

git clone https://github.com/MohamedElashri/cerngitlab-mcp
cd cerngitlab-mcp
uv sync

Configuration

All settings are configured via environment variables prefixed with CERNGITLAB_:

Variable Default Description
CERNGITLAB_GITLAB_URL https://gitlab.cern.ch GitLab instance URL
CERNGITLAB_TOKEN (empty) Personal access token (optional)
CERNGITLAB_TIMEOUT 30 HTTP timeout in seconds
CERNGITLAB_MAX_RETRIES 3 Max retries for failed requests
CERNGITLAB_RATE_LIMIT_PER_MINUTE 300 API rate limit
CERNGITLAB_LOG_LEVEL INFO Logging level
CERNGITLAB_DEFAULT_REF (empty) Default Git branch or tag to search within (e.g., main, master, v1.2.0). Empty means search all branches.

Authentication

The server works in two modes:

  • Without token — Access to all public repositories. Sufficient for most HEP code discovery.
  • With token — Additional access to internal/private projects, code search, and wiki pages.

To create a token:

  1. Go to https://gitlab.cern.ch/-/user_settings/personal_access_tokens
  2. Create a token with read_api scope
  3. Set CERNGITLAB_TOKEN=glpat-xxxxxxxxxxxx

Note: The code search (search_code), issue search (search_issues), and wiki (get_wiki_pages) tools require authentication on CERN GitLab.

Usage

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "cerngitlab": {
      "command": "uvx",
      "args": ["cerngitlab-mcp"],
      "env": {
        "CERNGITLAB_TOKEN": "glpat-xxxxxxxxxxxx"
      }
    }
  }
}

Note for macOS users: If you see an error about uvx not being found, you may need to provide the absolute path. Claude Desktop does not support ~ or $HOME expansion.

  1. Run which uvx in your terminal to find the path (e.g., /Users/yourusername/.local/bin/uvx).
  2. Use that absolute path in the command field:
"command": "/Users/yourusername/.local/bin/uvx"

Claude Code

Project-specific (default) — installs in the current directory's configuration:

claude mcp add cerngitlab-mcp -- uvx cerngitlab-mcp

Global — installs for your user account (works in all projects):

claude mcp add --scope user cerngitlab-mcp -- uvx cerngitlab-mcp

To include authentication, add -e CERNGITLAB_TOKEN=glpat-xxxxxxxxxxxx before the --:

# Example: Global installation with token
claude mcp add --scope user -e CERNGITLAB_TOKEN=glpat-xxxxxxxxxxxx cerngitlab-mcp -- uvx cerngitlab-mcp

Manual Configuration — you can also manually edit your global config at ~/.claude.json (on Linux/macOS) or %APPDATA%\Claude\claude.json (on Windows):

{
  "mcpServers": {
    "cerngitlab": {
      "command": "uvx",
      "args": ["cerngitlab-mcp"],
      "env": {
        "CERNGITLAB_TOKEN": "glpat-xxxxxxxxxxxx"
      }
    }
  }
}

GitHub Copilot

Add to your VS Code settings.json:

{
  "mcp": {
    "servers": {
      "cerngitlab": {
        "command": "uvx",
        "args": ["cerngitlab-mcp"],
        "env": {
          "CERNGITLAB_TOKEN": "glpat-xxxxxxxxxxxx"
        }
      }
    }
  }
}

Or add a .vscode/mcp.json to your project:

{
  "servers": {
    "cerngitlab": {
      "command": "uvx",
      "args": ["cerngitlab-mcp"],
      "env": {
        "CERNGITLAB_TOKEN": "glpat-xxxxxxxxxxxx"
      }
    }
  }
}

Gemini CLI

Add to your ~/.gemini/settings.json:

{
  "mcpServers": {
    "cerngitlab": {
      "command": "uvx",
      "args": ["cerngitlab-mcp"],
      "env": {
        "CERNGITLAB_TOKEN": "glpat-xxxxxxxxxxxx"
      }
    }
  }
}

Direct usage

# Run with uvx (no install needed)
uvx cerngitlab-mcp

# Or if installed from PyPI
cerngitlab-mcp

#

Tools (3)

search_codeSearch for code within CERN GitLab repositories.
search_issuesSearch for issues within CERN GitLab repositories.
get_wiki_pagesRetrieve wiki pages from a project.

Environment Variables

CERNGITLAB_GITLAB_URLGitLab instance URL
CERNGITLAB_TOKENPersonal access token for private project access
CERNGITLAB_TIMEOUTHTTP timeout in seconds
CERNGITLAB_MAX_RETRIESMax retries for failed requests
CERNGITLAB_RATE_LIMIT_PER_MINUTEAPI rate limit
CERNGITLAB_LOG_LEVELLogging level
CERNGITLAB_DEFAULT_REFDefault Git branch or tag to search within

Configuration

claude_desktop_config.json
{"mcpServers": {"cerngitlab": {"command": "uvx", "args": ["cerngitlab-mcp"], "env": {"CERNGITLAB_TOKEN": "glpat-xxxxxxxxxxxx"}}}}

Try it

Search for recent code implementations related to Higgs boson analysis in the CERN GitLab repositories.
Find all open issues related to the Python dependency configuration in the main HEP analysis project.
Retrieve the documentation from the project wiki for the latest C++ analysis framework.
List the contents of the repository and identify any .root binary files.

Frequently Asked Questions

What are the key features of CERN GitLab MCP Server?

14 MCP tools for searching, browsing, and analyzing CERN GitLab repositories. Dependency parsing for Python and C++ ecosystems. Binary detection for .root files. Public access support for public repositories. Robust error handling with rate limiting and exponential backoff.

What can I use CERN GitLab MCP Server for?

Discovering and analyzing High Energy Physics (HEP) code examples. Searching through internal CERN project documentation and wikis. Automating the analysis of CI/CD configurations in research repositories. Parsing dependencies for Python and C++ based physics analysis projects.

How do I install CERN GitLab MCP Server?

Install CERN GitLab MCP Server by running: uvx cerngitlab-mcp

What MCP clients work with CERN GitLab MCP Server?

CERN GitLab MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep CERN GitLab MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare