gitlab-clone-mcp-server

skmprb/gitlab-clone-mcp-server

3.2

If you are the rightful owner of gitlab-clone-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The GitLab MCP Server is a comprehensive Model Context Protocol server that integrates seamlessly with the GitLab API, enabling users to manage their GitLab workflows through natural language commands.

Tools
5
Resources
0
Prompts
0

GitLab MCP Server

PyPI version Python 3.10+ License: MIT

A comprehensive Model Context Protocol (MCP) server that provides seamless GitLab API integration for Claude Desktop and other MCP clients. Manage your entire GitLab workflow through natural language commands - from project creation to repository operations, CI/CD management, and team collaboration.

🚀 Quick Start

# Install with uvx (recommended)
uvx --from gitlab-clone-mcp-server gitlab-mcp

# Or install as a tool
uv tool install gitlab-clone-mcp-server

🔌 Transport Options

GitLab MCP Server supports three transport types:

# Run with stdio transport (default)
gitlab-mcp stdio

# Run with SSE transport
gitlab-mcp sse --host localhost --port 8000

# Run with Streamable HTTP transport (recommended for production)
gitlab-mcp streamable-http --host localhost --port 8000

See for detailed configuration.

✨ Key Features

  • Complete GitLab Integration: 46+ tools covering all major GitLab operations
  • Natural Language Interface: Control GitLab through conversational commands
  • Zero Configuration: Works out-of-the-box with your GitLab Personal Access Token
  • Comprehensive Coverage: Projects, repositories, issues, merge requests, CI/CD, and more
  • Local Repository Cloning: Clone repositories directly to your local machine
  • Batch Operations: Perform bulk operations across multiple projects

🛠️ Available Tools (46 Total)

📁 Project Management (12 tools)

ToolDescription
create_projectCreate new GitLab projects with custom settings
delete_projectPermanently delete GitLab projects
update_projectModify project name, description, visibility
fork_projectFork projects to different namespaces
archive_projectArchive projects for long-term storage
unarchive_projectRestore archived projects
list_projectsList all accessible projects with filters
search_projectsSearch projects by name or keywords
get_project_milestonesView project milestones and deadlines
get_project_labelsList all project labels and colors
list_project_hooksView configured webhooks
get_current_userGet current user information and permissions

📝 Issue Management (4 tools)

ToolDescription
get_project_issuesList issues with state filtering
create_issueCreate new issues with descriptions
update_issueModify issue title, description, state
close_issueClose specific issues

🔀 Merge Request Management (2 tools)

ToolDescription
get_merge_requestsList merge requests by state
create_merge_requestCreate new merge requests
merge_merge_requestMerge approved merge requests

📄 File Operations (5 tools)

ToolDescription
create_fileCreate new files with content
update_fileModify existing file content
delete_fileRemove files from repository
get_file_contentRead file contents
get_repository_filesBrowse directory structures

🌿 Repository & Git Operations (15 tools)

ToolDescription
get_project_branchesList all repository branches
create_branchCreate new branches from any reference
delete_branchRemove branches safely
get_commitsView commit history
create_commitCreate commits with multiple file changes
compare_branchesCompare differences between branches
revert_commitRevert specific commits
cherry_pick_commitCherry-pick commits between branches
get_repository_tagsList all repository tags
create_tagCreate release tags
delete_tagRemove tags
clone_repositoryClone single repository locally
clone_group_repositoriesBatch clone all group repositories

🚀 CI/CD Operations (3 tools)

ToolDescription
get_pipelinesMonitor pipeline status
get_pipeline_jobsView individual job details
trigger_pipelineStart new pipeline runs

👥 Groups & Collaboration (3 tools)

ToolDescription
list_groupsList accessible GitLab groups
get_group_membersView group membership
get_current_userGet user profile information

Installation

Using uvx (Recommended)

uvx --from gitlab-clone-mcp-server gitlab-mcp

Using uv

uv tool install gitlab-mcp-server

From source

git clone <repository-url>
cd gitlab-mcp
uv sync

Setup

  1. Get GitLab Personal Access Token:

    • Go to GitLab → Settings → Access Tokens
    • Create token with api scope
    • Copy the token
  2. Set environment variables:

    export GITLAB_TOKEN="your_token_here"
    export GITLAB_URL="https://gitlab.com"  # optional
    
  3. Test the server:

    gitlab-mcp
    

Configuration

Claude Desktop Configuration

Add to your Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json):

Using stdio transport (recommended)
{
  "mcpServers": {
    "gitlab": {
      "command": "uvx",
      "args": [
        "--from", "gitlab-clone-mcp-server",
        "gitlab-mcp", "stdio"
      ],
      "env": {
        "GITLAB_URL": "https://gitlab.com",
        "GITLAB_TOKEN": "your_gitlab_token_here"
      }
    }
  }
}
Using HTTP transport

If you're running the server with Streamable HTTP transport:

{
  "mcpServers": {
    "gitlab": {
      "url": "http://localhost:8000/mcp",
      "headers": {
        "GITLAB_TOKEN": "your_gitlab_token_here"
      }
    }
  }
}

Headers Integration

For applications using MCPToolset, connect with headers:

import os
from mcp_toolset import MCPToolset, SseServerParams

gitlab_tools = MCPToolset(
    connection_params=SseServerParams(
        url="http://localhost:8000/sse",
        headers={"GITLAB_TOKEN": os.getenv("GITLAB_TOKEN")},
    )
)

💬 Usage Examples

Control GitLab through natural language commands:

Project Management:

  • "Create a new private project called 'microservice-api'"
  • "Fork the kubernetes/dashboard project to my namespace"
  • "Archive the old legacy-system project"

Issue & Code Review:

  • "Show all open issues in the backend-service project"
  • "Create merge request from feature/auth-system to main branch"
  • "Merge the approved MR #23 in mobile-app project"

Repository Operations:

  • "Create a new config.yaml file with database configuration"
  • "Show all branches in the web-application project"
  • "Clone the microservices-platform project to ./local-dev"

CI/CD & Teams:

  • "Show running pipelines for the deployment project"
  • "List all my GitLab groups and their members"

🔧 Authentication Setup

GitLab Personal Access Token

  1. Go to GitLab → Settings → Access Tokens
  2. Create token with these scopes:
    • api - Full API access
    • read_repository - Read repository data
    • write_repository - Write repository data
    • read_user - Read user information
  3. Copy the generated token

Environment Variables

VariableDescriptionDefault
GITLAB_TOKENPersonal Access TokenRequired
GITLAB_URLGitLab instance URLhttps://gitlab.com

🔒 Security Best Practices

  • Never commit tokens to version control
  • Use environment variables for token storage
  • Set token expiration dates when possible
  • Rotate tokens regularly for enhanced security
  • Use minimal required scopes for your use case

🐛 Troubleshooting

Token Issues:

  • GITLAB_TOKEN not set → Set environment variable or provide in headers
  • 401 Unauthorized → Check token permissions and validity
  • 403 Forbidden → Verify project access permissions

Git Operations:

  • Git command not found → Install Git and add to PATH

Test Connection:

curl -H "PRIVATE-TOKEN: your_token" "https://gitlab.com/api/v4/user"

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the file for details.

🔗 Related Projects


Made with ❤️ for the GitLab and MCP community