Built by Metorial, the integration platform for agentic AI.

Learn More

    Server Summary

    • Manage GitLab repositories

    • Handle merge requests

    • Track issues and tasks

    • Search code repositories

    • Manage CI/CD pipelines

GitLab MCP Server

A comprehensive Model Context Protocol (MCP) server that provides seamless integration with GitLab's extensive API. This server enables AI assistants and applications to interact with GitLab repositories, manage issues and merge requests, search code, and perform a wide range of development workflow operations. Whether you're looking to automate repository management, streamline code reviews, or enhance project collaboration, this server provides the tools needed to work efficiently with GitLab.

Overview

The GitLab MCP server acts as a bridge between AI applications and GitLab's powerful platform, exposing a rich set of capabilities through the Model Context Protocol. It supports operations across the entire GitLab workflow including project management, repository operations, issue tracking, merge request handling, and team collaboration features. The server provides both read and write access, allowing you to query information, create and modify content, and manage your GitLab resources programmatically.

Features

  • Project Discovery: Search, list, and explore GitLab projects with flexible filtering options
  • Repository Management: Create, update, and delete files with full commit control
  • Code Search: Perform powerful code searches across projects and repositories
  • Issue Tracking: Complete issue lifecycle management from creation to closure
  • Merge Request Workflows: Handle the entire merge request process including approvals and merging
  • Branch Operations: Create, delete, and protect branches with customizable access controls
  • Code Analysis: Access file blame information and compare branches or commits
  • Team Collaboration: Manage project members and add comments to issues and merge requests

Tools

Project Management

list_projects

List accessible GitLab projects with comprehensive filtering options.

Parameters:

  • page (number, optional): Page number for pagination (minimum: 1, default: 1)
  • per_page (number, optional): Number of results per page (1-100, default: 20)
  • search (string, optional): Search query to filter projects by name or description
  • membership (boolean, optional): Limit results to projects where you are a member
  • starred (boolean, optional): Show only starred projects
  • visibility (string, optional): Filter by visibility level (public, internal, or private)

search_projects

Search for projects by name or description with keyword matching.

Parameters:

  • query (string, required): Search query string
  • per_page (number, optional): Number of results per page (1-100, default: 20)

get_project_languages

Retrieve programming languages used in a project with percentage breakdowns.

Parameters:

  • projectId (string, required): Project ID or path

Repository Operations

create_file

Create a new file in a repository with full commit metadata.

Parameters:

  • projectId (string, required): Project ID or path
  • filePath (string, required): Path for the new file
  • content (string, required): File content
  • commitMessage (string, required): Commit message
  • branch (string, required): Target branch name
  • startBranch (string, optional): Source branch for creating a new branch
  • authorName (string, optional): Commit author name
  • authorEmail (string, optional): Commit author email

update_file

Update an existing file in a repository.

Parameters:

  • projectId (string, required): Project ID or path
  • filePath (string, required): Path to the file
  • content (string, required): New file content
  • commitMessage (string, required): Commit message
  • branch (string, required): Target branch name
  • startBranch (string, optional): Source branch for creating a new branch
  • authorName (string, optional): Commit author name
  • authorEmail (string, optional): Commit author email

delete_file

Remove a file from a repository.

Parameters:

  • projectId (string, required): Project ID or path
  • filePath (string, required): Path to the file to delete
  • commitMessage (string, required): Commit message
  • branch (string, required): Target branch name
  • startBranch (string, optional): Source branch for creating a new branch
  • authorName (string, optional): Commit author name
  • authorEmail (string, optional): Commit author email

Code Analysis

search_code

Search for code across projects with optional project-specific filtering.

Parameters:

  • query (string, required): Search query
  • projectId (string, optional): Limit search to specific project
  • ref (string, optional): Branch or tag name to search in
  • per_page (number, optional): Number of results per page (1-100, default: 20)

get_file_blame

Get git blame information showing who last modified each line of a file.

Parameters:

  • projectId (string, required): Project ID or path
  • filePath (string, required): Path to the file
  • ref (string, optional): Branch or commit SHA (default: main)

compare_branches

Compare two branches or commits to see differences.

Parameters:

  • projectId (string, required): Project ID or path
  • from (string, required): Source branch or commit SHA
  • to (string, required): Target branch or commit SHA

Issue Management

list_issues

List issues for a project with extensive filtering capabilities.

