PluginBench
MCP Server
Stale
MIT

io.github.dubuqingfeng/gitlab-mcp-server MCP Server

io.github.dubuqingfeng/gitlab-mcp-server

GitLab MCP server for AI agents to review code, manage merge requests, and enforce code review rules.

What is the io.github.dubuqingfeng/gitlab-mcp-server MCP server?

The GitLab MCP server is a Model Context Protocol server that integrates GitLab with AI agents, enabling automated code review, merge request management, and intelligent code review rule enforcement. It supports fetching MR details, performing comprehensive code reviews on branches and commits, and posting review notes with optional Lark bot notifications.

This server connects AI agents to GitLab, allowing them to retrieve merge request information, perform code reviews on MRs and branches, fetch file contents, and post review comments. It also includes an intelligent code review rules system that provides context-aware suggestions based on project type and file extensions, plus optional Lark (Feishu) bot integration for team notifications.

How to install io.github.dubuqingfeng/gitlab-mcp-server

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
Environment / auth
  • GITLAB_TOKEN
    required
    secret

    Your API key for the gitlab

  • GITLAB_URL

    Gitlab URL

  • LARK_WEBHOOK_URL
    secret

    Lark 机器人 Webhook URL

  • LARK_SECRET_KEY
    secret

    可选:签名密钥(如果机器人启用了签名验证)

  • LARK_ENABLE_NOTIFICATION

    可选:是否启用通知,默认为 true

  • GITLAB_NOTE_MODE

    可选:通知模式 - gitlab_only(仅GitLab)、lark_only(仅Lark)、both(两者都发),默认为 gitlab_only

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "gitlab-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@dubuqingfeng/gitlab-mcp-server"
      ],
      "env": {
        "GITLAB_TOKEN": "<YOUR_GITLAB_TOKEN>",
        "GITLAB_URL": "<YOUR_GITLAB_URL>",
        "LARK_WEBHOOK_URL": "<YOUR_LARK_WEBHOOK_URL>",
        "LARK_SECRET_KEY": "<YOUR_LARK_SECRET_KEY>",
        "LARK_ENABLE_NOTIFICATION": "<YOUR_LARK_ENABLE_NOTIFICATION>",
        "GITLAB_NOTE_MODE": "<YOUR_GITLAB_NOTE_MODE>"
      }
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • get_merge_request — Retrieve detailed information about a specific merge request
  • list_merge_requests — List all merge requests for a project
  • gitlab_code_review — Perform comprehensive code review on a merge request
  • gitlab_branch_code_review — Perform full code review on a specified branch
  • gitlab_commit_review — Perform code review on a specified commit
  • get_file_content — Retrieve the content of a specific file in the repository
  • list_branches — List all branches in a project
  • write_gitlab_mr_note — Write review notes to a merge request with flexible notification modes (GitLab only, Lark only, or both)
  • get_code_review_rules — Get code review rules applicable to a specific project and file
  • list_all_code_review_rules — List all available code review rules
  • get_project_types — Get information about supported project types

Use cases

  • Automate code reviews on GitLab merge requests with AI-powered suggestions
  • Retrieve and analyze merge request details and file contents for code quality assessment
  • Enforce project-specific code review rules based on language and file type
  • Post code review comments directly to GitLab MRs with optional team notifications via Lark
  • Review entire branches or specific commits for comprehensive code quality checks

io.github.dubuqingfeng/gitlab-mcp-server MCP server FAQ

What is the GitLab MCP server?

It's an MCP server that enables AI agents to interact with GitLab, perform code reviews, manage merge requests, and enforce intelligent code review rules based on project type.

Is this server free to use?

Yes, the server itself is open-source. You need a GitLab personal access token and optionally a Lark webhook URL for notifications.

How do I install it in Cursor or Claude?

Install via npm: `npm install @dubuqingfeng/gitlab-mcp-server`. Configure your MCP client to use this package and set required environment variables.

What authentication is required?

You must set GITLAB_TOKEN (GitLab personal access token) and optionally GITLAB_URL. For Lark notifications, set LARK_WEBHOOK_URL and optionally LARK_SECRET_KEY.

Can I use this without Lark notifications?

Yes. Lark integration is optional. Set GITLAB_NOTE_MODE to 'gitlab_only' (default) to post reviews only to GitLab without Lark notifications.

What project types are supported for code review rules?

TypeScript/JavaScript, React, Node.js, Go, Python, Rust, Backend, and Database. Rules cover security, performance, maintainability, style, and best practices.

README (reference)

Source of truth, from the repository.

Gitlab Mcp server

支持服务:

  1. gitlab
  2. code-review-rules (代码审查规则)

场景

  1. gitlab 代码 review,获取信息
  2. 智能代码审查规则 - 根据项目类型提供代码审查建议

