GitLab MCP Server + Cursor IDE: Full Setup Guide (2026)
Connect GitLab to Cursor IDE using MCP. Add the GitLab MCP server config to your mcp.json and let your AI manage issues, MRs & pipelines directly.
GitLab MCP Server Cursor IDE Setup 2026
If your team runs on GitLab — whether GitLab.com or a self-hosted instance — the GitLab MCP server lets Cursor interact with your repositories, merge requests, and CI/CD pipelines without leaving your editor. This guide covers the full setup for 2026.
What the GitLab MCP Server Enables
Once connected, Cursor can:
Prerequisites
Step 1: Create a GitLab Personal Access Token
1. Log into GitLab → click your avatar → Preferences
2. Go to Access Tokens in the left sidebar
3. Click Add new token
4. Name it cursor-mcp-2026
5. Set an expiration date (or leave blank for no expiry)
6. Select these scopes:
api — full API access (required for MR creation and pipeline triggers)read_repository — read repo contentswrite_repository — create branches and push7. Click Create personal access token
8. Copy the token immediately — it will not be shown again
Step 2: Install the GitLab MCP Server
npm install -g @modelcontextprotocol/server-gitlab
Or use the community package:
npm install -g gitlab-mcp-server
Verify the installation:
gitlab-mcp-server --version
Step 3: Configure Cursor IDE
Open Cursor → Settings → MCP and add the GitLab server config:
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
For self-hosted GitLab, change the API URL:
"GITLAB_API_URL": "https://gitlab.yourcompany.com/api/v4"
Restart Cursor to load the configuration.
Step 4: Test the Connection
In Cursor chat, try:
List my GitLab projects
Or:
Show me the open merge requests in the backend-api project
A successful response with real data confirms the connection is working.
Step 5: Real-World Usage Patterns
Code review assistance
Read merge request !47 in the payments-service project. Summarize the changes and flag any potential issues before I approve it.
Pre-push pipeline check
What's the status of the last CI/CD pipeline on the main branch of payments-service? Did all jobs pass?
Automated MR creation
I just finished implementing the Stripe webhook handler. Create a merge request from feature/stripe-webhooks to main with a description summarizing the changes.
Branch management
Create a new branch called feature/PROJ-892-payment-refactor from main in the backend-api project.
Issue-driven development
Find issue #234 in the frontend project, read the acceptance criteria, then implement what's described in the current working directory.
Pipeline job debugging
The deploy-staging job failed in the last pipeline on feature/new-auth. Fetch the job log and tell me what went wrong.
Self-Hosted GitLab Configuration
For GitLab Self-Managed (CE or EE), the setup is the same but with your instance URL:
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx",
"GITLAB_API_URL": "https://gitlab.yourcompany.com/api/v4",
"GITLAB_DEFAULT_NAMESPACE": "your-group-or-username"
}
}
}
}
If your self-hosted instance uses a self-signed certificate, you may need:
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
(Only use this in a trusted corporate environment — it disables TLS verification.)
GitLab vs GitHub MCP: Which Should You Use?
If your team is split between GitLab and GitHub, you can run both MCP servers simultaneously:
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "glpat-xxx"
}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx"
}
}
}
}
Cursor will have access to both simultaneously. Specify the platform in your prompts: "in GitLab, create a merge request..." vs "on GitHub, open a pull request..."
Troubleshooting
"403 Forbidden" when creating MRs
You need the api scope on your token — read_repository alone is not sufficient for write operations.
"Project not found" error
Use the full project path: group/subgroup/project-name, not just the project name. GitLab requires the namespace path for unambiguous project references.
Self-hosted SSL errors
If you get certificate errors on a self-hosted instance, ensure your system trusts the certificate authority. Running curl https://gitlab.yourcompany.com/api/v4/version in terminal will show you the same error Cursor sees.
Rate limiting
GitLab API rate limits are typically 2,000 requests/minute for authenticated users. For bulk operations, add natural language pacing: "check the 5 most recent MRs" rather than "check all open MRs."
Summary
The GitLab MCP server is one of the most practically useful integrations for teams using GitLab as their primary DevOps platform. The ability to create MRs, check pipeline status, and read issue context from within Cursor removes significant context-switching overhead from daily development workflow.
Setup takes about 10 minutes. The key requirement is a Personal Access Token with api scope. For teams on the Atlassian stack, also see our guides for Jira MCP and Confluence MCP.