- Home
- MCP servers
- GitLab Code Review
GitLab Code Review
- python
3
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"ffpy-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",
"CODE_REVIEW_SSH_HOST": "your-server.com",
"CODE_REVIEW_SSH_PORT": "22",
"CODE_REVIEW_RULE_FILE": "/home/user/code-review-rules.md",
"CODE_REVIEW_SSH_PASSWORD": "password",
"CODE_REVIEW_SSH_USERNAME": "user"
}
}
}
}You can run a GitLab MCP server that lets an AI assistant review merge requests directly through GitLab’s API. It analyzes full merge requests, diffs by file, and supports adding comments and approvals, giving you streamlined code review automation with an AI-assisted workflow.
How to use
Start the MCP server locally and connect your MCP client to it. The server exposes a set of actions you can invoke from your AI assistant to retrieve merge request details, compare versions, fetch project MR lists, and manage approvals and comments. Use these actions to drive automated reviews and proposals for code changes within GitLab.
How to install
Prerequisites: you need Python 3.10 or newer and a working uv runner to start the MCP server.
Clone the MCP tool repository for GitLab code review MCP and switch into the project directory.
git clone https://gitea.ffpy.site/ffpy/gitlab-mcp-code-review.git
cd gitlab-mcp-code-review
Configuration and running
Configure your MCP client with the stdio server entry shown below. You will run the server using the uv runtime and point it to the local directory where you cloned the project.
{
"mcpServers": {
"gitlab_code_review": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/gitlab-mcp-code-review",
"run",
"server.py"
],
"env": {
"GITLAB_HOST": "gitlab.com",
"GITLAB_TOKEN": "xxx"
}
}
}
}
Environment variables
Essential variables define how you connect to GitLab and authorize the MCP server.
Required: GITLAB_HOST and GITLAB_TOKEN.
Optional (for code review conventions): CODE_REVIEW_SSH_HOST, CODE_REVIEW_SSH_PORT, CODE_REVIEW_SSH_USERNAME, CODE_REVIEW_SSH_PASSWORD, CODE_REVIEW_RULE_FILE.
Example additional configuration using SSH-based rules file:
{
"mcpServers": {
"gitlab_code_review": {
"command": "uv",
"args": ["--directory", "/path/to/your/gitlab-mcp-code-review", "run", "server.py"],
"env": {
"GITLAB_HOST": "gitlab.com",
"GITLAB_TOKEN": "xxx",
"CODE_REVIEW_SSH_HOST": "your-server.com",
"CODE_REVIEW_SSH_PORT": "22",
"CODE_REVIEW_SSH_USERNAME": "your-username",
"CODE_REVIEW_SSH_PASSWORD": "your-password",
"CODE_REVIEW_RULE_FILE": "/path/to/code-review-rules.md"
}
}
}
}
Notes on installation flow
If you see instructions to build or prepare assets, follow the exact runtime flow shown: the final start command is the stdio configuration used to run the server with uv in the specified directory.
Additional information
The MCP server supports a set of actions to work with GitLab merge requests. You can fetch complete merge request details, compare versions, manage comments and approvals, and retrieve project MR lists.
Available tools
fetch_code_review_rules
Fetch the team’s code review rules file via SSH from a remote server
fetch_merge_request
Retrieve complete information about a merge request including diffs, commits, and comments
compare_versions
Compare different branches, tags, or commits to analyze changes
add_merge_request_comment
Add a comment to a merge request to propose changes or note issues
approve_merge_request
Approve a merge request to signal readiness for merging
unapprove_merge_request
Remove an approval from a merge request
get_project_merge_requests
Get a list of all merge requests in a project