mcp-gitlab

mcp-gitlab

mcp-gitlab

Category
访问服务器

README

GitLab MCP Server

A Model Context Protocol (MCP) server that enables you to interact with your GitLab account. Get diffs, analyze merge requests, review code, cherry-pick changes, and more.

Features

This MCP server provides comprehensive tools for interacting with GitLab repositories, including:

Core Repository Features

  • Listing projects and retrieving details
  • Managing branches and repositories
  • Working with merge requests and diffs
  • Adding comments and internal notes to merge requests
  • Updating merge request attributes
  • Listing and working with issues
  • Getting and comparing repository file contents

Project Settings & Integrations

  • Managing project integrations and services
  • Configuring and controlling Slack integration
  • Setting up, updating, and testing webhooks

CI/CD Management

  • Working with pipeline trigger tokens
  • Managing CI/CD variables
  • Triggering and controlling pipelines

User & Group Administration

  • Listing and managing users
  • Working with groups and group memberships
  • Managing project members and access levels

Installation

Option 1: Using Pre-built Docker Image (Recommended)

The easiest way to run the GitLab MCP Server is using the pre-built Docker image:

# Pull the latest image
docker pull ghcr.io/atla-digital/mcp-gitlab:latest

# Run the container
docker run -d -p 3001:3000 --name mcp-gitlab-server ghcr.io/atla-digital/mcp-gitlab:latest

The server will be available at http://localhost:3001/mcp

Option 2: Using Docker Compose

Create a docker-compose.yml file:

services:
  mcp-gitlab:
    image: ghcr.io/atla-digital/mcp-gitlab:latest
    ports:
      - "3001:3000"
    restart: unless-stopped

Then run:

docker compose up -d

Option 3: Building from Source

If you want to build from source or contribute to the project:

Prerequisites

  • Node.js (v16 or higher)
  • npm
  • A GitLab account with an API token

Setup

  1. Clone the repository:
git clone https://github.com/atla-digital/mcp-gitlab.git
cd mcp-gitlab
  1. Install dependencies:
npm install
  1. Build the server:
npm run build
  1. Install git hooks (optional, but recommended for contributors):
npm run install-hooks

This installs a pre-commit hook that automatically regenerates TOOLS.md when src/utils/tools-data.ts changes.

  1. Deploy the server:
docker compose up --build -d

The server will be available at http://localhost:3001/mcp

Configuration

This server implements Streamable HTTP as the primary MCP transport. For clients that don't support Streamable HTTP natively (like Claude Code), use mcp-remote as a proxy.

For Claude Code/Desktop

Add the following to your MCP settings file (~/.claude.json):

{
  "mcpServers": {
    "sm-gitlab": {
      "command": "npx",
      "args": [
        "mcp-remote@latest",
        "http://host.docker.internal:3001/mcp",
        "--allow-http",
        "--header",
        "X-GitLab-Token: ${GITLAB_TOKEN}",
        "--header",
        "X-GitLab-URL: ${GITLAB_URL}"
      ],
      "env": {
        "GITLAB_TOKEN": "YOUR_GITLAB_API_TOKEN",
        "GITLAB_URL": "https://your-gitlab-instance.com/api/v4"
      }
    }
  }
}

For Streamable HTTP Compatible Clients

Direct connection to the server:

http://localhost:3001/mcp

Pass GitLab credentials as HTTP headers:

  • X-GitLab-Token: Your GitLab API token
  • X-GitLab-URL: Your GitLab API base URL (defaults to https://gitlab.com/api/v4)

Replace YOUR_GITLAB_API_TOKEN with your actual GitLab API token. You can generate a token in your GitLab account under Settings > Access Tokens.

Updating to Latest Version

To update to the latest version when using the pre-built Docker image:

# Stop the current container
docker stop mcp-gitlab-server
docker rm mcp-gitlab-server

# Pull the latest image
docker pull ghcr.io/atla-digital/mcp-gitlab:latest

# Run with the new image
docker run -d -p 3001:3000 --name mcp-gitlab-server ghcr.io/atla-digital/mcp-gitlab:latest

Or if using Docker Compose:

docker compose pull
docker compose up -d

Available Tools

For a complete list of available tools and their parameters, see TOOLS.md.

Example Usage

Here are examples of how to use these tools with AI assistants that support MCP:

List your projects

Could you list my GitLab projects?

Get information about a specific merge request

Can you show me the details of merge request with ID 123 in the project 'mygroup/myproject'?

Add a comment to a merge request

Please add a comment to merge request 123 in project 'mygroup/myproject' saying "This looks good, but please add more tests."

Add an internal note to a merge request

Add an internal note to merge request 123 in project 'mygroup/myproject' that says "Needs security review before merging." Make sure it's only visible to team members.

Update a merge request title and description

Update the title of merge request 123 in project 'mygroup/myproject' to "Fix login page performance issues" and update the description to include "This PR addresses the slow loading times on the login page by optimizing database queries."

Compare branches

Compare the 'feature-branch' with 'main' in the project 'mygroup/myproject' and show me the differences.

Practical Workflows

Reviewing a Merge Request

1. Show me merge request 123 in project 'mygroup/myproject'
2. Show me the changes for this merge request
3. Add an internal note with my review comments
4. Update the merge request title to better reflect the changes

Project Exploration

1. List all my GitLab projects
2. Show me the details of project 'mygroup/myproject'
3. List all branches in this project
4. Show me the content of the README.md file in the main branch

Available Resources

gitlab://projects

List of GitLab projects accessible with your API token.

Integration with AI Assistants

The GitLab MCP Server integrates with AI assistants that support the Model Context Protocol (MCP).

Capabilities

When connected to an AI assistant, this server enables the assistant to:

  1. View and analyze code: The assistant can fetch file contents, view branch differences, and examine merge request changes for better code understanding.

  2. Provide code reviews: The assistant can analyze merge requests and provide feedback through comments or internal notes.

  3. Manage project workflows: The assistant can update merge request attributes, add comments, and help with repository management tasks.

  4. Explore project structure: The assistant can browse projects, branches, and files to understand the codebase structure.

  5. Configure CI/CD and integrations: The assistant can help set up webhooks, manage CI/CD variables, and configure project integrations.

Getting the Most from AI Assistant Integration

  • Be specific when asking about projects, merge requests, or files
  • Provide project IDs or paths when possible
  • Use the assistant for code review by asking it to analyze specific merge requests
  • Have the assistant help with repository configuration and management tasks
  • Use internal notes for team-only feedback on merge requests

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选