Skip to main content
Glama
owayo

https://github.com/owayo/gitlab-mcp-server

by owayo

GitLab-MCP-Server

GitLabとの連携機能を提供するModel Context Protocol (MCP) サーバーです。GitLabの特定のプロジェクトからパイプラインの失敗情報やマージリクエストへの指摘事項を取得し、AIアシスタントに提供します。

概要

このMCPサーバーは、GitLabのAPIを利用して以下の情報をAIアシスタントに提供します:

  1. GitLabパイプラインで失敗したジョブのコンソール出力

  2. GitLab MRへの未解決の指摘事項(コメント)

  3. GitLab MRの変更内容(ローカルリポジトリの現在の状態との差分)

MCPの機能を使用することで、AIアシスタントはGitLabの情報を直接取得し、より的確な支援を提供できます。

Related MCP server: mcp-gitlab-jira

インストール

# uvのインストール
$ curl -LsSf https://astral.sh/uv/install.sh | sh

$ cd /path/to/this-mcp-server
# ライブラリのインストール
$ uv sync

準備

GitLabのアクセストークンが必要です。 アクセストークンはGitLabの設定→アクセストークンにて発行してください。 発行する際、read_api にチェックを入れてください。

機能

1. パイプラインの失敗情報を取得して修正 (get_pipeline_failed_jobs)

GitLabパイプラインで失敗したジョブのコンソール出力を取得します。 取得した情報をもとにAIアシスタントによる修正が行われます。

出力:

  • 失敗したジョブのコンソール出力(ジョブ名、ステータス、詳細なログを含む)

2. MRの指摘事項を取得して修正 (get_review_comments)

GitLab MRの未解決の指摘事項(コメント)を取得して対応します。 解決済みのコメントやファイルに紐づいていないコメントは除外されます。

出力:

  • MRへの未解決かつファイルに紐づいている指摘事項(コメント者、時間、コメント内容、ファイル位置情報などを含む)

3. MRの変更内容を取得してレビュー (get_review_changes)

GitLab MRのベースコミット(base_sha)から現在のローカルリポジトリの状態までの差分を取得します。 リモートの差分ではなく、ローカルの最新状態(作業中の未コミット変更を含む)との差分を取得できます。 取得した差分でレビューが行われます。

出力:

  • MRのベースコミットから現在のローカル状態までの変更内容(各ファイルの変更タイプと差分)

AIアシスタントとの連携

AIアシスタント(Claude等)は、このMCPサーバーに対して以下の関数を呼び出すことができます:

  • get_pipeline_failed_jobs(): パイプラインの失敗情報取得

  • get_review_comments(): MRの指摘事項取得

  • get_review_changes(): MRの変更内容取得

これらの関数は、現在のブランチに関連するMRの情報を自動的に取得します。

Claude for Desktopでの設定

claude_desktop_config.json に以下の設定を追加してください:

{
    "mcpServers": {
        "gitlab-mcp": {
            "command": "uv",
            "args": [
                "--directory",
                "/path/to/this-mcp-server",
                "run",
                "main.py"
            ],
            "env": {
                "GITLAB_URL": "your_gitlab_url",
                "GITLAB_PROJECT_NAME": "gitlab_project_name",
                "GITLAB_API_KEY": "your_gitlab_api_key",
                "GIT_REPO_PATH": "/path/to/git/repo"
            }
        }
    }
}

Cursorでの設定

プロジェクトルートの .cursor/mcp.json に以下の設定を追加してください:

{
    "mcpServers": {
        "gitlab-mcp": {
            "command": "env",
            "args": [
                "GITLAB_URL=your_gitlab_url",
                "GITLAB_PROJECT_NAME=gitlab_project_name",
                "GITLAB_API_KEY=your_gitlab_api_key",
                "GIT_REPO_PATH=/path/to/git/repo",
                "uv",
                "--directory",
                "/path/to/this-mcp-server",
                "run",
                "main.py"
            ]
        }
    }
}

注意:上記の設定例で、以下の値を適切に置き換えてください:

  • your_gitlab_api_key: GitLab APIのアクセストークン

  • /path/to/git/repo: ローカルGitリポジトリの絶対パス

  • /path/to/this-mcp-server: このMCPサーバーのディレクトリの絶対パス

Available Tools

3 tools
get_pipeline_failed_jobsB

