Skip to main content
Glama

GitLab MCP 服务器

模型上下文协议 (MCP) 服务器,可让您与 GitLab 帐户进行交互。您可以获取差异、分析合并请求、审查代码、挑选更改等等。这是模型上下文协议项目中MCP GitLab 服务器的扩展版本。

特征

该 MCP 服务器提供了与 GitLab 存储库交互的综合工具,包括:

核心存储库功能

  • 列出项目并检索详细信息

  • 管理分支和存储库

  • 处理合并请求和差异

  • 向合并请求添加评论和内部注释

  • 更新合并请求属性

  • 列出并处理问题

  • 获取并比较存储库文件内容

项目设置和集成

  • 管理项目集成和服务

  • 配置和控制 Slack 集成

  • 设置、更新和测试 webhook

CI/CD 管理

  • 使用管道触发器令牌

  • 管理 CI/CD 变量

  • 触发和控制管道

用户和组管理

  • 列出和管理用户

  • 使用群组和群组成员资格

  • 管理项目成员和访问级别

Related MCP server: GitLab MCP Server

安装

先决条件

  • Node.js(v16 或更高版本)

  • npm

  • 具有 API 令牌的 GitLab 帐户

设置

  1. 克隆存储库:

git clone https://github.com/rifqi96/mcp-gitlab.git
cd mcp-gitlab
  1. 安装依赖项:

npm install
  1. 构建服务器:

npm run build
  1. 安装 git hooks(可选,但建议贡献者安装):

npm run install-hooks

这将安装一个预提交钩子,当 src/utils/tools-data.ts 发生变化时,它会自动重新生成 TOOLS.md。

  1. 配置您的 GitLab API 令牌:

您需要在 MCP 设置配置文件中提供您的 GitLab API 令牌。该令牌用于向 GitLab API 进行身份验证。

对于 Cursor/Roo Cline,将以下内容添加到您的 MCP 设置文件 ( ~/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"
      }
    }
  }
}

对于 Claude Desktop,将以下内容添加到您的 MCP 设置文件 ( ~/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"
      }
    }
  }
}

将YOUR_GITLAB_API_TOKEN替换为你实际的 GitLab API 令牌。你可以在 GitLab 帐户的“设置”>“访问令牌”下生成令牌。

可用工具

有关可用工具及其参数的完整列表,请参阅TOOLS.md 。

示例用法

以下是如何将这些工具与支持 MCP 的 AI 助手一起使用的示例:

列出您的项目

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." Make sure it's only visible to team members.

更新合并请求标题和描述

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.

实际工作流程

审查合并请求

1. Show me merge request 123 in project 'mygroup/myproject'
2. Show me the changes for this merge request
3. Add an internal note with my review comments
4. Update the merge request title to better reflect the changes

项目探索

1. List all my GitLab projects
2. Show me the details of project 'mygroup/myproject'
3. List all branches in this project
4. Show me the content of the README.md file in the main branch

可用资源

gitlab://projects

可使用您的 API 令牌访问的 GitLab 项目列表。

与人工智能助手集成

GitLab MCP 服务器与支持模型上下文协议 (MCP) 的 AI 助手集成。

功能

当连接到 AI 助手时,该服务器可使助手能够:

  1. 查看和分析代码:助手可以获取文件内容、查看分支差异并检查合并请求更改,以便更好地理解代码。

  2. 提供代码审查:助手可以分析合并请求并通过评论或内部注释提供反馈。

  3. 管理项目工作流程:助手可以更新合并请求属性、添加评论并协助完成存储库管理任务。

  4. 探索项目结构:助手可以浏览项目、分支和文件以了解代码库结构。

  5. 配置 CI/CD 和集成:该助手可以帮助设置 webhook、管理 CI/CD 变量以及配置项目集成。

充分利用人工智能助手集成

  • 询问项目、合并请求或文件时要具体

  • 尽可能提供项目 ID 或路径

  • 使用助手进行代码审查,要求它分析特定的合并请求

  • 让助手协助完成存储库配置和管理任务

  • 使用内部注释对合并请求进行团队专属反馈

执照

麻省理工学院

Available Tools

41 tools
gitlab_add_group_memberC

Add a user to a group

Inputs: access_level (required), group_id (required), user_id (required).

gitlab_add_project_memberC

Add a user to a project

Inputs: access_level (required), project_id (required), user_id (required).

gitlab_add_webhookC

Add a new webhook to a project

Inputs: project_id (required), url (required), enable_ssl_verification, issues_events, +3 more.

gitlab_compare_branchesC

Compare branches, tags or commits

Inputs: from (required), project_id (required), to (required).

gitlab_create_cicd_variableC

Create a new CI/CD variable

Inputs: key (required), project_id (required), value (required), masked, +1 more.

gitlab_create_merge_request_noteC

Add a comment to a merge request

Inputs: body (required), merge_request_iid (required), project_id (required).

gitlab_create_merge_request_note_internalB

Add a comment to a merge request with option to make it an internal note

Inputs: body (required), merge_request_iid (required), project_id (required), internal.

gitlab_create_trigger_tokenC

Create a new pipeline trigger token

Inputs: description (required), project_id (required).

gitlab_delete_cicd_variableC

