# GitLab MCP

> GitLab MCP Server connects your entire development ecosystem to your AI client. Use it to list projects, check CI/CD pipeline status, track open issues, and read file contents across your entire GitLab instance. It lets your agent manage the full DevSecOps lifecycle—from initial issue creation to final deployment—all via natural conversation. It's your central hub for project metadata and code visibility.

## Overview
- **Category:** industry-titans
- **Price:** Free
- **Tags:** ci-cd, pipeline-automation, version-control, merge-requests, devsecops

## Description

This server connects your entire development stack to your AI client. It lets your agent manage the full DevSecOps lifecycle—from opening issues to deploying code—all through natural conversation. You can check project metadata, track issues, monitor pipelines, and read file contents across your whole GitLab instance.

To start, your agent first runs `verify_api_connection` to confirm the link to GitLab is active and authorized. You can check your own profile details by calling `get_my_gitlab_profile`, which retrieves the identity and profile details of the user logged into GitLab.

You can see what projects and groups are available by running `list_visible_groups` or `list_visible_projects`, and you can find out the specific configuration metadata for any project using `get_project_details`. When you need to search across everything, `search_gitlab_global` runs a comprehensive search pulling results from projects, issues, and users across your entire GitLab setup.

For managing project tasks, you can list all open or closed issues for a project with `list_project_issues`, or open a new issue using `create_project_issue`. You can check all open or merged merge requests for a project with `list_merge_requests`. You can also list all forks associated with a project by calling `list_project_forks`.

To monitor deployments, `list_project_pipelines` lists the most recent CI/CD pipelines for a project, letting you check build and deployment status. You can read the actual contents of any file in a repository using `get_repository_file`, which reads the text content of a specified file. Finally, you can find everything you need by running `search_gitlab_global`.

## Tools

### create_merge_request
Requires title.

Create a new merge request

### create_project_issue
Opens a new issue in a specific GitLab project.

### get_merge_request
Use the IID (the MR number shown in the UI, not the internal ID).

Get details for a specific merge request

### get_my_gitlab_profile
Retrieves the identity and profile details of the currently logged-in user.

### get_project_details
Fetches the configuration metadata for a specific GitLab project.

### get_repository_file
Reads the text content of a specified file within a repository.

### list_branches
List all branches in a project repository

### list_merge_requests
Lists all open or merged merge requests for a project.

### list_project_forks
Lists all forks associated with a specific project.

### list_project_issues
Lists all open or closed issues for a project.

### list_project_members
List all members of a project

### list_project_pipelines
Lists the most recent CI/CD pipelines for a project to check status.

### list_visible_groups
Lists all GitLab groups the user has access to.

### list_visible_projects
Lists all GitLab projects the user has access to.

### search_gitlab_global
Runs a comprehensive search across all projects, issues, and users in GitLab.

### verify_api_connection
Checks if the connection between the AI client and GitLab is active and authorized.

## Prompt Examples

**Prompt:** 
```
List the last 5 open merge requests for project 'my-group/my-app'.
```

**Response:** 
```
Retrieving merge requests... I found 5 recent open MRs, including 'Fix auth bug' and 'Add new dashboard'. Would you like the details for any of them?
```

**Prompt:** 
```
Check the status of the latest pipelines for project ID '12345'.
```

**Response:** 
```
Fetching pipelines... The latest pipeline for project 12345 'Success' 10 minutes ago. Previous pipeline 'Failed' due to a linting error.
```

**Prompt:** 
```
Search GitLab for issues containing 'security patch'.
```

**Response:** 
```
Searching issues... I found 3 issues matching 'security patch', including 'Patch for CVE-2024-001' in the 'Infra' project. Would you like to see the description?
```

## Capabilities

### Discover Project Metadata
Retrieve configuration details and metadata for specific projects across your GitLab instance.

### Manage Issues and Merge Requests
List, track, and programmatically create project issues and merge requests via chat commands.

### Monitor CI/CD Pipelines
Fetch a list of pipelines for a project, allowing you to check build and deployment status in real-time.