GitLabパイプラインで失敗したジョブのコンソール出力を取得

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions retrieving console output for failed jobs, implying a read-only operation, but doesn't disclose behavioral traits like authentication requirements, rate limits, error handling, or what happens if no failed jobs exist. The description is minimal and lacks critical operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence in Japanese that directly states the tool's function without unnecessary words. It's front-loaded and efficiently conveys the core purpose, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the return value includes (e.g., job details, error messages, format) or address potential complexities like pagination or filtering. For a tool that likely interacts with GitLab APIs, more context is needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add param details, but this is acceptable given the schema's completeness. Baseline is 4 for zero parameters, as the description doesn't need to compensate for gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'GitLabパイプラインで失敗したジョブのコンソール出力を取得' (Get console output for failed jobs in a GitLab pipeline). It specifies the verb ('取得' - get/retrieve) and resource ('失敗したジョブのコンソール出力' - console output of failed jobs), though it doesn't explicitly distinguish from sibling tools like 'get_review_changes' or 'get_review_comments'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a pipeline ID or authentication), context for invocation, or exclusions. Without annotations or sibling tool context, usage is implied but not explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_review_changesC

GitLab MRで修正したファイルの差分を取得

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It only states what the tool does (gets file differences) but doesn't describe any behavioral traits: no information about authentication requirements, rate limits, pagination, error conditions, or what format the differences are returned in. For a tool with zero annotation coverage, this is a significant gap in behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Japanese that directly states the tool's purpose. There's no wasted verbiage or unnecessary elaboration. However, it could be slightly improved by being front-loaded with more complete information about the tool's behavior and usage context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no annotations and no output schema, the description is incomplete. It doesn't explain what format the differences are returned in (unified diff? JSON? raw git diff?), what authentication is required, or any error conditions. For a tool that presumably interacts with GitLab's API, this leaves significant gaps in understanding how to properly use it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the parameter situation (none). The description doesn't need to compensate for any parameter gaps. The baseline for 0 parameters with full schema coverage is 4, as there's no parameter semantics burden on the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'gets differences of modified files in GitLab MR' which provides a basic purpose (verb+resource). However, it doesn't distinguish this from sibling tools like 'get_review_comments' - both appear to retrieve MR-related information but with different data types. The purpose is clear but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention when this should be used instead of 'get_review_comments' or 'get_pipeline_failed_jobs', nor does it provide any context about prerequisites, timing, or constraints. The agent receives no usage guidance beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_review_commentsB

GitLab MRの未解決の指摘事項(コメント)を取得

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool retrieves unresolved comments, but doesn't disclose behavioral traits such as authentication requirements, rate limits, pagination, error handling, or what 'unresolved' specifically means. This leaves significant gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded and appropriately sized for a simple tool with no parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters and no output schema, the description is minimally complete. It specifies what the tool does but lacks details on behavior, output format, or usage context. For a tool with no annotations and no output schema, more information would be helpful, but it's adequate for basic understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here. A baseline score of 4 is given since the schema fully covers the parameters (none), and the description doesn't need to compensate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'GitLab MRの未解決の指摘事項(コメント)を取得' translates to 'Get unresolved comments (review comments) for GitLab Merge Requests.' It specifies the verb ('get'), resource ('review comments'), and scope ('unresolved'), but doesn't explicitly differentiate from sibling tools like 'get_review_changes'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools, prerequisites, or specific contexts where this tool is preferred over others. Usage is implied by the purpose but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updates
    • First observedget_pipeline_failed_jobs
    • First observedget_review_changes
    • First observedget_review_comments

TDQS

B3.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: get_pipeline_failed_jobs targets pipeline failures, get_review_changes targets MR file diffs, and get_review_comments targets MR unresolved comments. There is no overlap in functionality or ambiguity between these three tools.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with 'get_' prefix and snake_case formatting (get_pipeline_failed_jobs, get_review_changes, get_review_comments). The naming convention is perfectly uniform across all tools.

Tool Count2/5

With only 3 tools, this server feels severely under-scoped for a GitLab integration. While the tools are coherent, a typical GitLab MCP server would need many more operations (e.g., list projects, create MRs, trigger pipelines) to be useful. The count is too low for the apparent domain.

Completeness2/5

The tool surface is extremely incomplete for GitLab operations. It only provides three specific 'get' operations for pipelines and MRs, missing all CRUD/lifecycle coverage (no create, update, delete, or listing operations). Agents will encounter dead ends when trying to perform basic GitLab workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A Model Context Protocol server that enables AI assistants to interact with GitLab repositories, allowing tasks like managing merge requests, searching projects, and creating comments through RESTful API integration.
    14 npm
    2
    -
  • A
    license
    B
    quality
    C
    maintenance
    A Model Context Protocol (MCP) server for GitLab and Jira integration. This server allows AI agents like gemini-cli to interact with your GitLab and Jira instances.
    32
    9 npm
    11
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants to interact with self-hosted GitLab instances through 30 specialized tools. It supports managing projects, merge requests, CI/CD pipelines, and repository operations via the GitLab REST API v4.
    30
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server for GitLab integration, enabling AI assistants to manage projects, merge requests, pipelines, issues, releases, and more.
    MIT