Gitlab Service MCP Integration
Provides Gitlab service invocation via the MCP protocol, supporting project repository management, file operations, and other features.
Environment Variables
- Need to set the
GITLAB_PERSONAL_ACCESS_TOKEN
environment variable to the Personal access token you created on Gitlab
Usage Instructions
Gitlab MCP Server Reference Documentation
🗺️ Feature List
Tool Identifier | Function Description | Core Parameters |
---|---|---|
create_or_update_file | File creation/update | project_id, file_path, content, branch |
push_files | Batch push files | project_id, branch, files |
search_repositories | Repository search | search, page |
create_repository | Create repository | name, visibility |
get_file_contents | Get file or directory contents | project_id, file_path, ref |
create_issue | Create issue | project_id, title, description |
create_merge_request | Create merge request | project_id, source_branch, target_branch |
fork_repository | Fork repository | project_id, namespace |
create_branch | Create branch | project_id, branch, ref |
Repository URL
https://github.com/modelcontextprotocol/servers/tree/main/src/gitlab
Usage
Parameter Description
1. create_or_update_file
File creation/update
Parameter Name | Type | Optional | Description |
---|---|---|---|
project_id | string | Required | Project ID or URL-encoded path |
file_path | string | Required | File storage path (must include the extension) |
content | string | Required | File content |
commit_message | string | Required | Commit description |
branch | string | Required | Branch for creating/updating files |
previous_path | string | Optional | File path to be moved/renamed |
Returns: File content and commit details
2. push_files
Batch push files
Parameter Name | Type | Optional | Description |
---|---|---|---|
project_id | string | Required | Project ID or URL-encoded path |
branch | string | Required | Branch to push to |
files | array | Required | Files to push, each containing file_path and content |
commit_message | string | Required | Commit message |
Returns: Updated branch reference
3. search_repositories
Repository Search
Parameter Name | Type | Optional | Description |
---|---|---|---|
search | string | Required | Search keywords |
page | number | Optional | Page number for pagination |
per_page | number | Optional | Number of results per page (default: 20) |
Returns: Repository search results
4. create_repository
Creating Repository
Parameter Name | Type | Optional | Description |
---|---|---|---|
name | string | Required | Repository name |
description | string | Optional | Project description |
visibility | string | Optional | Visibility level: private /internal /public (default: private) |
initialize_with_readme | boolean | Optional | Whether to automatically generate a README.md file |
Returns: Details of the created project
5. get_file_contents
Get file or directory contents
Parameter Name | Type | Optional | Description |
---|---|---|---|
project_id | string | Required | Project ID or URL-encoded path |
file_path | string | Required | File/directory path |
ref | string | Optional | The branch/tag/commit from which to retrieve content |
Returns: File/directory contents
6. create_issue
Create issue
Parameter Name | Type | Optional | Description |
---|---|---|---|
project_id | string | Required | Project ID or URL-encoded path |
title | string | Required | issue title |
description | string | Optional | issue description |
assignee_ids | number[] | Optional | Array of assignee IDs |
labels | string[] | Optional | Array of labels |
milestone_id | number | Optional | Milestone ID |
Returns: created issue details
7. create_merge_request
Create merge request
Parameter Name | Type | Optional | Description |
---|---|---|---|
project_id | string | Required | Project ID or URL-encoded path |
source_branch | string | Required | Source branch name |
target_branch | string | Required | Target branch |
draft | boolean | Optional | Create as a draft merge request |
allow_collaboration | boolean | Optional | Allow commits from upstream members |
title | string | Required | MR title |
description | string | Optional | Merge Request description |
Returns: created merge request details
8. fork_repository
Fork repository
Parameter Name | Type | Optional | Description |
---|---|---|---|
project_id | string | Required | Project ID or URL-encoded path |
namespace | string | Optional | Target namespace to fork to |
Returns: Details of the forked project
9. create_branch
Create branch
Parameter Name | Type | Optional | Description |
---|---|---|---|
project_id | string | Required | Project ID or URL-encoded path |
branch | string | Required | New branch name |
ref | string | Optional | Source branch |
Returns: Created branch reference