Parameters:

  • projectId (string, required): Project ID or path
  • page (number, optional): Page number (minimum: 1, default: 1)
  • per_page (number, optional): Results per page (1-100, default: 20)
  • state (string, optional): Filter by state (opened, closed, or all)
  • search (string, optional): Search query
  • labels (string, optional): Comma-separated list of label names
  • authorId (number, optional): Filter by author user ID
  • assigneeId (number, optional): Filter by assignee user ID

create_issue

Create a new issue in a project.

Parameters:

  • projectId (string, required): Project ID or path
  • title (string, required): Issue title
  • description (string, optional): Issue description
  • labels (string, optional): Comma-separated list of label names
  • assigneeIds (array of numbers, optional): User IDs to assign
  • milestoneId (number, optional): Milestone ID
  • dueDate (string, optional): Due date in YYYY-MM-DD format

update_issue

Update an existing issue with new information.

Parameters:

  • projectId (string, required): Project ID or path
  • issueIid (number, required): Issue IID (internal ID)
  • title (string, optional): New title
  • description (string, optional): New description
  • labels (string, optional): Comma-separated list of label names
  • assigneeIds (array of numbers, optional): User IDs to assign
  • milestoneId (number, optional): Milestone ID
  • dueDate (string, optional): Due date in YYYY-MM-DD format
  • stateEvent (string, optional): State change event (close or reopen)

close_issue

Close an open issue.

Parameters:

  • projectId (string, required): Project ID or path
  • issueIid (number, required): Issue IID (internal ID)

reopen_issue

Reopen a previously closed issue.

Parameters:

  • projectId (string, required): Project ID or path
  • issueIid (number, required): Issue IID (internal ID)

add_issue_comment

Add a comment or note to an issue.

Parameters:

  • projectId (string, required): Project ID or path
  • issueIid (number, required): Issue IID (internal ID)
  • body (string, required): Comment text content

search_issues

Search for issues across projects.

Parameters:

  • query (string, required): Search query
  • projectId (string, optional): Limit search to specific project
  • state (string, optional): Filter by state (opened, closed, or all)
  • per_page (number, optional): Results per page (1-100, default: 20)

Merge Request Management

list_merge_requests

List merge requests for a project with comprehensive filtering.

Parameters:

  • projectId (string, required): Project ID or path
  • page (number, optional): Page number (minimum: 1, default: 1)
  • per_page (number, optional): Results per page (1-100, default: 20)
  • state (string, optional): Filter by state (opened, closed, locked, merged, or all)
  • search (string, optional): Search query
  • labels (string, optional): Comma-separated list of label names
  • authorId (number, optional): Filter by author user ID
  • assigneeId (number, optional): Filter by assignee user ID
  • sourceBranch (string, optional): Filter by source branch name
  • targetBranch (string, optional): Filter by target branch name

create_merge_request

Create a new merge request in a project.

Parameters:

  • projectId (string, required): Project ID or path
  • sourceBranch (string, required): Source branch name
  • targetBranch (string, required): Target branch name
  • title (string, required): Merge request title
  • description (string, optional): Merge request description
  • labels (string, optional): Comma-separated list of label names
  • assigneeIds (array of numbers, optional): User IDs to assign
  • milestoneId (number, optional): Milestone ID
  • removeSourceBranch (boolean, optional): Remove source branch after merge

update_merge_request

Update an existing merge request.

Parameters:

  • projectId (string, required): Project ID or path
  • mergeRequestIid (number, required): Merge request IID (internal ID)
  • title (string, optional): New title
  • description (string, optional): New description
  • labels (string, optional): Comma-separated list of label names
  • assigneeIds (array of numbers, optional): User IDs to assign
  • milestoneId (number, optional): Milestone ID
  • targetBranch (string, optional): New target branch
  • stateEvent (string, optional): State change event (close or reopen)
  • removeSourceBranch (boolean, optional): Remove source branch after merge

merge_merge_request

Accept and merge a merge request.

Parameters:

  • projectId (string, required): Project ID or path
  • mergeRequestIid (number, required): Merge request IID (internal ID)
  • mergeCommitMessage (string, optional): Custom merge commit message
  • squash (boolean, optional): Squash commits on merge
  • shouldRemoveSourceBranch (boolean, optional): Remove source branch after merge

close_merge_request

