GitLab CLI MCP Server
Seamlessly integrate AI assistants with GitLab using the glab CLI tool.
GitLab MCP Server (Swift)
A Model Context Protocol (MCP) server that wraps the GitLab CLI (glab) to provide GitLab functionality to AI assistants like Claude Desktop.
Features
- 🚀 Native Swift implementation using the official MCP Swift SDK
- 🔧 Full GitLab CLI integration - supports all
glabcommands - 🎯 Smart prompts for common workflows (merge requests, CI/CD, daily standup)
- 📊 JSON output parsing with fallback to plain text
- 🔐 Secure authentication via system
glabcredentials - ⚡ High performance with Swift's async/await concurrency
Prerequisites
- macOS (Swift 5.9+ installed via Xcode)
- glab CLI installed and authenticated
- Claude Desktop or another MCP-compatible client
Installation
Quick Install
# Clone the repository
git clone https://github.com/yourusername/gitlab-mcp-swift.git
cd gitlab-mcp-swift
# Run the install script
./install.sh
The install script will:
- Build the server using Swift Package Manager
- Install it to
~/.swiftpm/bin/git-lab-mcp - Display the configuration for Claude Desktop
Manual Installation
# Build the project
swift build -c release
# Install to a location in your PATH
cp .build/release/git-lab-mcp ~/.swiftpm/bin/
Configuration
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"gitlab": {
"command": "/Users/YOUR_USERNAME/.swiftpm/bin/git-lab-mcp",
"args": ["--log-level", "info"],
"env": {
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
}
}
}
}
Authentication
The server uses your existing glab CLI authentication:
# Login to GitLab
glab auth login
# Check authentication status
glab auth status
Available Tools
Core Tools
glab_mr- Merge request operations (list, create, view, merge, approve)glab_issue- Issue management (list, create, view, close, update)glab_ci- CI/CD pipeline operations (view, list, run, retry)glab_repo- Repository operations (clone, fork, view, archive)glab_api- Direct GitLab API accessglab_auth- Authentication managementglab_version- Version informationglab_raw- Execute any glab command directly
Prompts
The server includes intelligent prompts for common workflows:
my-mrs- Check your merge requestscreate-mr- Create a merge request with guided parametersdaily-standup- Gather GitLab activity for daily standupsreview-pipeline- Review CI/CD pipeline status
Usage Examples
Check Your Merge Requests
Use the prompt "my-mrs" to see all your open merge requests
Create a Merge Request
Use the prompt "create-mr" with:
- title: "Fix: Memory leak in user service"
- source_branch: "fix/memory-leak"
- target_branch: "main"
Run CI/CD Pipeline
Use tool "glab_ci" with:
- subcommand: "run"
- repo: "myteam/myproject"
Development
Building from Source
# Clone the repository
git clone https://github.com/yourusername/gitlab-mcp-swift.git
cd gitlab-mcp-swift
# Build in debug mode
swift build
# Run tests
swift test
# Build for release
swift build -c release
Project Structure
gitlab-mcp-swift/
├── Sources/
│ └── GitLabMCP/
│ ├── GitLabMCPServer.swift # Main server implementation
│ ├── GitLabMCPCommand.swift # CLI entry point
│ └── GitLabCLI.swift # GitLab CLI wrapper
├── Package.swift # Swift package manifest
├── install.sh # Installation script
└── README.md # This file
Troubleshooting
Server fails to start
- Ensure
glabis installed:which glab - Check authentication:
glab auth status - Run with debug logging:
--log-level debug
Commands return "not authenticated"
- Run
glab auth loginto authenticate - For self-hosted instances:
glab auth login --hostname your.gitlab.instance
MCP connection issues
- Restart Claude Desktop after configuration changes
- Check the logs in Claude Desktop's developer console
- Verify the executable path is correct in the configuration
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details
Acknowledgments
- Built with the Model Context Protocol Swift SDK
- Wraps the excellent GitLab CLI (glab)
- Inspired by the need for better GitLab integration in AI assistants
相关服务器
Gitea MCP Server
Manage Gitea repositories and execute commands directly from your MCP-compatible chat interface.
CData Bitbucket
A read-only MCP server for Bitbucket, enabling LLMs to query live data using the CData JDBC Driver.
Gerrit Code Review
Integrates with the Gerrit code review system to review code changes and details.
GitHub Repos Manager MCP Server
Token-based GitHub automation management. No Docker, Flexible configuration, 80+ tools with direct API integration.
Gitee
Gitee API integration, repository, issue, and pull request management, and more.
GitLab
A GitLab integration server providing access to GitLab's RESTful API tools, built on the fastmcp framework.
GitHub
Interact with the GitHub API to manage repositories, issues, and pull requests.
MCP GitHub Project Manager
Manage GitHub projects with requirements traceability and advanced workflows.
Git MCP Server
An MCP server that allows AI agents to interact with Git repositories, supporting a wide range of operations like clone, commit, branch, and push.
GitHub Projects V2
Manage GitHub Projects V2 using the GitHub GraphQL API.