gitlab
4.3
MCP Server for the GitLab API, enabling project management, file operations, and more.
The GitLab MCP Server is designed to facilitate seamless integration with the GitLab API, providing a robust platform for managing projects, performing file operations, and more. It supports automatic branch creation, ensuring that branches are created as needed when files are updated or changes are pushed. The server also features comprehensive error handling, delivering clear error messages for common issues, and maintains proper Git history without the need for force pushing. Additionally, it supports batch operations, allowing for both single-file and multi-file operations, making it a versatile tool for developers and project managers alike.
Features
- Automatic Branch Creation: Automatically creates branches when creating/updating files or pushing changes if they don't exist.
- Comprehensive Error Handling: Provides clear error messages for common issues.
- Git History Preservation: Maintains proper Git history without force pushing.
- Batch Operations: Supports both single-file and multi-file operations.
MCP Tools
- create_or_update_file: Create or update a single file in a project.
- push_files: Push multiple files in a single commit.
- search_repositories: Search for GitLab projects.
- create_repository: Create a new GitLab project.
- get_file_contents: Get contents of a file or directory.
- create_issue: Create a new issue.
- create_merge_request: Create a new merge request.
- fork_repository: Fork a project.
- create_branch: Create a new branch.
Usage with Different Platforms
Docker
{
"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
}
}
}
}
NPX
{
"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
}
}
}
}
VS Code
{
"mcp": {
"inputs": [
{
"type": "promptString",
"id": "gitlab_token",
"description": "GitLab Personal Access Token",
"password": true
},
{
"type": "promptString",
"id": "gitlab_url",
"description": "GitLab API URL (optional)",
"default": "https://gitlab.com/api/v4"
}
],
"servers": {
"gitlab": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"mcp/gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "${input:gitlab_token}",
"GITLAB_API_URL": "${input:gitlab_url}"
}
}
}
}
}