Gitlab
MCP server configuration for GitLab integration providing issue management, merge request operations, code search, and project data access.
Installation
First, install the Han CLI tool:
npm install -g @thebushidocollective/hanThen install the plugin:
han plugin install sensei-gitlabOverview
Official GitLab MCP server integration for comprehensive project management, issue tracking, merge request operations, and code search capabilities.
What This Sensei Provides
MCP Server: gitlab
The official GitLab MCP server enables AI assistants to securely interact with your GitLab instance through OAuth 2.0 authentication. This integration provides full access to GitLab's project management, issue tracking, merge request workflows, CI/CD pipelines, and intelligent code search capabilities.
This sensei connects Claude Code to GitLab and provides:
- Issue Management: Create, read, and manage GitLab issues across projects
- Merge Request Operations: Create MRs, view commits, diffs, and pipeline status
- CI/CD Integration: Access pipeline information and job details
- Code Search: Perform instance-wide searches and semantic code queries
- Project Data Access: Secure read/write access to GitLab projects via OAuth 2.0
Available Tools
Once installed, Claude Code gains access to these tools:
get_mcp_server_version: Returns the GitLab MCP server version informationcreate_issue: Creates new issues in GitLab projects with title, description, and labelsget_issue: Retrieves detailed information about a specific issuecreate_merge_request: Creates new merge requests (requires GitLab 18.5+)get_merge_request: Fetches comprehensive merge request informationget_merge_request_commits: Lists all commits in a merge requestget_merge_request_diffs: Shows file changes and diffs in a merge requestget_merge_request_pipelines: Retrieves CI/CD pipeline data for a merge requestget_pipeline_jobs: Lists all jobs in a specific CI/CD pipelinegitlab_search: Searches for terms across the entire GitLab instancesemantic_code_search: Finds relevant code snippets using semantic search (GitLab.com only)
Installation
Prerequisites
GitLab Requirements:
- GitLab Premium or Ultimate tier
- GitLab Duo Core, Pro, or Enterprise add-on
- Beta features enabled (for GitLab 18.4 and earlier)
- Available on GitLab.com, Self-Managed, or Dedicated instances
Via Han Marketplace
npx @thebushidocollective/han install
Or install manually:
claude plugin marketplace add thebushidocollective/han
claude plugin install sensei-gitlab@han
Authentication
After installation, authenticate with GitLab OAuth:
- Run
/mcpin Claude Code - Select the GitLab server
- Click "Authenticate" to open the OAuth flow in your browser
- Authorize access to your GitLab account
Authentication tokens are stored securely and refreshed automatically.
Manual Installation
Add to your Claude Code settings (~/.claude/settings.json):
{
"mcpServers": {
"gitlab": {
"type": "http",
"url": "https://gitlab.com/api/v4/mcp"
}
}
}
Or via CLI:
claude mcp add --transport http gitlab https://gitlab.com/api/v4/mcp
Self-Hosted GitLab
For self-hosted GitLab instances, replace gitlab.com with your instance URL:
{
"mcpServers": {
"gitlab": {
"type": "http",
"url": "https://your-gitlab.example.com/api/v4/mcp"
}
}
}
Enable Beta Features (GitLab 18.4 and earlier)
- Go to Admin Area > Settings > General
- Expand "Model Context Protocol"
- Enable "Model Context Protocol Beta"
- Save changes
Usage
Example 1: Creating an Issue
Create a new issue in a GitLab project:
User: Create an issue in project 123 titled "Fix login redirect bug" with description "Users are redirected to the wrong page after login"
Claude: I'll create that issue for you using the create_issue tool.
[Creates issue with specified title and description in project 123]
Issue created successfully: #42 - "Fix login redirect bug"
Example 2: Reviewing a Merge Request
Get comprehensive information about a merge request:
User: Show me the details of merge request 15 in project 456, including the commits and file changes
Claude: Let me fetch that information for you.
[Uses get_merge_request, get_merge_request_commits, and get_merge_request_diffs tools]
Merge Request #15: "Add user authentication"
- Status: Open
- Author: @johndoe
- Target Branch: main
- Commits: 3 commits
- Files Changed: src/auth.ts (+45, -0), src/api/login.ts (+23, -5)
Example 3: Searching Code
Find relevant code across your GitLab instance:
User: Search for implementations of JWT token validation in the codebase
Claude: I'll search for JWT token validation code.
[Uses semantic_code_search or gitlab_search tools]
Found 5 relevant results across 3 projects:
1. auth-service/src/middleware/validateToken.ts
2. api-gateway/lib/security/jwt.ts
3. user-service/utils/auth.ts
Example 4: Monitoring CI/CD Pipelines
Check pipeline status and job details:
User: What's the status of the latest pipeline for merge request 42 in project 789?
Claude: Let me check the pipeline status.
[Uses get_merge_request_pipelines and get_pipeline_jobs tools]
Pipeline #1234 - Status: Running
- build: â Passed (2m 15s)
- test: â³ Running (1m 45s)
- deploy: âžïž Pending
Tool Reference
create_issue
Purpose: Creates a new issue in a GitLab project
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathtitle(required): Issue titledescription(optional): Issue description in Markdown formatlabels(optional): Array of label names to add to the issue
Example:
{
"project_id": "123",
"title": "Fix memory leak in image processing",
"description": "Memory usage increases over time when processing large images",
"labels": ["bug", "high-priority"]
}
get_issue
Purpose: Retrieves detailed information about a specific issue
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathissue_iid(required): Internal issue ID (the number shown in the UI)
Example:
{
"project_id": "123",
"issue_iid": "42"
}
create_merge_request
Purpose: Creates a new merge request (GitLab 18.5+)
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathsource_branch(required): Source branch nametarget_branch(required): Target branch nametitle(required): Merge request titledescription(optional): MR description in Markdown format
Example:
{
"project_id": "456",
"source_branch": "feature/user-auth",
"target_branch": "main",
"title": "Add user authentication system",
"description": "Implements JWT-based authentication"
}
get_merge_request
Purpose: Fetches comprehensive merge request information
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathmerge_request_iid(required): Internal MR ID
Example:
{
"project_id": "456",
"merge_request_iid": "15"
}
get_merge_request_commits
Purpose: Lists all commits in a merge request
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathmerge_request_iid(required): Internal MR ID
Example:
{
"project_id": "456",
"merge_request_iid": "15"
}
get_merge_request_diffs
Purpose: Shows file changes and diffs in a merge request
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathmerge_request_iid(required): Internal MR ID
Example:
{
"project_id": "456",
"merge_request_iid": "15"
}
get_merge_request_pipelines
Purpose: Retrieves CI/CD pipeline data for a merge request
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathmerge_request_iid(required): Internal MR ID
Example:
{
"project_id": "456",
"merge_request_iid": "15"
}
get_pipeline_jobs
Purpose: Lists all jobs in a specific CI/CD pipeline
Parameters:
project_id(required): Numeric project ID or URL-encoded project pathpipeline_id(required): Pipeline ID
Example:
{
"project_id": "456",
"pipeline_id": "1234"
}
gitlab_search
Purpose: Searches for a term across the entire GitLab instance
Parameters:
search(required): Search termscope(optional): Search scope (issues, merge_requests, projects, etc.)
Example:
{
"search": "authentication bug",
"scope": "issues"
}
semantic_code_search
Purpose: Finds relevant code snippets using AI-powered semantic search
Note: Available on GitLab.com only
Parameters:
query(required): Natural language query describing what you're looking for
Example:
{
"query": "How are user permissions checked in the API?"
}
Security Considerations
OAuth 2.0 Authentication:
- The GitLab MCP server uses OAuth 2.0 with dynamic client registration
- Browser-based authorization flow on first connection
- Tokens are managed securely by the MCP server
Prompt Injection Risks:
- Be cautious when working with untrusted GitLab objects
- Review AI-generated code or changes carefully before applying
- Validate issue descriptions and comments from external sources
Access Control:
- The MCP server inherits your GitLab permissions
- Only projects you have access to will be available
- Respects GitLab's built-in access control and visibility settings
Data Privacy:
- All communication goes through GitLab's API
- No data is stored or cached by the MCP server
- Audit logs are maintained in GitLab's standard audit trail
Limitations
Version Requirements:
- Merge request creation requires GitLab 18.5 or later
- Beta features must be enabled for GitLab 18.4 and earlier
- Semantic code search is only available on GitLab.com
Rate Limits:
- Subject to GitLab API rate limits (varies by tier)
- Premium: 2,000 requests per minute
- Ultimate: 4,000 requests per minute
Feature Availability:
- Some features require specific GitLab tiers (Premium/Ultimate)
- GitLab Duo add-on required for AI features
- Self-hosted instances need proper configuration
Scope Limitations:
- Default
mcpOAuth scope provides read/write access - Cannot perform admin-level operations
- Cannot modify GitLab instance settings
Troubleshooting
Issue: OAuth Authorization Fails
Solution:
- Ensure you're logged into GitLab in your default browser
- Check that beta features are enabled (GitLab 18.4 and earlier)
- Verify your account has the necessary permissions
- Try clearing browser cookies and re-authorizing
Issue: "Project not found" Error
Solution:
- Verify the project ID is correct (use numeric ID or URL-encoded path)
- Ensure you have access to the project
- For private projects, confirm OAuth scope includes necessary permissions
- Check if the project exists and isn't archived
Issue: Merge Request Creation Unavailable
Solution:
- Verify your GitLab version is 18.5 or later
- Ensure you have Developer or higher role in the project
- Check that both source and target branches exist
- Confirm branch protection rules allow MR creation
Issue: Semantic Search Not Working
Solution:
- Confirm you're using GitLab.com (not self-hosted)
- Verify GitLab Duo is enabled for your account
- Check that you have the necessary add-on subscription
- Fall back to
gitlab_searchfor basic search functionality
Issue: Authentication Token Expired
Solution:
- Run
/mcpin Claude Code - Select the GitLab server
- Click "Clear authentication" to reset
- Re-authenticate through the OAuth flow
Related Plugins
- sensei-context7: Up-to-date library documentation for code references
- sensei-playwright-mcp: Browser automation for testing GitLab UIs
- buki-git: Git operations and repository management skills
- do-devops: DevOps practices including CI/CD workflows
Contributing
See CONTRIBUTING.md for guidelines.
License
MIT License - See LICENSE for details.
Links
- GitLab MCP Server Documentation
- Model Context Protocol
- MCP Servers Repository
- MCP Protocol Specification
- GitLab Duo Documentation
Sources:
MCP Servers
gitlab
Commands
/create-issue
Create a new issue in a GitLab project
/create-mr
Create a new merge request in a GitLab project
/review-mr
Get comprehensive review of a GitLab merge request
/search-code
Search for code across your GitLab instance
/view-pipeline
View CI/CD pipeline status for a merge request or project