Connects Claude to GitLab's REST API for code review workflows. You get tools to fetch merge requests, list branches, read file contents, and post review comments. The gitlab_code_review tool analyzes entire MRs, while gitlab_branch_code_review and gitlab_commit_review let you scope reviews to specific branches or commits. It includes a rule engine that surfaces language-specific review guidelines for TypeScript, React, Go, Python, and Rust projects. The write_gitlab_mr_note tool supports flexible notification modes: post to GitLab only, send to Lark (Feishu) only, or both. Requires a GitLab personal access token. Useful when you want Claude to review diffs, enforce project-specific coding standards, or automate review comments across your team's merge request workflow.
Gitlab Mcp server
支持服务:
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(飞书)机器人发送通知,可以在写入 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
// 使用环境变量配置的默认模式
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"
});
智能代码审查规则系统,根据不同项目类型和文件扩展名提供相应的代码审查建议。
get_code_review_rules: 获取适用于特定项目和文件的代码审查规则list_all_code_review_rules: 列出所有可用的代码审查规则get_project_types: 获取支持的项目类型信息支持为特定项目配置专属的代码审查规则:
详细使用说明请参考:
GITLAB_TOKEN*secretYour API key for the gitlab
GITLAB_URLGitlab URL
LARK_WEBHOOK_URLsecretLark 机器人 Webhook URL
LARK_SECRET_KEYsecret可选:签名密钥(如果机器人启用了签名验证)
LARK_ENABLE_NOTIFICATION可选:是否启用通知,默认为 true
GITLAB_NOTE_MODE可选:通知模式 - gitlab_only(仅GitLab)、lark_only(仅Lark)、both(两者都发),默认为 gitlab_only
ray0907/git-mcp-server
cyanheads/git-mcp-server
io.github.b1ff/atlassian-dc-mcp-bitbucket
io.github.b1ff/atlassian-dc-mcp-jira
com.mcparmory/atlassian-jira
sirlordt/vscode-terminal-mcp