First, create the virtual environment using uv and install both MCP servers into it. The default path used here is ~/.local/envs/.venv_mcp — adjust this path if you want your env somewhere else.
# Create the virtual environment
uv venv ~/.local/envs/.venv_mcp
# Install both MCP servers into it
uv pip install --python ~/.local/envs/.venv_mcp root-mcp cerngitlab-mcpAfter this, both servers are available as executables inside ~/.local/envs/.venv_mcp/bin/.
Qwen Code reads MCP servers from mcpServers in settings.json. You have two scopes: qwenlm.github
- Project scope (only current project):
.qwen/settings.jsonin your project root - User scope (all projects):
~/.qwen/settings.json
Create or edit your chosen settings.json and add the following:
{
"mcpServers": {
"root-mcp": {
"command": "/home/YOUR_USERNAME/.local/envs/.venv_mcp/bin/root-mcp",
"args": ["--data-path", "/path/to/your/root/files"],
"timeout": 30000
},
"cerngitlab": {
"command": "/home/YOUR_USERNAME/.local/envs/.venv_mcp/bin/cerngitlab-mcp",
"args": []
}
}
}Adjustments to make:
- Replace
/home/YOUR_USERNAME/with your actual home directory (runecho $HOMEto find it). On Linux this is typically/home/yourname, on macOS/Users/yourname.
- Replace
/path/to/your/root/fileswith the directory containing your.rootfiles.
- If you placed the env in a different location than
~/.local/envs/.venv_mcp, update the paths accordingly.
- If you want the servers available globally across all projects, write to
~/.qwen/settings.jsoninstead.
By default cerngitlab-mcp only accesses public repositories. To unlock private repos and additional tools like search_code and search_issues, add your CERN GitLab token:
"cerngitlab": {
"command": "/home/YOUR_USERNAME/.local/envs/.venv_mcp/bin/cerngitlab-mcp",
"args": [],
"env": {
"CERNGITLAB_TOKEN": "glpat-xxxxxxxxxxxx"
}
}Generate a token at https://gitlab.cern.ch/-/user_settings/personal_access_tokens with the read_api scope. You can also reference an existing shell variable instead of hardcoding: "CERNGITLAB_TOKEN": "$CERNGITLAB_TOKEN".
Restart Qwen Code in your project directory, then run:
qwen mcp listBoth root-mcp and cerngitlab should appear as connected. If a server shows "Disconnected", double-check that the command path is the exact absolute path to the binary inside your venv, you can verify with:
ls ~/.local/envs/.venv_mcp/bin/