MCP server for the GitLab API, enabling project management and file operations.
GitLab MCP Server
MCP Server for the GitLab API, enabling project management, file operations, and more. Forked from https://github.com/modelcontextprotocol
Installation
NPX (Recommended)
npx @therealchristhomas/gitlab-mcp-server
Global Installation
npm install -g @therealchristhomas/gitlab-mcp-server
gitlab-mcp
Features
- Automatic Branch Creation: When creating/updating files or pushing changes, branches are automatically created if they don't exist
- Comprehensive Error Handling: Clear error messages for common issues
- Git History Preservation: Operations maintain proper Git history without force pushing
- Batch Operations: Support for both single-file and multi-file operations
- Project Workflow Management: Label and milestone management for better project organization
- Repository Management: Search, create, and fork GitLab projects
- File Operations: Create, update, and retrieve file contents
- Branch Management: Create branches and manage repository structure
- Issue Management: Create, list, update, search, and comment on issues
- Merge Request Management: List, update, merge, and comment on merge requests
- Label Management: Create, update, and delete project labels
- Project Milestones: Create, update, and delete project-level milestones
- Group Milestones: Create, update, and delete group-level milestones that span multiple projects
Group Milestones vs Project Milestones
This server supports both project milestones and group milestones:
Project Milestones
- Scoped to a single project
- Use tools:
list_milestones,create_milestone,update_milestone,delete_milestone - Example: Track features for
my-webappproject
Group Milestones
- Span multiple projects within a group
- Use tools:
list_group_milestones,create_group_milestone,update_group_milestone,delete_group_milestone - Support advanced filtering with
include_ancestors,include_descendants - Example: Track a release across
my-webapp,my-api, andmy-admin
Group Milestone Examples
List Group Milestones
{
"group_id": "my-organization",
"state": "active",
"include_descendants": true
}
Create Group Milestone
{
"group_id": "my-organization",
"title": "Q1 2025 Release",
"description": "Major feature release including new tools and performance improvements",
"due_date": "2025-03-31",
"start_date": "2025-01-01"
}
Advanced Group Milestone Search
{
"group_id": "my-organization/core",
"search": "release",
"include_ancestors": true,
"updated_after": "2024-01-01T00:00:00Z"
}
Based on the GitLab Group Milestones API, group milestones are ideal for coordinating releases and features across multiple projects in your organization.
Practical Workflow: Finding Groups and Creating Milestones
Here's a typical workflow for working with group milestones:
1. Search for Groups
First, find the group you want to work with:
{
"search": "my-organization",
"owned": true
}
2. List Existing Group Milestones
Check what milestones already exist:
{
"group_id": "my-organizatio
Tools (5)
list_milestonesList project-level milestones for a specific project.create_milestoneCreate a new project-level milestone.list_group_milestonesList group-level milestones that span multiple projects.create_group_milestoneCreate a new group-level milestone for coordinating across projects.search_groupsSearch for GitLab groups to find group IDs.Environment Variables
GITLAB_PERSONAL_ACCESS_TOKENrequiredPersonal access token for GitLab API authenticationGITLAB_API_URLBase URL for the GitLab API (defaults to https://gitlab.com/api/v4)Configuration
{"mcpServers":{"gitlab":{"command":"npx","args":["-y","@therealchristhomas/gitlab-mcp-server"],"env":{"GITLAB_PERSONAL_ACCESS_TOKEN":"your_token_here","GITLAB_API_URL":"https://gitlab.com/api/v4"}}}}