Delete a CI/CD variable

Inputs: key (required), project_id (required).

gitlab_delete_trigger_tokenC

Delete a pipeline trigger token

Inputs: project_id (required), trigger_id (required).

gitlab_delete_webhookC

Delete a webhook

Inputs: project_id (required), webhook_id (required).

gitlab_disable_slack_integrationC

Disable Slack integration for a project

Inputs: project_id (required).

gitlab_get_cicd_variableB

Get a specific CI/CD variable

Inputs: key (required), project_id (required).

gitlab_get_groupC

Get details of a specific group

Inputs: group_id (required).

gitlab_get_integrationC

Get integration details for a project

Inputs: integration (required), project_id (required).

gitlab_get_merge_requestB

Get details of a specific merge request

Inputs: merge_request_iid (required), project_id (required).

gitlab_get_merge_request_changesC

Get changes (diff) of a specific merge request

Inputs: merge_request_iid (required), project_id (required).

gitlab_get_projectC

Get details of a specific GitLab project

Inputs: project_id (required).

gitlab_get_repository_fileC

Get content of a file in a repository

Inputs: file_path (required), project_id (required), ref.

gitlab_get_trigger_tokenC

Get details of a pipeline trigger token

Inputs: project_id (required), trigger_id (required).

gitlab_get_userC

Get details of a specific user

Inputs: user_id (required).

gitlab_get_webhookC

Get details of a specific webhook

Inputs: project_id (required), webhook_id (required).

gitlab_list_branchesC

List branches of a GitLab project

Inputs: project_id (required), search.

gitlab_list_cicd_variablesC

List CI/CD variables for a project

Inputs: project_id (required).

gitlab_list_group_membersC

List members of a group

Inputs: group_id (required).

gitlab_list_groupsC

List GitLab groups

Inputs: owned, search.

gitlab_list_integrationsB

List all available project integrations/services

Inputs: project_id (required).

gitlab_list_issuesC

List issues in a GitLab project

Inputs: project_id (required), labels, state.

gitlab_list_merge_requestsC

List merge requests in a GitLab project

Inputs: project_id (required), scope, state.

gitlab_list_project_membersC

List members of a project

Inputs: project_id (required).

gitlab_list_projectsB

List GitLab projects accessible to the user

Inputs: membership, owned, per_page, search.

gitlab_list_trigger_tokensC

List pipeline trigger tokens

Inputs: project_id (required).

gitlab_list_usersC

List GitLab users

Inputs: active, search.

gitlab_list_webhooksC

List webhooks for a project

Inputs: project_id (required).

gitlab_test_webhookC

Test a webhook

Inputs: project_id (required), webhook_id (required).

gitlab_trigger_pipelineC

Trigger a pipeline run

Inputs: project_id (required), ref (required), token (required), variables.

gitlab_update_cicd_variableC

Update a CI/CD variable

Inputs: key (required), project_id (required), value (required), masked, +1 more.

gitlab_update_merge_requestC

Update a merge request title and description

Inputs: merge_request_iid (required), project_id (required), description, title.

gitlab_update_slack_integrationC

Update Slack integration settings for a project

Inputs: project_id (required), webhook (required), channel, username.

gitlab_update_trigger_tokenC

Update a pipeline trigger token

Inputs: description (required), project_id (required), trigger_id (required).

gitlab_update_webhookC

Update an existing webhook

Inputs: project_id (required), url (required), webhook_id (required), enable_ssl_verification, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 41 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting specific resources and actions, but there is some overlap: gitlab_create_merge_request_note and gitlab_create_merge_request_note_internal are nearly identical, differing only in an optional parameter, which could cause confusion. Otherwise, tools are well-differentiated across groups, projects, CI/CD, webhooks, and integrations.

    Naming Consistency5/5

    All tools follow a consistent gitlab_verb_noun pattern with snake_case throughout, such as gitlab_list_projects, gitlab_create_cicd_variable, and gitlab_update_webhook. This uniformity makes the tool set predictable and easy to navigate, with no deviations in style or structure.

    Tool Count3/5

    With 41 tools, the count is high for a GitLab server, bordering on heavy. While it covers many aspects of GitLab's API, it may overwhelm agents with its breadth. A more focused set of 15-25 tools might be more manageable, but it's not extreme like 50+ tools.

    Completeness5/5

    The tool set provides comprehensive coverage for GitLab operations, including CRUD for groups, projects, members, CI/CD variables, webhooks, trigger tokens, and integrations. It supports full lifecycles with create, get, update, delete, and list operations, leaving no obvious gaps for core workflows in the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      An MCP server that enables communication with GitLab repositories, allowing interaction with GitLab's API to manage projects, issues, and repositories through natural language.
      45
      1
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      A Model Context Protocol server that enables AI assistants to interact with GitLab repositories, allowing tasks like managing merge requests, searching projects, and creating comments through RESTful API integration.
      21 npm
      2
      -
    • A
      license
      B
      quality
      C
      maintenance
      A Model Context Protocol server that enables AI assistants to interact with self-hosted GitLab instances through 30 specialized tools. It supports managing projects, merge requests, CI/CD pipelines, and repository operations via the GitLab REST API v4.
      30
      MIT