Skip to main content
Glama

GitLab MCP Server

A Model Context Protocol (MCP) server for GitLab integration, enabling AI assistants to interact with GitLab merge requests, files, and perform intelligent code reviews.

TypeScript Node.js GitLab MCP

Documentation • User Guide (中文) • API Reference

Features

  • 🔄 MCP Protocol - Full compliance with the official MCP TypeScript SDK

  • 📡 stdio Transport - Compatible with Cursor, Claude Desktop, and other MCP clients

  • 🛠️ Complete MR Toolkit - Get MR details, changes, file contents, and more

  • 🤖 AI Code Review - Intelligent code analysis with inline comments

  • 📝 Line-level Comments - Push precise code review feedback to GitLab

  • 🔍 Change Analysis - Deep diff analysis for comprehensive reviews

  • 📋 Review Rules Engine - Smart rules based on file types and paths

  • 🔒 Enterprise Ready - Supports private GitLab instances with retry mechanisms

Related MCP server: GitLab MCP Code Review

Quick Start

Prerequisites

  • Node.js >= 18.0.0

  • pnpm (recommended) or npm

  • GitLab Personal Access Token

Installation

# Clone the repository
git clone https://github.com/LynnCen/gitlab-mcp
cd gitlab-mcp

# Install dependencies
pnpm install

# Build the project
pnpm build

Configuration

Set your GitLab credentials:

export GITLAB_HOST="https://gitlab.com"
export GITLAB_TOKEN="glpat-xxxxxxxxxxxxx"

Cursor Integration

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "gitlab-mcp": {
    "type": "stdio",
    "command": "node",
   "args": ["/path/to/gitlab-mcp/dist/src/index.js"],
    "env": {
     "GITLAB_HOST": "https://gitlab.com",
     "GITLAB_TOKEN": "your-token"
    }
 }
  }
}

Available Tools

Tool

Description

get_merge_request

Get merge request details

get_merge_request_changes

Get MR file changes with diffs

list_merge_requests

List project merge requests

update_merge_request_description

Update MR description

get_file_content

Get file content from repository

analyze_mr_changes

Analyze MR changes for code review

push_code_review_comments

Push review comments to GitLab

get_file_code_review_rules

Get code review rules for file types

Usage Examples

# Get MR information
Get the details of MR #123 in project company/awesome-project

# Perform code review
Analyze all changes in MR #123 of project company/awesome-project 
and perform a comprehensive code review, then push comments to GitLab

# Update MR description
Update the description of MR #123 with the changes summary

GitLab Token Setup

  1. Go to GitLab → Settings → Access Tokens

  2. Create a new token with these scopes:

    • api - Full API access

    • read_user - Read user info

    • read_repository - Read repository content

    • write_repository - Write repository (for comments)

Documentation

Development

# Development mode
pnpm dev

# Build
pnpm build

# Run tests
pnpm test

# Start server
pnpm start

Roadmap

  • AI-powered code review with inline comments

  • Multi-severity issue classification (critical/warning/suggestion)

  • Smart review rules engine

  • Batch MR review support

  • Detailed quality reports

  • Performance optimizations with caching

  • Project-level configuration files

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

  1. Fork the project

  2. Create your feature branch: git checkout -b feature/amazing-feature

  3. Commit your changes: git commit -m 'feat: add amazing feature'

  4. Push to the branch: git push origin feature/amazing-feature

  5. Open a Pull Request

License

This project is licensed under the MIT License.

Acknowledgements


If this project helps you, please give it a ⭐

Made with ❤️ by the GitLab MCP Team

Available Tools

8 tools
analyze_mr_changesB

分析合并请求的文件变更和差异信息,为代码审查提供基础数据

Inputs: projectPath (required), mergeRequestIid (required), focusFiles.

get_file_code_review_rulesC

根据文件类型和路径获取相应的代码审查规则

Inputs: filePath (required), fileExtension.

get_file_contentC

获取指定项目的文件内容

Inputs: filePath (required), projectPath (required), ref.

get_merge_requestC

获取指定项目的合并请求信息

Inputs: projectPath (required), mergeRequestIid (required).

get_merge_request_changesC

获取合并请求的文件变更列表

Inputs: projectPath (required), mergeRequestIid (required), focusFiles, includeContent.

list_merge_requestsC

列出项目的合并请求

Inputs: projectPath (required), page, state, perPage.

push_code_review_commentsB

将代码审查评论推送到GitLab MR,支持行内评论和文件级评论

Inputs: projectPath (required), reviewComments (required), mergeRequestIid (required), commentStyle, +1 more.

update_merge_request_descriptionC

更新指定合并请求的描述信息,支持Markdown格式

Inputs: description (required), projectPath (required), mergeRequestIid (required).

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 8 tools

    Disambiguation3/5

    analyze_mr_changes and get_merge_request_changes overlap significantly — both deal with an MR's changed files/diff, and an agent must read carefully to know one lists changes while the other produces review-oriented analysis. get_file_code_review_rules vs analyze_mr_changes also border on related review-prep concerns, though descriptions do help separate them.

    Naming Consistency5/5

    All names are snake_case verb_noun (get_*, list_*, update_*, push_*, analyze_*), following a single predictable convention. There are no stylistic deviations or mixed casing.

    Tool Count5/5

    Eight tools is well-scoped for a focused MR code-review assistant. Each tool maps to a distinct step in the review workflow (list, fetch, analyze, get rules, push comments).

    Completeness3/5

    The surface covers the read-and-comment review loop but lacks any way to read existing discussions/comments on an MR (risking duplicate comments) and has no MR create/approve/state-change operations. For a review-focused server these are notable gaps, though the core flow is usable.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to review GitLab merge requests by fetching changes, analyzing diffs, adding comments, and managing approvals through the GitLab API. Supports complete merge request analysis, file-specific reviews, and version comparisons.
      12
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to review GitLab merge requests by fetching diffs, analyzing code changes, adding comments, and managing approvals through the GitLab API. Supports comprehensive merge request analysis and version comparison for automated code review workflows.
      3
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Connects AI assistants to GitLab to interact with merge requests, reviews, discussions, pipelines, and test results through natural language queries. Supports viewing MR details, responding to comments, checking test summaries, and analyzing job logs.
      12
      2
      -