GitLab

GitLab 集成使用 @gitbeaker/rest 库支持获取 Merge Request 信息。

环境变量

export GITLAB_TOKEN="your_personal_access_token"
export GITLAB_URL="https://gitlab.com"  # 可选,默认为 gitlab.com(注意:不需要 /api/v4 后缀)

可用工具

  • get_merge_request: 获取特定 MR 的详细信息
  • list_merge_requests: 列出项目的 MR 列表
  • gitlab_code_review: 对 MR 进行综合代码审查
  • gitlab_branch_code_review: 对指定分支进行全面代码审查
  • gitlab_commit_review: 对指定提交进行代码审查
  • get_file_content: 获取仓库中特定文件的内容
  • list_branches: 列出项目的所有分支
  • write_gitlab_mr_note: 在 MR 中写入审查备注(支持灵活的通知模式)

依赖

  • @gitbeaker/rest: GitLab API 客户端库

详细使用说明请参考 GitLab 文档

Lark 机器人集成

支持通过 Lark(飞书)机器人发送通知,可以在写入 GitLab MR 评论时自动发送 Lark 通知。

环境变量

export LARK_WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/xxx"  # Lark 机器人 Webhook URL
export LARK_SECRET_KEY="your_secret_key"  # 可选:签名密钥(如果机器人启用了签名验证)
export LARK_ENABLE_NOTIFICATION="true"  # 可选:是否启用通知,默认为 true
export GITLAB_NOTE_MODE="gitlab_only"  # 可选:通知模式 - gitlab_only(仅GitLab)、lark_only(仅Lark)、both(两者都发),默认为 gitlab_only

功能特性

  • 灵活的通知模式:可以选择只写 GitLab、只发 Lark 或两者都做
  • 支持富文本卡片消息,包含项目名称、MR 标题、评论内容等信息
  • 支持自定义 Lark 消息(文本或卡片格式)
  • 失败不影响主流程,确保 GitLab 操作的可靠性

通知模式说明

  • gitlab_only: 仅写入 GitLab MR 评论,不发送 Lark 通知(默认)
  • lark_only: 仅发送 Lark 通知,不写入 GitLab MR 评论
  • both: 同时写入 GitLab MR 评论并发送 Lark 通知

使用示例

// 使用环境变量配置的默认模式
await write_gitlab_mr_note({
  projectId: "group/project",
  mergeRequestIid: 123,
  note: "代码审查完成,LGTM!"
});

// 明确指定只写入 GitLab
await write_gitlab_mr_note({
  projectId: "group/project",
  mergeRequestIid: 123,
  note: "内部备注",
  notificationMode: "gitlab_only"
});

// 只发送 Lark 通知,不写入 GitLab
await write_gitlab_mr_note({
  projectId: "group/project",
  mergeRequestIid: 123,
  note: "团队通知:代码已审查",
  notificationMode: "lark_only"
});

// 强制两者都执行(覆盖环境变量)
await write_gitlab_mr_note({
  projectId: "group/project",
  mergeRequestIid: 123,
  note: "重要通知",
  notificationMode: "both"
});

Code Review Rules (代码审查规则)

智能代码审查规则系统,根据不同项目类型和文件扩展名提供相应的代码审查建议。

可用工具

  • get_code_review_rules: 获取适用于特定项目和文件的代码审查规则
  • list_all_code_review_rules: 列出所有可用的代码审查规则
  • get_project_types: 获取支持的项目类型信息

支持的项目类型

  • TypeScript / JavaScript
  • React
  • Node.js
  • Go
  • Python
  • Rust
  • Backend (通用后端规则)
  • Database (数据库相关)

规则类别

  • 🔒 Security (安全)
  • ⚡ Performance (性能)
  • 🔧 Maintainability (可维护性)
  • 🎨 Style (代码风格)
  • ✨ Best Practice (最佳实践)

项目特定规则

支持为特定项目配置专属的代码审查规则:

  • 可以通过外部 JSON 配置文件定义项目特定规则
  • 支持启用/禁用默认规则
  • 支持排除特定的默认规则
  • 可以添加额外的项目类型

详细使用说明请参考:

Related MCP servers

Google Trends, YouTube, Ads Transparency and Play reviews over plain HTTP. No API key.

0
Python
View repository →

Find local service providers — plumbers, tutors, translators — and estimate provider earnings.

View repository →

MCP server for LiveAuth: PoW + Lightning auth, L402 bundles, and paid MCP tool receipts.

1
TypeScript
MIT
View repository →

Procedure verification for AR/XR with memory, visual sessions, and DPO trajectory export.

2
Python
MIT
View repository →

Persistent, expiring, importance-graded sticky notes for Claude Code.

1
JavaScript
MIT
View repository →