MCP server for CERN GitLab - code discovery, documentation access, and usage examples for HEP projects
Project description
CERN GitLab MCP Server
An MCP server that connects LLMs to CERN GitLab for discovering HEP code, documentation, and analysis examples.
Features
- 13 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
.rootfiles, 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 |
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:
- Go to https://gitlab.cern.ch/-/user_settings/personal_access_tokens
- Create a token with
read_apiscope - 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"
}
}
}
}
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
# Or from source
uv run cerngitlab-mcp
# With authentication
CERNGITLAB_TOKEN=glpat-xxx uvx cerngitlab-mcp
Tools
| Tool | Description | Auth required |
|---|---|---|
search_repositories |
Search public repositories by keywords, topics, or language | No |
get_repository_info |
Get repository details (languages, stats, license) | No |
list_repository_files |
Browse the file tree of a repository | No |
get_file_content |
Retrieve file content with binary detection | No |
get_repository_readme |
Get the README file (tries common filenames) | No |
search_code |
Search for code across repositories | Yes* |
search_issues |
Search for issues and discussions | Yes |
get_wiki_pages |
Access repository wiki pages | Yes |
inspect_project |
Analyze project structure, build system, dependencies, and CI | No |
list_releases |
List releases from a repository | No |
get_release |
Get details of a specific release | No |
list_tags |
List repository tags with optional filtering | No |
test_connectivity |
Test connection to the GitLab instance | No |
* search_code works without auth for project-scoped search (uses fallback grep). Global search requires authentication.
For detailed parameter documentation, see docs/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"
Analyze a project structure
"Inspect the lhcb/allen project to understand its build system, dependencies, and CI pipeline configuration"
Find usage context
"Search for issues related to 'segmentation fault' in the atlas/athena project to see if others have encountered this"
Track releases
"List the recent releases of lhcb/DaVinci and show me the release notes for the latest version"
Find framework configurations
"Search for Gaudi framework configuration files on CERN GitLab and show me examples"
Development
See docs/dev.md for development setup, project structure, testing, and release instructions.
License
AGPL-3.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cerngitlab_mcp-0.1.2.tar.gz.
File metadata
- Download URL: cerngitlab_mcp-0.1.2.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf03da1355b608f9a0f4ce30a6c49fb3fb480271c70e90a961aad49c96b08e58
|
|
| MD5 |
879fb680106425265026bf39377092e6
|
|
| BLAKE2b-256 |
a3bba3bde25ceb3c7943c5550b2991df87c8c027c63487d6f2022866b45974a7
|
Provenance
The following attestation bundles were made for cerngitlab_mcp-0.1.2.tar.gz:
Publisher:
release.yml on MohamedElashri/cerngitlab-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cerngitlab_mcp-0.1.2.tar.gz -
Subject digest:
cf03da1355b608f9a0f4ce30a6c49fb3fb480271c70e90a961aad49c96b08e58 - Sigstore transparency entry: 956511364
- Sigstore integration time:
-
Permalink:
MohamedElashri/cerngitlab-mcp@640526b933e1bb7d506efdb1fe5db86be3beaa03 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MohamedElashri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@640526b933e1bb7d506efdb1fe5db86be3beaa03 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cerngitlab_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: cerngitlab_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 40.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
858654c84042cb816ef38b45c391b900354b16ec39b848091b9020a65a04859a
|
|
| MD5 |
4fead8827f1fda60a9067c6b54887818
|
|
| BLAKE2b-256 |
d00f73864d6e6140260868bbae06e739373ec24cf3cea0d31ccac9acc387dbfd
|
Provenance
The following attestation bundles were made for cerngitlab_mcp-0.1.2-py3-none-any.whl:
Publisher:
release.yml on MohamedElashri/cerngitlab-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cerngitlab_mcp-0.1.2-py3-none-any.whl -
Subject digest:
858654c84042cb816ef38b45c391b900354b16ec39b848091b9020a65a04859a - Sigstore transparency entry: 956511390
- Sigstore integration time:
-
Permalink:
MohamedElashri/cerngitlab-mcp@640526b933e1bb7d506efdb1fe5db86be3beaa03 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MohamedElashri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@640526b933e1bb7d506efdb1fe5db86be3beaa03 -
Trigger Event:
push
-
Statement type: