Skip to main content
Glama

GitLab MCP Code Review

by ffpy

GitLab MCP 代码审查工具

Python 3.10+ License: MIT

本项目 fork 自 cayirtepeomer/gerrit-code-review-mcp 并为 GitLab 集成进行了适配。

一个用于将 Claude 等 AI 助手与 GitLab 的合并请求集成的 MCP (Model Context Protocol) 服务器。这使得 AI 助手可以通过 GitLab API 直接审查代码变更。

功能

  • 完整的合并请求分析: 获取合并请求的全部详情,包括差异、提交和评论

  • 文件特定的差异: 分析合并请求中特定文件的变更

  • 版本比较: 比较不同的分支、标签或提交

  • 审查管理: 添加评论、批准或取消批准合并请求

  • 项目概览: 获取项目中的所有合并请求列表

安装

先决条件

Cursor IDE 集成

克隆此仓库:

git clone https://gitea.ffpy.site/ffpy/gitlab-mcp-code-review.git cd gitlab-mcp-code-review

要将此 MCP 与 Cursor IDE 一起使用,请将以下配置添加到你的 ~/.cursor/mcp.json 文件中:

{ "mcpServers": { "gitlab-mcp-code-review": { "command": "uv", "args": [ "--directory", "/path/to/your/gitlab-mcp-code-review", "run", "server.py" ], "env": { "GITLAB_HOST": "gitlab.com", "GITLAB_TOKEN": "xxx" } } } }
  • /path/to/your/gitlab-mcp-code-review 替换为你克隆仓库的实际路径。

  • GITLAB_HOST 修改为你的Gitlab地址

  • GITLAB_TOKEN 修改为你的AccessToken

可用工具

MCP 服务器提供以下工具用于与 GitLab 交互:

工具

描述

fetch_merge_request

获取有关合并请求的完整信息

compare_versions

比较不同的分支、标签或提交

add_merge_request_comment

向合并请求添加评论

approve_merge_request

批准合并请求

unapprove_merge_request

取消批准合并请求

get_project_merge_requests

获取项目的合并请求列表

故障排除

如果遇到问题:

  1. 验证你的 GitLab 令牌是否具有适当的权限 (api, read_api)

  2. 确保你的 MCP 配置路径正确

  3. 使用以下命令测试连接:curl -H "Private-Token: your-token" https://gitlab.com/api/v4/projects

许可证

本项目根据 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE 文件。

Related MCP Servers

  • -
    security
    F
    license
    -
    quality
    A custom server implementation that allows AI assistants to interact with GitLab repositories, providing capabilities for searching, fetching files, creating/updating content, and managing issues and merge requests.
    Last updated -
    1
  • -
    security
    A
    license
    -
    quality
    Integrates GitLab merge request analysis with Confluence documentation, allowing users to fetch merge request details, analyze code changes, and store analysis results in Confluence pages.
    Last updated -
    MIT License
    • Linux
    • Apple
  • -
    security
    A
    license
    -
    quality
    An MCP server that integrates AI assistants like Claude with GitLab's merge requests, allowing them to review code changes, add comments, and approve/unapprove merge requests directly through the GitLab API.
    Last updated -
    36
    MIT License
    • Linux
    • Apple
  • -
    security
    F
    license
    -
    quality
    Provides GitLab integration for AI assistants using Model Context Protocol, enabling repository operations, file management, issue tracking, merge requests, and branch/tag administration through natural language.
    Last updated -
    2

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ffpy/gitlab-mcp-code-review'

If you have feedback or need assistance with the MCP directory API, please join our Discord server