gitlab
MCP Server for the GitLab API, enabling project management, file operations, and more.
MCP Server for the GitLab API, enabling project management, file operations, and more.
MCP Server for the GitLab API, enabling project management, file operations, and more.
create_or_update_file
project_id
(string): Project ID or URL-encoded pathfile_path
(string): Path where to create/update the filecontent
(string): Content of the filecommit_message
(string): Commit messagebranch
(string): Branch to create/update the file inprevious_path
(optional string): Path of the file to move/renameReturns: File content and commit details
push_files
project_id
(string): Project ID or URL-encoded pathbranch
(string): Branch to push tofiles
(array): Files to push, each with file_path
and content
commit_message
(string): Commit messageReturns: Updated branch reference
search_repositories
search
(string): Search querypage
(optional number): Page number for paginationper_page
(optional number): Results per page (default 20)Returns: Project search results
create_repository
name
(string): Project namedescription
(optional string): Project descriptionvisibility
(optional string): 'private', 'internal', or 'public'initialize_with_readme
(optional boolean): Initialize with READMEReturns: Created project details
get_file_contents
project_id
(string): Project ID or URL-encoded pathfile_path
(string): Path to file/directoryref
(optional string): Branch/tag/commit to get contents fromReturns: File/directory contents
create_issue
project_id
(string): Project ID or URL-encoded pathtitle
(string): Issue titledescription
(optional string): Issue descriptionassignee_ids
(optional number[]): User IDs to assignlabels
(optional string[]): Labels to addmilestone_id
(optional number): Milestone IDReturns: Created issue details
create_merge_request
project_id
(string): Project ID or URL-encoded pathtitle
(string): MR titledescription
(optional string): MR descriptionsource_branch
(string): Branch containing changestarget_branch
(string): Branch to merge intodraft
(optional boolean): Create as draft MRallow_collaboration
(optional boolean): Allow commits from upstream membersReturns: Created merge request details
fork_repository
project_id
(string): Project ID or URL-encoded pathnamespace
(optional string): Namespace to fork toReturns: Forked project details
create_branch
project_id
(string): Project ID or URL-encoded pathbranch
(string): Name for new branchref
(optional string): Source branch/commit for new branchCreate a GitLab Personal Access Token with appropriate permissions:
- Go to User Settings > Access Tokens in GitLab
- Select the required scopes:
- api
for full API access
- read_api
for read-only access
- read_repository
and write_repository
for repository operations
- Create the token and save it securely
Add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"gitlab": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"GITLAB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITLAB_API_URL",
"mcp/gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
"GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances
}
}
}
}
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
"GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances
}
}
}
}
Docker build:
docker build -t vonwig/gitlab:mcp -f src/gitlab/Dockerfile .
GITLAB_PERSONAL_ACCESS_TOKEN
: Your GitLab personal access token (required)GITLAB_API_URL
: Base URL for GitLab API (optional, defaults to https://gitlab.com/api/v4
)This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
[
{
"description": "Create or update a single file in a GitLab project",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"branch": {
"description": "Branch to create/update the file in",
"type": "string"
},
"commit_message": {
"description": "Commit message",
"type": "string"
},
"content": {
"description": "Content of the file",
"type": "string"
},
"file_path": {
"description": "Path where to create/update the file",
"type": "string"
},
"previous_path": {
"description": "Path of the file to move/rename",
"type": "string"
},
"project_id": {
"description": "Project ID or URL-encoded path",
"type": "string"
}
},
"required": [
"project_id",
"file_path",
"content",
"commit_message",
"branch"
],
"type": "object"
},
"name": "create_or_update_file"
},
{
"description": "Search for GitLab projects",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"page": {
"description": "Page number for pagination (default: 1)",
"type": "number"
},
"per_page": {
"description": "Number of results per page (default: 20)",
"type": "number"
},
"search": {
"description": "Search query",
"type": "string"
}
},
"required": [
"search"
],
"type": "object"
},
"name": "search_repositories"
},
{
"description": "Create a new GitLab project",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"description": {
"description": "Repository description",
"type": "string"
},
"initialize_with_readme": {
"description": "Initialize with README.md",
"type": "boolean"
},
"name": {
"description": "Repository name",
"type": "string"
},
"visibility": {
"description": "Repository visibility level",
"enum": [
"private",
"internal",
"public"
],
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"name": "create_repository"
},
{
"description": "Get the contents of a file or directory from a GitLab project",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"file_path": {
"description": "Path to the file or directory",
"type": "string"
},
"project_id": {
"description": "Project ID or URL-encoded path",
"type": "string"
},
"ref": {
"description": "Branch/tag/commit to get contents from",
"type": "string"
}
},
"required": [
"project_id",
"file_path"
],
"type": "object"
},
"name": "get_file_contents"
},
{
"description": "Push multiple files to a GitLab project in a single commit",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"branch": {
"description": "Branch to push to",
"type": "string"
},
"commit_message": {
"description": "Commit message",
"type": "string"
},
"files": {
"description": "Array of files to push",
"items": {
"additionalProperties": false,
"properties": {
"content": {
"description": "Content of the file",
"type": "string"
},
"file_path": {
"description": "Path where to create the file",
"type": "string"
}
},
"required": [
"file_path",
"content"
],
"type": "object"
},
"type": "array"
},
"project_id": {
"description": "Project ID or URL-encoded path",
"type": "string"
}
},
"required": [
"project_id",
"branch",
"files",
"commit_message"
],
"type": "object"
},
"name": "push_files"
},
{
"description": "Create a new issue in a GitLab project",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"assignee_ids": {
"description": "Array of user IDs to assign",
"items": {
"type": "number"
},
"type": "array"
},
"description": {
"description": "Issue description",
"type": "string"
},
"labels": {
"description": "Array of label names",
"items": {
"type": "string"
},
"type": "array"
},
"milestone_id": {
"description": "Milestone ID to assign",
"type": "number"
},
"project_id": {
"description": "Project ID or URL-encoded path",
"type": "string"
},
"title": {
"description": "Issue title",
"type": "string"
}
},
"required": [
"project_id",
"title"
],
"type": "object"
},
"name": "create_issue"
},
{
"description": "Create a new merge request in a GitLab project",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"allow_collaboration": {
"description": "Allow commits from upstream members",
"type": "boolean"
},
"description": {
"description": "Merge request description",
"type": "string"
},
"draft": {
"description": "Create as draft merge request",
"type": "boolean"
},
"project_id": {
"description": "Project ID or URL-encoded path",
"type": "string"
},
"source_branch": {
"description": "Branch containing changes",
"type": "string"
},
"target_branch": {
"description": "Branch to merge into",
"type": "string"
},
"title": {
"description": "Merge request title",
"type": "string"
}
},
"required": [
"project_id",
"title",
"source_branch",
"target_branch"
],
"type": "object"
},
"name": "create_merge_request"
},
{
"description": "Fork a GitLab project to your account or specified namespace",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"namespace": {
"description": "Namespace to fork to (full path)",
"type": "string"
},
"project_id": {
"description": "Project ID or URL-encoded path",
"type": "string"
}
},
"required": [
"project_id"
],
"type": "object"
},
"name": "fork_repository"
},
{
"description": "Create a new branch in a GitLab project",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"branch": {
"description": "Name for the new branch",
"type": "string"
},
"project_id": {
"description": "Project ID or URL-encoded path",
"type": "string"
},
"ref": {
"description": "Source branch/commit for new branch",
"type": "string"
}
},
"required": [
"project_id",
"branch"
],
"type": "object"
},
"name": "create_branch"
}
]