cerngitlab-mcp

CERN GitLab MCP Server

Features

  • 14 MCP tools for searching, browsing, and analyzing CERN GitLab repositories
  • Public access — works without authentication for public repositories
  • HEP-focused — dependency parsing for Python and C++ ecosystems, binary detection for .root files
  • 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_:

VariableDefaultDescription
CERNGITLAB_GITLAB_URLhttps://gitlab.cern.chGitLab instance URL
CERNGITLAB_TOKEN(empty)Personal access token (optional)
CERNGITLAB_TIMEOUT30HTTP timeout in seconds
CERNGITLAB_MAX_RETRIES3Max retries for failed requests
CERNGITLAB_RATE_LIMIT_PER_MINUTE300API rate limit
CERNGITLAB_LOG_LEVELINFOLogging level

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) 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"
      }
    }
  }
}

Claude Code

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

To include authentication:

claude mcp add cerngitlab-mcp -e CERNGITLAB_TOKEN=glpat-xxxxxxxxxxxx -- uvx cerngitlab-mcp

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

# Or from source
uv run cerngitlab-mcp

# With authentication
CERNGITLAB_TOKEN=glpat-xxx uvx cerngitlab-mcp

Tools

ToolDescriptionAuth required
search_repositoriesSearch public repositories by keywords, topics, or languageNo
get_repository_infoGet repository details (languages, stats, license)No
list_repository_filesBrowse the file tree of a repositoryNo
get_file_contentRetrieve file content with binary detectionNo
get_repository_readmeGet the README file (tries common filenames)No
search_codeSearch for code across repositoriesYes*
get_wiki_pagesAccess repository wiki pagesYes
analyze_dependenciesParse dependency files (Python, C++, Fortran)No
get_ci_configRetrieve and analyze .gitlab-ci.ymlNo
get_build_configFind build config files (CMake, Make, setuptools, etc.)No
list_releasesList releases from a repositoryNo
get_releaseGet details of a specific releaseNo
list_tagsList repository tags with optional filteringNo
test_connectivityTest connection to the GitLab instanceNo

* search_code works without auth for project-scoped search (uses fallback grep). Global search requires authentication.

For detailed parameter documentation, see dev.md.

Example Prompts

Search for repositories

"Search CERN GitLab for Python repositories related to ROOT analysis and show me the most starred ones"

Understand a project

"Get the README and file structure of the lhcb/DaVinci project on CERN GitLab"

Find fitting examples

"Search for repositories on CERN GitLab that use RooFit and show me example fitting code"

Check dependencies

"What are the dependencies of the lhcb/allen project? Show me the CMakeLists.txt and any Python requirements"

Track releases

"List the recent releases of lhcb/DaVinci and show me the release notes for the latest version"

Explore CI/CD

"Get the CI/CD configuration of the lhcb/allen project and explain the pipeline stages"

Find framework configurations

"Search for Gaudi framework configuration files on CERN GitLab and show me examples"

Development

See dev.md for development setup, project structure, testing, and release instructions.

License

AGPL-3.0

Related Servers