mcp-gitlab
Enables AI assistants to manage GitLab issues, merge requests, pipelines, and access the REST API via the glab CLI.
README
@weirdscience/mcp-gitlab
A Model Context Protocol (MCP) server that provides GitLab integration tools using the glab CLI. This server enables AI assistants to interact with GitLab repositories, issues, merge requests, and pipelines through a standardized MCP interface.
Features
- Issue Management: List, create, and manage GitLab issues
- Merge Requests: List and create merge requests
- Pipeline Monitoring: View project pipelines and their status
- Raw API Access: Direct access to GitLab REST API endpoints
- Multi-Instance Support: Works with gitlab.com and self-hosted GitLab instances
- Pagination Support: Automatic handling of large result sets
Prerequisites
- Node.js 18+
glabCLI tool installed and configured- GitLab personal access token
Installation
Global Installation
npm install -g @weirdscience/mcp-gitlab
Local Installation
npm install @weirdscience/mcp-gitlab
Setup
1. Install glab CLI
First, install the glab CLI tool:
# macOS
brew install glab
# Linux
sudo apt install glab
# Windows
winget install GitLab.GLab
2. Configure glab
Authenticate with your GitLab instance:
# For gitlab.com
glab auth login
# For self-hosted GitLab
glab auth login --hostname gitlab.your-instance.com
3. Configure MCP
Add the server to your MCP configuration file (~/.config/mcp.json or similar):
{
"mcpServers": {
"gitlab-glab": {
"command": "mcp-gitlab",
"env": {
"GITLAB_HOST": "gitlab.com",
"GITLAB_TOKEN": "your-gitlab-token"
}
}
}
}
Cursor Configuration
To use this MCP server with Cursor, you need to configure it in Cursor's settings:
Method 1: Global Configuration
- Open Cursor's Command Palette (
Cmd/Ctrl + Shift + P) - Search for "MCP" and select "MCP: Configure Servers"
- Add a new server configuration:
{
"name": "gitlab-glab",
"command": "mcp-gitlab",
"env": {
"GITLAB_HOST": "gitlab.com",
"GITLAB_TOKEN": "your-gitlab-token"
}
}
Method 2: Workspace Configuration
Create a .cursorrules file in your project root:
{
"mcpServers": {
"gitlab-glab": {
"command": "mcp-gitlab",
"env": {
"GITLAB_HOST": "gitlab.com",
"GITLAB_TOKEN": "your-gitlab-token"
}
}
}
}
Method 3: Settings UI
- Open Cursor Settings (
Cmd/Ctrl + ,) - Search for "MCP"
- Add the server configuration in the MCP settings section
Verification
After configuration, you can verify the server is working by:
- Opening Cursor's Command Palette
- Running "MCP: List Available Tools"
- You should see tools like
gitlab.issues.list,gitlab.mrs.list, etc.
Usage in Cursor
Once configured, you can use GitLab tools directly in Cursor:
- Ask Cursor to "list open issues in my project"
- Request "create a merge request for the current branch"
- Ask "show me the latest pipeline status"
Cursor will automatically use the appropriate MCP tools to fulfill these requests.
Environment Variables
| Variable | Description | Example |
|---|---|---|
GITLAB_HOST |
GitLab instance hostname | gitlab.com or gitlab.your-company.com |
GITLAB_TOKEN |
GitLab personal access token | glpat-xxxxxxxxxxxxxxxxxxxx |
GITLAB_URI |
Full GitLab instance URI | https://gitlab.your-company.com |
Available Tools
gitlab.issues.list
List issues for a project.
Parameters:
project(string): Project path or numeric ID (e.g.,'gitlab-org/cli')state(optional): Issue state ('opened','closed','all')labels(optional): Comma-separated label namesassignee(optional): Assignee username
gitlab.mrs.list
List merge requests for a project.
Parameters:
project(string): Project path or numeric IDstate(optional): MR state ('opened','merged','closed','all')labels(optional): Comma-separated label namesdraft(optional): Filter for draft MRs
gitlab.mr.create
Create a new merge request.
Parameters:
project(string): Project path or numeric IDsourceBranch(string): Source branch nametargetBranch(string): Target branch nametitle(string): MR titledescription(optional): MR descriptiondraft(optional): Create as draft MRlabels(optional): Comma-separated labelsassignees(optional): Comma-separated assignee usernames
gitlab.pipelines.list
List pipelines for a project.
Parameters:
project(string): Project path or numeric IDpage(optional): Page number (default: 1)perPage(optional): Items per page (default: 50, max: 100)status(optional): Pipeline status filter
gitlab.api
Low-level access to GitLab REST API.
Parameters:
method(optional): HTTP method ('GET','POST','PUT','PATCH','DELETE')path(string): API path below/api/v4fields(optional): Request body fieldsheaders(optional): Custom headers
glab.version
Get the installed glab CLI version.
Usage Examples
List Open Issues
{
"tool": "gitlab.issues.list",
"arguments": {
"project": "gitlab-org/cli",
"state": "opened"
}
}
Create Merge Request
{
"tool": "gitlab.mr.create",
"arguments": {
"project": "my-group/my-project",
"sourceBranch": "feature/new-feature",
"targetBranch": "main",
"title": "Add new feature",
"description": "This PR adds a new feature to improve user experience.",
"labels": "enhancement,frontend"
}
}
Get Project Pipelines
{
"tool": "gitlab.pipelines.list",
"arguments": {
"project": "my-group/my-project",
"perPage": 10,
"status": "success"
}
}
Development
Prerequisites
- Node.js 18+
- npm or yarn
Setup
git clone https://github.com/weirdscience/mcp-gitlab.git
cd mcp-gitlab
npm install
Build
npm run build
Development Mode
npm run dev
Testing
npm run check
Linting
npm run lint
npm run lint:fix
Formatting
npm run format
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Model Context Protocol for the MCP specification
- glab CLI for GitLab command-line interface
- GitLab for the GitLab platform
Support
If you encounter any issues or have questions:
- Check the GitHub Issues
- Review the glab CLI documentation
- Consult the MCP documentation
Changelog
0.1.0
- Initial release
- Basic GitLab integration via glab CLI
- Support for issues, merge requests, and pipelines
- Raw API access capability
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。