Get the FREE Ultimate OpenClaw Setup Guide →

gitlab

MCP server from dubuqingfeng/gitlab-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio dubuqingfeng-gitlab-mcp-server node path/to/server.js \
  --env GITLAB_URL="https://gitlab.com" \
  --env GITLAB_TOKEN="your_personal_access_token" \
  --env LARK_SECRET_KEY="optional_signing_key" \
  --env GITLAB_NOTE_MODE="gitlab_only" \
  --env LARK_WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/xxx" \
  --env LARK_ENABLE_NOTIFICATION="true"

How to use

This MCP server integrates with GitLab to fetch Merge Request information and perform intelligent code review guidance. It uses the @gitbeaker/rest GitLab API client to retrieve MR details, list MRs, and run code review checks. The server also supports a Lark (Feishu) bot integration to notify teams about MR reviews. Available tools include getting MR details, listing MRs, performing code reviews on MRs, branches, or commits, retrieving file content, listing branches, and writing review notes to MR comments with flexible notification modes. By configuring environment variables, you can enable GitLab access and optional Lark notifications. The system is designed to provide actionable review feedback and streamline collaboration between GitLab reviews and team notifications.

How to install

Prerequisites:

  • Node.js (v14+ recommended) and npm installed
  • Access token for GitLab with appropriate scopes
  • If using Lark notifications, an accessible Feishu/Lark webhook and optional signing secret
  1. Clone the MCP server repository or download the package
  1. Install dependencies
  • npm install
  1. Configure environment variables
  • Create a .env file or export variables in your shell. Example: export GITLAB_TOKEN="your_personal_access_token" export GITLAB_URL="https://gitlab.com" # optional, defaults to gitlab.com export LARK_WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/xxx" export LARK_SECRET_KEY="your_secret_key" # optional export LARK_ENABLE_NOTIFICATION="true" # optional, defaults to true export GITLAB_NOTE_MODE="gitlab_only" # optional: gitlab_only | lark_only | both
  1. Start the MCP server
  • node path/to/server.js
  1. Verify operation
  • Check logs for initialization messages and ensure GitLab authentication succeeds. Use the available tools (get_merge_request, list_merge_requests, gitlab_code_review, etc.) to validate responses and review outputs.

Additional notes

Notes:

  • Ensure GITLAB_TOKEN has the necessary scopes for MR access and notes writing if you plan to post review comments.
  • If GITLAB_URL is not provided, the default is https://gitlab.com; do not include /api/v4 in this URL.
  • The Lark integration can be configured to notify only GitLab, only Lark, or both via GITLAB_NOTE_MODE. The default is gitlab_only.
  • The write_gitlab_mr_note tool supports flexible notification modes and can surface reviews in both GitLab and Lark depending on configuration.
  • Refer to the Code Review Rules and Code Review Documentation for understanding available rules and how they apply to different project types.

Common issues:

  • If GitLab API requests fail, verify token scopes and network access.
  • If Lark notifications fail, check webhook URL validity and secret key configuration.
  • Make sure the environment supports the features you enable (e.g., Lark when using lark_only or both).

Related MCP Servers

Sponsor this space

Reach thousands of developers