Close a merge request without merging.

Parameters:

  • projectId (string, required): Project ID or path
  • mergeRequestIid (number, required): Merge request IID (internal ID)

reopen_merge_request

Reopen a previously closed merge request.

Parameters:

  • projectId (string, required): Project ID or path
  • mergeRequestIid (number, required): Merge request IID (internal ID)

add_merge_request_comment

Add a comment or note to a merge request.

Parameters:

  • projectId (string, required): Project ID or path
  • mergeRequestIid (number, required): Merge request IID (internal ID)
  • body (string, required): Comment text content

approve_merge_request

Approve a merge request.

Parameters:

  • projectId (string, required): Project ID or path
  • mergeRequestIid (number, required): Merge request IID (internal ID)

unapprove_merge_request

Remove your approval from a merge request.

Parameters:

  • projectId (string, required): Project ID or path
  • mergeRequestIid (number, required): Merge request IID (internal ID)

Branch Management

create_branch

Create a new branch in a repository.

Parameters:

  • projectId (string, required): Project ID or path
  • branch (string, required): Name of the new branch
  • ref (string, required): Source branch name or commit SHA

delete_branch

Delete a branch from a repository.

Parameters:

  • projectId (string, required): Project ID or path
  • branch (string, required): Name of the branch to delete

protect_branch

Protect a branch from force pushes and deletion with access controls.

Parameters:

  • projectId (string, required): Project ID or path
  • branch (string, required): Name of the branch to protect
  • pushAccessLevel (string, optional): Push access level (0=No access, 30=Developer, 40=Maintainer)
  • mergeAccessLevel (string, optional): Merge access level (0=No access, 30=Developer, 40=Maintainer)
  • allowForcePush (boolean, optional): Allow force push

User and Team Management

get_current_user

Get details of the currently authenticated user.

Parameters: None required

list_project_members

List all members of a project with their access levels.

Parameters:

  • projectId (string, required): Project ID or path
  • page (number, optional): Page number (minimum: 1, default: 1)
  • per_page (number, optional): Results per page (1-100, default: 20)

Resource Templates

The server provides resource templates for accessing GitLab data through URI-based requests:

project

Get details of a specific GitLab project including metadata, settings, and statistics.

URI Template: gitlab://project/{projectId}

file

Retrieve file content from a GitLab repository at a specific path.

URI Template: gitlab://project/{projectId}/file/{filePath}

tree

Get directory listing showing files and subdirectories in a repository path.

URI Template: gitlab://project/{projectId}/tree/{path}

branches

List all branches in a GitLab repository with commit information.

URI Template: gitlab://project/{projectId}/branches

commits

Get commit history from a GitLab repository with detailed commit information.

URI Template: gitlab://project/{projectId}/commits

issue

Get complete details of a specific issue including description, metadata, and status.

URI Template: gitlab://project/{projectId}/issue/{issueIid}

issue-notes

Retrieve all comments and notes associated with an issue.

URI Template: gitlab://project/{projectId}/issue/{issueIid}/notes

merge-request

Get detailed information about a specific merge request including status and metadata.

URI Template: gitlab://project/{projectId}/merge-request/{mergeRequestIid}

merge-request-notes

Retrieve all comments and discussion notes on a merge request.

URI Template: gitlab://project/{projectId}/merge-request/{mergeRequestIid}/notes

merge-request-changes

Get the diff and changes for a merge request showing modified files and lines.

URI Template: gitlab://project/{projectId}/merge-request/{mergeRequestIid}/changes

Use Cases

This GitLab MCP server enables numerous powerful workflows:

  • Automated Code Review: AI assistants can fetch merge requests, review changes, add comments, and provide feedback on code quality
  • Issue Triage and Management: Automatically categorize, assign, and update issues based on content analysis
  • Repository Analysis: Search codebases, analyze file blame information, and understand project structure
  • Development Workflow Automation: Create branches, commit files, and manage the entire development lifecycle
  • Project Documentation: Generate documentation by analyzing repository contents, commit history, and project languages
  • Team Collaboration: Facilitate communication by adding contextual comments to issues and merge requests
  • Code Migration: Compare branches, search for specific code patterns, and assist in large-scale refactoring efforts

The server's comprehensive API coverage makes it suitable for both simple queries and complex multi-step workflows, providing the flexibility needed for diverse GitLab integration scenarios.