### Inspect Codebase Files
Read the actual contents of files within any repository, letting you understand code structure or documentation without navigating the UI.

### Search Across the Instance
Run global searches that pull results from projects, issues, and users across your entire GitLab setup.

### Verify User Identity
Access detailed profile information for the authenticated user to check permissions or account context.

## Use Cases

### Finding the Status of a Stalled Feature
A developer needs to know why Feature X hasn't been merged. They ask their agent to check the status. The agent calls `list_project_pipelines` (to see if the last build failed) and then `list_merge_requests` (to see if the MR is stuck). The developer gets the full picture without leaving their terminal.

### Onboarding a New Team Member
A project manager needs to hand off project context to a new hire. They ask the agent to list all visible projects (`list_visible_projects`) and then retrieve the main project metadata (`get_project_details`). The agent compiles a digestible report, saving hours of manual documentation gathering.

### Compliance Audit of Codebase
A security engineer needs to verify the version of a specific dependency. They prompt the agent to read a file (`get_repository_file`) in the core repository. The agent retrieves the file content, allowing the engineer to verify the version number instantly for auditing purposes.

### Tracking Down a Specific Bug Report
A tech lead remembers a specific bug report but can't find the issue number. They ask the agent to search globally using `search_gitlab_global` with keywords like 'auth bug' and the project name. The agent returns the link and details of the matching issue.

## Benefits

- Check build health instantly. Instead of clicking into a project dashboard to check the CI/CD status, calling `list_project_pipelines` gives you the latest pipeline status immediately.
- Audit code on demand. Need to see what was in `README.md` from six months ago? Use `get_repository_file` to read the content directly, bypassing file tree navigation.
- Centralize project knowledge. Use `search_gitlab_global` to find a specific issue or project across the entire instance, instead of navigating through group hierarchies.
- Streamline issue tracking. Instead of manually creating a ticket in the UI, use `create_project_issue` to open a new issue directly from your chat prompt.
- Track development flow. Quickly list all open merge requests with `list_merge_requests` to understand which code branches are currently under review.
- Verify context. Use `get_my_gitlab_profile` to confirm your user permissions or check account context before running critical commands.

## How It Works

The bottom line is, your AI client talks to GitLab, and the server translates that conversation into actionable data.

1. Subscribe to the GitLab server via the Vinkius Marketplace and provide your GitLab Base URL and Personal Access Token.
2. Your AI client uses the MCP to call a specific tool, like `list_project_pipelines`.
3. The server executes the API call against GitLab and returns the structured data (e.g., pipeline status, issue list) directly to your AI client.

## Frequently Asked Questions

**How do I get a Personal Access Token (PAT) for GitLab?**
Log in to GitLab, go to User Settings > Access Tokens, and you can generate a new token with the 'api' scope there.

**Does this support self-hosted GitLab instances?**
Yes! Simply provide your instance's root URL (e.g., https://gitlab.my-company.com) in the 'GitLab Base URL' credential field.

**What is a 'Project ID' in GitLab?**
A Project ID is a unique numerical identifier for your project. You can also use the URL-encoded path (e.g., 'group%2Fproject') in most tools.

**Can I see pipeline failures via the agent?**
Yes! Use the 'list_project_pipelines' tool to retrieve the status of all recent pipelines, allowing you to quickly identify failed builds.

**How do I use the `list_visible_projects` tool to find a project?**
The `list_visible_projects` tool returns a list of all projects the authenticated user can access. You can then use the project name or ID to feed into other tools, like `get_project_details`, for deeper analysis.

**What happens if I try to read a file with `get_repository_file` but the file doesn't exist?**
If the file doesn't exist, the tool returns a specific error message detailing the missing path. This means your agent client can handle the failure gracefully and prompt you to check the file path.

**Does the `search_gitlab_global` tool search across all user types or just code?**
The global search tool indexes projects, issues, and user metadata across your entire GitLab instance. It finds artifacts by keyword, not just code contents.

**How does `create_project_issue` handle required fields for a new issue?**
The tool requires specific fields like the project ID, title, and description to create an issue. If any mandatory data is missing, the function call fails, preventing incomplete records.