@wengjjpaul/gitlab-mcp
v1.0.1
Published
GitLab MCP server for reviewing Merge Requests via VS Code Copilot
Downloads
79
Maintainers
Readme
GitLab MCP Server
An MCP (Model Context Protocol) server for reviewing GitLab Merge Requests via VS Code GitHub Copilot.
Features
- Get MR Details: Fetch merge request title, description, author, state, branches, labels, assignees, and reviewers
- Get MR Diff: Retrieve the full diff of all changed files for code review
- Get MR Discussions: View all comments and discussions on the merge request
- Add Inline Comments: Post inline comments on specific lines in files
- Add General Comments: Post general comments on the merge request
- Add Code Suggestions: Post code suggestions that can be directly applied from the GitLab UI
- Get Pipeline Status: Check CI/CD pipeline status and job details
- Get File Content: Retrieve full file content from source or target branch
Prerequisites
- Node.js >= 18.0.0
- A GitLab Personal Access Token with the following scopes:
api- Full API accessread_api- Read API accessread_repository- Read repository access
Installation
Install dependencies:
cd gitlab-mcp npm installBuild the project:
npm run build
Configuration
Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| GITLAB_BASE_URL | Your GitLab instance URL (e.g., https://gitlab.example.com) | Yes |
| GITLAB_TOKEN | Your GitLab Personal Access Token | Yes |
VS Code MCP Configuration
Add the following to your VS Code settings.json:
{
"mcp": {
"servers": {
"gitlab": {
"command": "node",
"args": ["/absolute/path/to/gitlab-mcp/dist/index.js"],
"env": {
"GITLAB_BASE_URL": "https://your-gitlab-instance.com",
"GITLAB_TOKEN": "your-personal-access-token"
}
}
}
}
}Or if you prefer using a wrapper script:
{
"mcp": {
"servers": {
"gitlab": {
"command": "/absolute/path/to/gitlab-mcp/run.sh"
}
}
}
}Usage
Once configured, you can use the GitLab MCP server in VS Code GitHub Copilot chat:
Review a Merge Request
Review this MR: https://gitlab.example.com/group/project/-/merge_requests/123Check Pipeline Status
What's the pipeline status for https://gitlab.example.com/group/project/-/merge_requests/123Add Comments
Add a comment on line 42 of src/main.ts in https://gitlab.example.com/group/project/-/merge_requests/123
suggesting better error handlingAvailable Tools
| Tool | Description |
|------|-------------|
| get_mr_details | Get MR metadata and information |
| get_mr_diff | Get all file changes/diffs |
| get_mr_discussions | Get all comments and discussions |
| add_mr_inline_comment | Add inline comment on a specific line |
| add_mr_general_comment | Add general comment to MR |
| add_mr_suggestion | Add a code suggestion that can be applied from GitLab UI |
| get_pipeline_status | Get CI/CD pipeline and job status |
| get_file_content | Get file content from source or target branch |
Creating a GitLab Personal Access Token
- Go to your GitLab instance
- Navigate to User Settings > Access Tokens
- Create a new token with the following scopes:
apiread_apiread_repository
- Copy the token and use it as
GITLAB_TOKEN
Development
# Watch mode for development
npm run dev
# Build
npm run build
# Run
npm startLicense
MIT
