GitLab MCP Server

GitLab MCP Server

Enables interaction with GitLab via the GitLab REST API v4, providing tools for managing projects, merge requests, issues, pipelines, and more through MCP.

Category
访问服务器

README

GitLab MCP Server

MCP server for GitLab REST API v4 built with fastmcp. Optimized for minimal token usage.

Prerequisites

For end users (Claude/Codex):

  • ✅ Python 3.10+ installed on your system
  • ✅ GitLab Personal Access Token

That's it! No manual installation needed - everything else is automatic.

How It Works

When you run the server through npx, the Node.js launcher automatically:

  1. ✅ Checks for Python - Looks for python3 or python in your PATH
  2. ✅ Creates virtual environment - In ~/.cache/gitlab-mcp-server/venv
  3. ✅ Installs dependencies - fastmcp from requirements.txt
  4. ✅ Caches everything - Fast subsequent launches

First run: ~10-30 seconds (one-time setup) Next runs: Instant (uses cached venv)

If Python is Not Found

If Python 3.10+ is not installed, the launcher will show instructions for your OS:

  • macOS: brew install python@3.11 or download from python.org
  • Linux: sudo apt install python3 or sudo yum install python3
  • Windows: Download from python.org or winget install Python.Python.3.11

You don't need to manually install fastmcp or create virtualenv! The launcher handles that.

Configuration

Claude Code

Add the server using the CLI:

claude mcp add gitlab --transport stdio \
  --env GITLAB_TOKEN=your-gitlab-token \
  --env GITLAB_URL=https://gitlab.com \
  --env GITLAB_TIMEOUT=30 \
  -- npx -y git+https://github.com/YOUR_ORG/YOUR_REPO.git#main

Or add to ~/.claude.json:

{
  "mcpServers": {
    "gitlab": {
      "command": "npx",
      "args": ["-y", "git+https://github.com/YOUR_ORG/YOUR_REPO.git#main"],
      "env": {
        "GITLAB_TOKEN": "your-gitlab-token",
        "GITLAB_URL": "https://gitlab.com",
        "GITLAB_TIMEOUT": "30"
      }
    }
  }
}

Codex

Add to ~/.codex/config.toml:

[mcp_servers.gitlab]
command = "npx"
args = ["-y", "git+https://github.com/YOUR_ORG/YOUR_REPO.git#main"]
startup_timeout_sec = 60
enabled = true

[mcp_servers.gitlab.env]
GITLAB_TOKEN = "your-gitlab-token"
GITLAB_URL = "https://gitlab.com"
GITLAB_TIMEOUT = "30"
MCP_TRANSPORT = "stdio"

Note: Replace YOUR_ORG/YOUR_REPO with your GitHub repository path (e.g., myorg/gitlab-mcp-server).

Environment Variables

Variable Required Default Description
GITLAB_TOKEN Yes - GitLab Personal Access Token
GITLAB_URL No https://gitlab.com GitLab instance URL
GITLAB_TIMEOUT No 30 API timeout in seconds
MCP_TRANSPORT No stdio Transport protocol
GITLAB_MCP_CACHE_DIR No ~/.cache Custom cache directory for virtualenv

Available Tools

This server exposes 20+ GitLab operations as MCP tools:

User

  • gitlab_whoami - Get current user profile and validate credentials

Projects

  • gitlab_list_projects - List GitLab projects (supports search, pagination)
  • gitlab_get_project - Get single project details by ID or path

Branches

  • gitlab_list_branches - List repository branches in a project

Merge Requests

  • gitlab_list_merge_requests - List merge requests (filter by state: opened, merged, closed)
  • gitlab_get_merge_request - Get single merge request details
  • gitlab_create_merge_request - Create new merge request
  • gitlab_merge_merge_request - Merge a merge request
  • gitlab_list_merge_request_notes - List comments on a merge request
  • gitlab_create_merge_request_note - Add comment to a merge request
  • gitlab_list_merge_request_discussions - List discussion threads on a merge request
  • gitlab_create_merge_request_discussion_note - Reply to a discussion thread

Issues

  • gitlab_list_issues - List issues in a project (filter by state: opened, closed)
  • gitlab_create_issue - Create new issue
  • gitlab_list_issue_notes - List comments on an issue
  • gitlab_create_issue_note - Add comment to an issue

Pipelines & CI/CD

  • gitlab_list_pipelines - List CI/CD pipelines (filter by ref, status)
  • gitlab_get_pipeline - Get single pipeline details
  • gitlab_create_pipeline - Trigger new pipeline
  • gitlab_list_pipeline_jobs - List jobs in a pipeline
  • gitlab_get_job - Get single job details
  • gitlab_play_job - Start a manual job
  • gitlab_retry_job - Retry a failed job
  • gitlab_cancel_job - Cancel a running/pending job

All tools support GitLab.com and self-hosted GitLab instances via the GITLAB_URL environment variable.

For Developers

If you're developing or testing locally:

# Clone the repo
git clone https://github.com/YOUR_ORG/YOUR_REPO.git
cd YOUR_REPO

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows

# Install dependencies
pip install -r requirements.txt

# Set environment variables
export GITLAB_TOKEN='your-gitlab-token'
export GITLAB_URL='https://gitlab.com'

# Run the server directly
python3 gitlab_mcp_server.py

# Or test via Node.js launcher
node bin/gitlab-mcp-server.js

Note for end users: You don't need to do this! The npx launcher handles everything automatically.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选