GitLab AI MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitLab AI MCP ServerList merge requests needing review in the main project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitLab AI MCP Server
A high-performance, containerized Model Context Protocol (MCP) server that connects AI coding assistants (Claude, Codex, Gemini, Kimi) to any GitLab instance β self-hosted or cloud.
What you can do
Area | Actions |
Projects & Issues | List, search, create, update, label, assign |
Merge Requests | Review diffs, manage discussions, approve, merge, rebase |
CI/CD | Inspect pipelines, read job logs, retry/cancel jobs, manage variables |
Repository | Browse files, read content, create batch commits, manage branches & tags |
Search | Code search, global search, user search |
Security | Vulnerability findings, dependency list (SBOM), audit events |
Local AI | Triage job logs, scan MR diffs for secrets, summarize discussions β all run locally via Ollama |
Related MCP server: GitLab MCP Server
π Quick Start
Prerequisites
Docker and Docker Compose v2
A GitLab Personal Access Token with
apiscope
WSL2 (Windows users): Install Docker Desktop for Windows with the WSL2 backend enabled β this is the easiest path. All commands below are run inside your WSL2 terminal.
1. Clone and configure
git clone https://github.com/haziqasjad/gitlab-ai-mcp.git
cd gitlab-ai-mcp
cp .env.example .envEdit .env:
GITLAB_URL=https://gitlab.example.com # your GitLab instance URL
GITLAB_TOKEN=glpat-your-token # your Personal Access Token2. Choose your setup and start
Option A β Core only (recommended to start β no local AI, works on any machine):
docker compose up -d --buildOption B β With local AI on CPU (Ollama runs on CPU, ~4 GB model download on first run):
docker compose --profile ollama up -d --buildOption C β With local AI on NVIDIA GPU (fastest inference β requires extra setup below):
docker compose --profile ollama -f docker-compose.yml -f docker-compose.gpu.yml up -d --buildOptions B and C enable extra AI features: log triage, privacy scanning, discussion summarisation. If Ollama is not running, these features return a clear error β all other features work normally.
Setting up NVIDIA GPU (Option C only)
Skip this section if you don't have an NVIDIA GPU β Option B works fine on CPU.
π§ Native Linux
Step 1 β Verify your NVIDIA drivers are installed:
nvidia-smiYou should see your GPU listed. If not, install the drivers for your distro first: NVIDIA Driver Downloads
Step 2 β Install NVIDIA Container Toolkit (Ubuntu/Debian):
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt update && sudo apt install -y nvidia-container-toolkitFor other distros, see the official install guide.
Step 3 β Configure Docker and verify:
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
# Confirm Docker can see your GPU
docker run --rm --gpus all ubuntu nvidia-smiStep 4 β Start the stack:
docker compose --profile ollama -f docker-compose.yml -f docker-compose.gpu.yml up -d --buildπͺ WSL2 (Windows)
WSL2 uses the NVIDIA drivers installed on Windows β you do not install GPU drivers inside WSL.
Step 1 β Install NVIDIA drivers on Windows (if not already installed):
Download and install from NVIDIA Driver Downloads. Reboot Windows after installing.
Step 2 β Verify GPU is visible inside WSL2:
nvidia-smiIf this works, your GPU is available in WSL2. If not, make sure you have WSL2 (not WSL1):
wsl --set-default-version 2Step 3 β Install NVIDIA Container Toolkit inside WSL2:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt update && sudo apt install -y nvidia-container-toolkitStep 4 β Configure Docker:
If using Docker Desktop for Windows (recommended):
Open Docker Desktop β Settings β Resources β GPU β enable your GPU β Apply & Restart
If using Docker Engine directly in WSL2:
sudo nvidia-ctk runtime configure --runtime=docker
sudo service docker restart # WSL2 uses service, not systemctlStep 5 β Verify Docker can see your GPU:
docker run --rm --gpus all ubuntu nvidia-smiStep 6 β Start the stack:
docker compose --profile ollama -f docker-compose.yml -f docker-compose.gpu.yml up -d --build3. Verify the server is running
docker compose psYou should see gitlab-ai-mcp with status Up. Test it directly:
docker compose exec gitlab-ai-mcp python run_tests.py4. Register with your AI CLI
First, get your checkout path:
pwd # run this inside the Gitlab_AI_MCP directoryWSL2 users: Use the Linux path shown by
pwd(e.g./home/yourname/Gitlab_AI_MCP), not the Windows path. Your AI CLI must be running inside the same WSL2 terminal for this path to work.
Then register using that path:
Claude Code:
claude mcp add gitlab-ai-mcp -- /your/path/to/Gitlab_AI_MCP/scripts/run_codex_mcp.shCodex CLI:
codex mcp add gitlab-ai-mcp -- /your/path/to/Gitlab_AI_MCP/scripts/run_codex_mcp.shGemini CLI:
gemini mcp add gitlab-ai-mcp -- /your/path/to/Gitlab_AI_MCP/scripts/run_codex_mcp.shKimi Code CLI:
kimi mcp add gitlab-ai-mcp -- /your/path/to/Gitlab_AI_MCP/scripts/run_codex_mcp.shβοΈ Configuration
All settings go in your .env file:
Variable | Required | Default | Description |
| Yes | β | Base URL of your GitLab instance |
| Yes | β | Personal Access Token ( |
| No |
| Enable verbose console logging |
| No |
| Ollama endpoint (Options B/C only) |
| No |
| Ollama model name |
| No |
| API retry attempts on failure |
| No |
| Base delay between retries (seconds) |
π§ Troubleshooting
Container won't start:
docker compose logs gitlab-ai-mcpGITLAB_TOKEN or GITLAB_URL errors:
Make sure your
.envfile exists and has no extra spaces around=Confirm your token has
apiscope in GitLab β Settings β Access Tokens
Ollama model not downloading (Options B/C):
docker compose logs gitlab-ai-ollama-pullGPU not detected (Option C):
Run
nvidia-smiβ if this fails, your drivers are not installedRun
docker run --rm --gpus all ubuntu nvidia-smiβ if this fails, the Container Toolkit is not configured
WSL2 β nvidia-smi not found inside WSL:
Make sure you are on WSL2, not WSL1: run
wsl --list --verbosein PowerShell and check the VERSION columnInstall NVIDIA drivers on Windows (not inside WSL) and reboot
WSL2 β systemctl: command not found:
WSL2 does not use systemd by default β use
sudo service docker restartinsteadOr enable systemd in WSL2: add
[boot] systemd=trueto/etc/wsl.conf, then restart WSL (wsl --shutdownin PowerShell)
WSL2 β Docker Desktop GPU toggle missing:
Requires Docker Desktop 4.17 or later and WSL2 backend β update Docker Desktop if the GPU option is not visible
WSL2 β docker compose not found:
Docker Desktop installs Compose automatically β open Docker Desktop and ensure it is running before using the WSL2 terminal
π Project Structure
server.py β MCP server entrypoint
config.py β Settings (reads from .env)
gitlab/client.py β Async HTTP/2 GitLab API client
services/
gitlab_service.py β Business logic and response formatting
local_ai_service.py β Ollama integration for local AI features
review_digest.py β MR discussion digest helpers
tools/ β MCP tool definitions (one file per domain)
tests/ β Unit tests
scripts/run_codex_mcp.sh β Launcher used by all AI CLIs
docker-compose.yml β Base stack
docker-compose.gpu.yml β NVIDIA GPU override (use with --profile ollama)This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceConnects AI assistants to GitLab, allowing users to manage merge requests, view reviews, and interact with discussions through natural language queries.1225MIT
- Flicense-quality-maintenanceConnects AI assistants to GitLab projects, enabling natural language queries for merge requests, code reviews, pipeline tests, job logs, and commit discussions with support for responding to comments.
- Flicense-quality-maintenanceConnects AI assistants to GitLab projects, enabling natural language queries to view merge requests, code reviews, test reports, pipeline statuses, and respond to discussions.
- Flicense-quality-maintenanceConnects AI assistants to GitLab projects, enabling users to query merge requests, review discussions, view test results and pipelines, search by branch, and respond to comments through natural language commands.
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analyβ¦
Connect AI assistants to Stellary projects, boards, documents, and governed agent workflows.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/haziqasjad/gitlab-ai-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server