GitLab Review MCP
Enables code review operations including fetching pull request details, retrieving code diffs, adding review comments, and analyzing code quality for GitHub repositories.
Provides code review and merge request management capabilities including fetching merge request details, retrieving code diffs, adding review comments, creating merge requests, and analyzing code quality for GitLab projects.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitLab Review MCP show me the diff for merge request #42 in group/my-project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Node Code Review MCP
A Node.js implementation of the Model Context Protocol (MCP) server for code review operations, supporting both GitHub and GitLab platforms.
π δΈζζζ‘£: README-zh.md | εΏ«ιεΌε§ | εθ½ε―Ήζ―
Features
π Fetch pull request/merge request details
π Get code diffs for PRs or commits
π¬ Add review comments
π Basic code quality analysis
π§ Configurable via command line arguments
π Support for both GitHub and GitLab APIs
Related MCP server: sentinel-mcp
Installation
Via NPM (when published)
npm install -g gitlab-review-mcpLocal Development
git clone <repository>
cd gitlab-review-mcp
npm install
npm run buildConfiguration
Environment Variables
Copy env.example to .env and configure:
# API Configuration
API_BASE_URL=https://api.github.com
API_TOKEN=your_github_token_here
# For GitLab, use:
# API_BASE_URL=https://gitlab.com/api/v4
# API_TOKEN=your_gitlab_token_here
# Server Configuration
TIMEOUT=30000
MAX_RETRIES=3Command Line Arguments
gitlab-review-mcp \
--api-base-url https://api.github.com \
--api-token your_token \
--timeout 30000 \
--max-retries 3MCP Configuration
Add to your MCP client configuration (e.g., Claude Desktop):
Using NPX (Recommended)
{
"mcpServers": {
"gitlab-review-mcp": {
"command": "npx",
"args": [
"-y",
"gitlab-review-mcp",
"--api-base-url=https://api.github.com",
"--api-token=your_github_token_here"
],
"alwaysAllow": [
"fetch_pull_request",
"fetch_code_diff",
"add_review_comment",
"analyze_code_quality",
"get_server_config",
"create_merge_request",
"get_current_branch",
"get_project_info"
]
}
}
}Using Local Installation
{
"mcpServers": {
"gitlab-review-mcp": {
"command": "node",
"args": [
"/path/to/gitlab-review-mcp/dist/index.js",
"--api-base-url=https://api.github.com",
"--api-token=your_github_token_here"
],
"alwaysAllow": [
"fetch_pull_request",
"fetch_code_diff",
"add_review_comment",
"analyze_code_quality",
"get_server_config",
"create_merge_request",
"get_current_branch",
"get_project_info"
]
}
}
}For GitLab
{
"mcpServers": {
"gitlab-review-mcp": {
"command": "npx",
"args": [
"-y",
"gitlab-review-mcp",
"--api-base-url=https://gitlab.com/api/v4",
"--api-token=your_gitlab_token_here"
],
"alwaysAllow": [
"fetch_pull_request",
"fetch_code_diff",
"add_review_comment",
"analyze_code_quality",
"get_server_config",
"create_merge_request",
"get_current_branch",
"get_project_info"
]
}
}
}Available Tools
fetch_pull_request
Fetch pull request/merge request details.
Parameters:
repository(string): Repository in format "owner/repo" or GitLab project path like "group/project" (aliases:projectId,project_path)pullRequestNumber(number): Pull request numberprovider(string, optional): "github" or "gitlab" (default: "gitlab")
fetch_code_diff
Fetch code diff for a pull request or commit.
Parameters:
repository(string): Repository in format "owner/repo" or GitLab project path like "group/project"pullRequestNumber(number, optional): Pull request numbercommitSha(string, optional): Commit SHAfilePath(string, optional): Specific file path to get diff forprovider(string, optional): "github" or "gitlab" (default: "gitlab")
add_review_comment
Add a review comment to a pull request.
Parameters:
repository(string): Repository in format "owner/repo" or GitLab project path like "group/project"pullRequestNumber(number): Pull request numberbody(string): Comment bodyfilePath(string, optional): File path for line commentline(number, optional): Line number for line commentprovider(string, optional): "github" or "gitlab" (default: "gitlab")
analyze_code_quality
Analyze code quality and provide suggestions with detailed metrics.
Parameters:
code(string): Code content to analyzelanguage(string): Programming language (javascript, typescript, python, java, go, etc.)rules(array, optional): Specific rules to check
get_repository_info
Get repository information.
Parameters:
repository(string): Repository in format "owner/repo" or GitLab project path like "group/project"provider(string, optional): "github" or "gitlab" (default: "gitlab")
analyze_files_batch
Analyze multiple files for code quality issues.
Parameters:
files(array): Array of file objects withpath,content, andlanguagepropertiesrules(array, optional): Specific rules to apply to all files
get_pull_request_files
Get list of files changed in a pull request.
Parameters:
repository(string): Repository in format "owner/repo" or GitLab project path like "group/project"pullRequestNumber(number): Pull request numberprovider(string, optional): "github" or "gitlab" (default: "gitlab")
get_supported_languages
Get list of supported programming languages for code analysis.
get_language_rules
Get available analysis rules for a specific language.
Parameters:
language(string): Programming language
get_server_config
Get current server configuration and health status.
create_merge_request π
Create a new GitLab merge request from a source branch with enhanced error handling.
Parameters:
projectId(string): GitLab project ID or pathNumeric ID (recommended):
"12345"Project path:
"group/project"or"group/subgroup/project"
sourceBranch(string): Source branch name (e.g., "feature/new-feature")targetBranch(string, optional): Target branch name (defaults to "main")title(string, optional): Merge request title (auto-generated from branch name if not provided)description(string, optional): Merge request descriptionassigneeId(number, optional): User ID to assign the merge request toreviewerIds(array, optional): Array of user IDs to request reviews fromdeleteSourceBranch(boolean, optional): Whether to delete source branch when MR is mergedsquash(boolean, optional): Whether to squash commits when merging
Enhanced Error Handling:
Project ID validation with detailed error messages
Automatic project verification before MR creation
Comprehensive troubleshooting guidance for common errors (404, 401, 403, etc.)
Support for both numeric IDs and project paths
Example:
// Minimal usage
{
"projectId": "mygroup/myproject",
"sourceBranch": "feature/user-authentication"
}
// Full configuration
{
"projectId": "12345",
"sourceBranch": "feature/user-authentication",
"targetBranch": "develop",
"title": "feat: Add user authentication system",
"description": "This MR adds JWT-based authentication with password hashing.",
"assigneeId": 123,
"reviewerIds": [456, 789],
"deleteSourceBranch": true,
"squash": true
}Auto-generated Titles: The tool automatically generates conventional commit-style titles based on branch prefixes:
feature/βfeat:bugfix/βfix:hotfix/βfix:docs/βdocs:refactor/βrefactor:
get_current_branch π
Get current Git branch and repository information.
Parameters:
workingDirectory(string, optional): Working directory path (defaults to current directory)
Example:
{
"workingDirectory": "/path/to/your/project"
}Returns:
{
"currentBranch": "feature/user-authentication",
"allBranches": ["main", "feature/user-authentication", "develop"],
"isGitRepository": true,
"repositoryRoot": "/path/to/your/project"
}get_project_info π
Get current GitLab project information from Git remotes.
Parameters:
workingDirectory(string, optional): Working directory path (defaults to current directory)remoteName(string, optional): Git remote name (defaults to "origin")
Example:
{
"workingDirectory": "/path/to/your/project",
"remoteName": "origin"
}Returns:
{
"projectId": "group%2Fproject",
"projectPath": "group/project",
"gitlabUrl": "https://gitlab.com",
"remotes": [
{
"name": "origin",
"url": "git@gitlab.com:group/project.git",
"fetch": "git@gitlab.com:group/project.git",
"push": "git@gitlab.com:group/project.git"
}
],
"isGitlabProject": true
}API Token Setup
GitHub
Go to GitHub Settings > Developer settings > Personal access tokens
Generate a new token with appropriate permissions:
reposcope for private repositoriespublic_reposcope for public repositories only
GitLab
Go to GitLab User Settings > Access Tokens
Create a personal access token with:
apiscope for full API accessread_apiscope for read-only access
Development
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build
npm run build
# Clean build directory
npm run cleanLicense
MIT License - see LICENSE file for details.
Available Tools
15 toolsadd_review_commentC
Add a review comment to a pull request
Inputs: repository (required), pullRequestNumber (required), body (required), filePath, +2 more.
analyze_code_qualityC
Analyze code quality and provide suggestions with detailed metrics
Inputs: code (required), language (required), rules.
analyze_files_batchC
Analyze multiple files for code quality issues
Inputs: files (required), rules.
create_merge_requestB
Create a new GitLab merge request from a source branch
Inputs: sourceBranch (required), projectId, targetBranch, title, +7 more.
fetch_code_diffC
Fetch code diff for a pull request or commit
Inputs: repository (required), pullRequestNumber, commitSha, filePath, +1 more.
fetch_pull_requestC
Fetch pull request details from GitHub/GitLab
Inputs: repository (required), pullRequestNumber (required), provider.
get_current_branchB
Get current Git branch and repository information
Inputs: workingDirectory.
get_language_rulesC
Get available analysis rules for a specific language
Inputs: language (required).
get_merge_requestC
Get information about a specific GitLab merge request
Inputs: mergeRequestIid (required), projectId, workingDirectory, remoteName.
get_merge_request_changesC
Get merge request changes (GitLab compatibility alias)
Inputs: repository, pullRequestNumber, mergeRequestIid, provider, +2 more.
get_project_infoC
Get current GitLab project information from Git remotes
Inputs: workingDirectory, remoteName.
get_pull_request_filesC
Get list of files changed in a pull request or merge request
Inputs: repository, pullRequestNumber, mergeRequestIid, provider, +2 more.
get_repository_infoC
Get repository information
Inputs: repository (required), provider.
get_server_configB
Get current server configuration
Inputs: no named parameters.
get_supported_languagesB
Get list of supported programming languages for code analysis
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 15 tools
There is significant overlap between several tools, particularly in the code analysis and merge/pull request areas. For example, 'analyze_code_quality' and 'analyze_files_batch' have unclear boundaries, and 'fetch_pull_request' vs 'get_merge_request' could cause confusion about which platform to target. However, the descriptions help clarify some distinctions, preventing complete ambiguity.
Most tools follow a consistent verb_noun pattern (e.g., 'add_review_comment', 'create_merge_request', 'get_project_info'), which is clear and predictable. There are minor deviations like 'fetch_code_diff' (using 'fetch' instead of 'get') and 'analyze_files_batch' (which includes an extra descriptor), but overall the naming is largely consistent and readable.
With 15 tools, the count is reasonable for a server focused on GitLab review and code analysis. It covers multiple aspects like merge requests, code quality, and repository info without being overly bloated. However, it might be slightly heavy if some tools are redundant, but it generally fits the scope well.
The tool set covers core workflows for GitLab review, including creating and fetching merge requests, analyzing code, and getting repository details. Minor gaps exist, such as no tools for updating or deleting merge requests or handling comments beyond adding them, but agents can likely work around these with the available operations.
Maintenance
Related MCP Connectors
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.β¦
AI-native git hosting β repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
AI code review for GitHub PRs with an MCP autofix loop for Claude Code and Cursor
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables automated AI-powered code review for pull requests across GitHub, GitLab, Bitbucket, and Azure DevOps via webhooks, and manual code review through MCP tools using Groq, Claude, or GPT-4.1-
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to run security and code review on pull requests and diffs, exposing review_pr and review_diff capabilities with local-first analyzers and LLM explanations.2MIT
- FlicenseNot gradedqualityCmaintenanceEnables MCP-connected AI agents to review GitHub pull requests and post meaningful inline review comments directly on them through natural language prompts.-
- AlicenseAqualityBmaintenanceEnables an MCP-capable assistant to review GitLab merge requests, GitHub pull requests, and pre-push local branches against ticket requirements, domain rubrics, compiler/lint pre-passes, blast-radius analysis, and SonarQube findings, and to draft inline comments or follow-up tasks in the user's chosen language. Nothing reaches a remote host until a human approves the exact content in an interactive terminal.3MIT