Gitlab MCP (ModelContextProvider) server is a containerized Python MCP server for Cursor to provide access to GitLab API(read-only as of now).
- Cursor as MCP client
- Podman(If running as containers)
- Get the code
git clone [email protected]:redhat-ai-tools/gitlab-mcp.git
cd gitlab-mcp
- Build the image & configure Cursor
This also creates a~/.rh-gitlab-mcp.env
file like this.
make setup
- Prepare a GitLab token
- Go to ${GITLAB_URL} if no custom gitlab defaults to public gitlab.com and create a token
- Edit the
.rh-gitlab-mcp.env
file in your home directory and paste in the token.
To confirm it's working, run Cursor, go to Settings and click on "Tools & Integrations". Under MCP Tools you should see "gitlabMcp" with 8 tools enabled.
search_repositories
- Find projects by name, description, or pathlist_issues
- List issues in a projectlist_merge_requests
- List merge requests in a projectlist_pipelines
- List pipelines in a projectlist_jobs
- List jobs in a specific pipeline
check_latest_failed_jobs
- Find recent failed jobs across pipelineslist_latest_commits
- View recent commits in projects
β Correct Prompts:
- "Search for projects containing 'systemd'"
- "Find repositories with 'kernel' in the name"
- "List my owned projects"
- "Show all public repositories"
β Avoid:
- Single word searches without context
- Vague terms like "find stuff"
β Correct Prompts:
- "List the failed jobs in mcp-servers project"
- "Show recent failed jobs for project ID 123"
- "Find failed pipeline jobs in the last few runs"
β Avoid:
- Just saying "failed jobs" without specifying project
β Correct Prompts:
- "Show recent pipelines for project 456"
- "List open issues in my-project"
- "Show merge requests waiting for review in project XYZ"
- "Get latest commits from all my projects"
When you ask: "List the failed jobs in mcp-servers project"
The MCP follows:
- π Search for project: Use
search_repositories
with search_term="mcp-servers" - π Get project ID: Extract the project ID from search results
- β List failed jobs: Use
check_latest_failed_jobs
with that project ID - π Display results: Show the recent failed jobs with details
{
"search_term": "mcp-servers", // Optional: project name/description
"visibility": "all", // public, private, internal, all
"owned": false, // true for only owned repos
"limit": 10 // max results
}
{
"project_id": "123", // Required: GitLab project ID
"limit": 5 // Optional: max failed jobs to return
}
{
"project_id": "123", // Required: GitLab project ID
"state": "opened", // opened, closed, all
"limit": 20 // max results
}
{
"project_id": "123", // Required: GitLab project ID
"status": "all", // running, pending, success, failed, all
"limit": 20 // max results
}
- β Rate limiting: Max 100 API calls per hour (configurable)
- β Action restrictions: Only "read" actions allowed by default
- β Repository access control: Configurable repo allowlist
- β Error handling: Graceful failures with helpful messages
# Required
export MCP_GITLAB_TOKEN="your-gitlab-token"
# Optional
export GITLAB_URL="https://gitlab.example.com"
export MCP_MAX_API_CALLS="100"
export MCP_ALLOWED_ACTIONS="read"
export MCP_ALLOWED_REPOS="project1,project2" # Empty = all allowed
Human: "List failed jobs in mcp-tests project"
β MCP searches for "mcp-tests" project
β MCP gets project ID from search results
β MCP lists recent failed jobs with details
Human: "Show pipeline status for my-app project"
β MCP searches for "my-app" project
β MCP lists recent pipelines with status
β Human can drill down into specific pipelines
Human: "What open issues are there in frontend-app?"
β MCP searches for "frontend-app" project
β MCP lists open issues with assignees and dates
- Include project names in queries
- Specify what information you want (issues, MRs, pipelines, etc.)
- Use descriptive terms rather than abbreviations
The MCP can now handle complex queries that require multiple steps:
- Search for project by name
- Get specific information about that project
- Drill down into details as needed
Most functions support filtering:
- States: opened, closed, merged, failed, success
- Limits: Control result size for performance
- Visibility: Focus on relevant repositories
π« "Project not found"
- Try broader search terms
- Check if you have access to the project
- Verify project name spelling
π« "Rate limit exceeded"
- Wait an hour for limit reset
- Increase
MCP_MAX_API_CALLS
if needed
π« "Access denied"
- Check
MCP_ALLOWED_REPOS
configuration - Verify your GitLab token has proper permissions
- Ensure you're a project member
This read-only approach provides safer, more focused GitLab integration for monitoring and analysis workflows.