The GitLab MCP Server allows you to interact with your GitLab account through the Model Context Protocol (MCP). It enables powerful operations like analyzing merge requests, reviewing code, fetching diffs, and managing repositories directly from MCP-compatible AI assistants.
git clone https://github.com/rifqi96/mcp-gitlab.git
cd mcp-gitlab
npm install
npm run build
The GitLab MCP Server requires configuration in your MCP settings file to authenticate with the GitLab API.
Add this to your MCP settings file at ~/Library/Application Support/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
:
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": [
"/path/to/mcp-gitlab/build/index.js"
],
"env": {
"GITLAB_API_TOKEN": "YOUR_GITLAB_API_TOKEN",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
Add this to your MCP settings file at ~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": [
"/path/to/mcp-gitlab/build/index.js"
],
"env": {
"GITLAB_API_TOKEN": "YOUR_GITLAB_API_TOKEN",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
Replace /path/to/mcp-gitlab/build/index.js
with the actual path to the built server on your system, and YOUR_GITLAB_API_TOKEN
with your GitLab API token. You can generate a token in GitLab under Settings > Access Tokens.
After installation and configuration, you can use the GitLab MCP Server through your MCP-compatible AI assistant. Here are some example prompts:
Could you list my GitLab projects?
Can you show me the details of merge request with ID 123 in the project 'mygroup/myproject'?
Please add a comment to merge request 123 in project 'mygroup/myproject' saying "This looks good, but please add more tests."
Add an internal note to merge request 123 in project 'mygroup/myproject' that says "Needs security review before merging."
Update the title of merge request 123 in project 'mygroup/myproject' to "Fix login page performance issues" and update the description to include "This PR addresses the slow loading times on the login page by optimizing database queries."
Compare the 'feature-branch' with 'main' in the project 'mygroup/myproject' and show me the differences.
Request merge request details:
Show me merge request 123 in project 'mygroup/myproject'
Examine the changes:
Show me the changes for this merge request
Provide feedback:
Add an internal note with my review comments
Update merge request information:
Update the merge request title to better reflect the changes
List available projects:
List all my GitLab projects
Get project details:
Show me the details of project 'mygroup/myproject'
Explore branches:
List all branches in this project
View specific files:
Show me the content of the README.md file in the main branch
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.