GitLab MCP Server
Allows listing merge requests, issues, and pipelines from a GitLab project using the GitLab API.
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 MCP Serverlist merge requests for project 123"
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 MCP Server
A Model Context Protocol (MCP) server that exposes GitLab project data as tools consumable by AI assistants (e.g., GitHub Copilot, Claude Desktop).
Tools
Tool | Description | Parameters |
| List open merge requests in a GitLab project |
|
| List issues in a GitLab project |
|
| List recent pipelines in a GitLab project |
|
The project parameter accepts a GitLab project ID (integer) or URL-encoded namespace/path (e.g., mygroup%2Fmyrepo).
Requirements
Python 3.8+
Runtime dependencies are listed in requirements.txt and are automatically installed into an isolated virtual environment when you run start_server.sh (see Usage).
To install them manually:
pip install -r requirements.txtFor running tests:
pip install -r requirements-test.txtConfiguration
The server reads configuration from two environment variables:
Variable | Description | Example |
| Base URL of the GitLab API (v4) |
|
| GitLab Personal Access Token with |
|
Export them before starting the server:
export GITLAB_URL=https://gitlab.spectrumflow.net/api/v4
export GITLAB_TOKEN=your-personal-access-tokenUsage
Start the server
./start_server.shOn first run the script will:
Create a
.venvvirtual environment inside the project directoryInstall the packages from
requirements.txtinto that venvLaunch
mcp_server.pyusing the venv's Python interpreter
Subsequent runs reuse the existing venv and re-run the pip install step (which is a no-op if dependencies are already satisfied), so startup stays fast.
Or run manually (bring your own environment):
python3 mcp_server.pyProtocol
The server implements the Model Context Protocol (MCP) over stdio using JSON-RPC 2.0, which is the standard expected by VS Code Copilot, Claude Desktop, and other MCP clients.
Handshake sequence (performed automatically by MCP clients):
Client →
initializeServer →
initializeresult (protocolVersion, capabilities, serverInfo)Client →
notifications/initialized(notification — no response)Client →
tools/listServer → tools list
Call a tool:
{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "list_merge_requests", "arguments": {"project": "123"}}}Response:
{"jsonrpc": "2.0", "id": 3, "result": {"content": [{"type": "text", "text": "[{\"id\": 42, \"title\": \"Fix bug\"}]"}]}}Error response (e.g. missing parameter):
{"jsonrpc": "2.0", "id": 3, "error": {"code": -32602, "message": "Missing required argument: 'project'"}}GitLab API failures are returned as results with "isError": true rather than JSON-RPC errors, per the MCP specification.
VS Code / Copilot MCP Configuration
Add to your mcp.json:
{
"servers": {
"gitlab": {
"type": "stdio",
"command": "/path/to/gitlab-mcp-server/start_server.sh",
"env": {
"GITLAB_URL": "https://gitlab.spectrumflow.net/api/v4",
"GITLAB_TOKEN": "your-personal-access-token"
}
}
}
}Testing
The test suite has 58 tests across three layers. No network calls are made — all GitLab HTTP interactions are mocked.
python -m pytestLayer | File | What it tests |
Unit |
| Tool functions ( |
Integration (in-process) |
|
|
Integration (subprocess) |
| Real process spawned via |
Run a specific layer:
python -m pytest tests/unit/
python -m pytest tests/integration/Project Structure
gitlab-mcp-server/
├── mcp_server.py # MCP server implementation
├── start_server.sh # Startup script (bootstraps venv automatically)
├── requirements.txt # Runtime dependencies
├── requirements-test.txt # Test-only dependencies
├── pytest.ini # pytest configuration
├── README.md
├── .venv/ # Auto-created virtual environment (git-ignored)
└── tests/
├── conftest.py # Shared pytest fixtures and env var setup
├── unit/
│ └── test_tools.py # Unit tests for tool functions
└── integration/
├── test_main_loop.py # In-process integration tests for main()
└── test_subprocess.py # Subprocess integration testsThis 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.
Latest Blog Posts
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/kyle-bober/gitlab-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server