Skip to main content
Glama
JesBrian

GitLab MCP Server

by JesBrian

GitLab MCP Server

NOTE

This documentation is available in简体中文.

A GitLab API server built on the Model Context Protocol (MCP). This server provides a set of tools that allow AI models to interact with GitLab instances, with a focus on branch management and merge request (MR) operations.

Project Info

  • Package: @jesbrian/gitlab-mcp-server

  • Version: 0.2.4

  • Type: CommonJS

  • Main Entry: index.js

  • Executable: gitlab-mcp-server

  • Config Module: config/Config.js

Related MCP server: GitLab MR MCP

Project Structure

gitlab-mcp-server/
├── index.js                          # Main entry file
├── config/                           # Config directory
│   └── Config.js                     # Centralized config file
├── lib/                              # Library directory
│   └── GitLabClient.js               # GitLab API client
├── package.json
└── README.md

Modular Design

  • GitLabClient.js: Client class encapsulating GitLab API calls (root directory)

  • config/Config.js: Centralized management for all configuration items (GitLab connection, client options, MCP Server config, Tools definitions)

  • index.js: MCP Server main logic, handles tool invocations and request processing

Features

  • User Management: Get current GitLab user information.

  • Project Management: Search projects, get project ID mappings, and retrieve project details.

  • Branch Management:

    • List repository branches.

    • Create new branches (supports specifying source branch/tag).

    • Delete branches.

  • Merge Request (MR) Management:

    • Create MRs (supports standard creation and quick creation for public repositories).

    • Get MR status (including merge status, conflict detection).

    • Execute merge operations.

    • Close MRs.

    • Poll and wait for MR to become mergeable (supports timeout settings).

Configuration

All configuration items are centralized in lib/config/Config.js, customizable via environment variables:

Configure the following environment variables:

Variable

Description

Required

Default

GITLAB_URL

GitLab instance URL (e.g., https://gitlab.example.com)

Yes

-

GITLAB_PRIVATE_TOKEN

GitLab personal access token (Private Token)

Yes

-

TIMEOUT

Request timeout in milliseconds

No

10000

WAIT_INTERVAL

Polling interval in milliseconds

No

2000

Usage

As an MCP Server

Add to Claude Desktop configuration file:

{
  "mcpServers": {
    "gitlab": {
      "command": "npx",
      "args": ["@jesbrian/gitlab-mcp-server"],
      "env": {
        "GITLAB_URL": "https://your-gitlab-url.com",
        "GITLAB_PRIVATE_TOKEN": "your-private-token"
      }
    }
  }
}

Option 2: Local Path

Start the project locally first, then configure Claude Code:

# After cloning the project, enter the directory and install dependencies
cd gitlab-mcp-server
npm install

# Start the service locally (choose one method)
npm start              # Option 1: Use npm scripts
node index.js          # Option 2: Run directly
gitlab-mcp-server      # Option 3: Install globally and use command

Add to Claude Code MCP configuration:

{
  "mcpServers": {
    "gitlab": {
      "command": "node",
      "args": ["/path/to/gitlab-mcp-server/index.js"],
      "env": {
        "GITLAB_URL": "https://your-gitlab-url.com",
        "GITLAB_PRIVATE_TOKEN": "your-private-token"
      }
    }
  }
}

Available Tools

User & Project Management

  • get_current_user: Get current GitLab user information.

  • get_project_ids: Search projects by name and get project ID mappings (returns IDs across different namespaces).

  • get_project: Get detailed information for a specified project.

Branch Operations

  • get_repository_branches: List branches of a project.

  • create_branch: Create a new branch (can specify source branch/tag, defaults to master).

  • delete_branch: Delete a branch.

Merge Request (MR)

  • create_merge_request: Create a merge request (supports custom title and description).

  • create_merge_request_to_public: Quick tool that auto-detects personal and public repositories, creates MR from personal branch to public repository.

  • merge_branch: Execute merge operation.

  • get_merge_request_status: Get current MR status (including merge status, conflicts, etc.).

  • close_merge_request: Close a merge request.

  • wait_for_mergeable_status: Poll and wait for MR to become mergeable (supports timeout, default 5 minutes).

Available Tools

1 tool
get_merge_request_statusC

获取合并请求状态

ParametersJSON Schema
NameRequiredDescriptionDefault
mergeRequestIidYesMR 内部 ID
targetProjectIdYes目标项目 ID

TDQS

C2.2/5.0
Behavior2/5

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

No behavioral traits are disclosed. As a 'get' operation, it is likely read-only, but the description does not confirm this, nor does it mention any side effects, authorization requirements, or rate limits. No annotations are present to compensate.

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

Conciseness2/5

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

The description is extremely short but fails to provide meaningful information. It is under-specified rather than concise.

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?

For a simple get operation with only two parameters and no output schema, the description still lacks context such as what the response looks like or how to interpret the status.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The tool description adds no parameter-specific information beyond what is already in the schema.

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

Purpose2/5

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

The description '获取合并请求状态' is a direct translation of the tool name, adding no new information. It is a tautology, restating the tool's purpose without further detail.

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 on when to use this tool over alternatives or in what context (e.g., before making changes, polling, etc.). There is no mention of prerequisite actions or conditions.

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. Dates show when Glama detected each change.

  1. 1 tool updatev0.2.4
    • First observedget_merge_request_status

TDQS

C2.4/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap.

Naming Consistency5/5

A single tool trivially maintains naming consistency; there are no inconsistencies to assess.

Tool Count1/5

One tool for a GitLab server is extremely thin; GitLab's broad feature set requires many more tools for meaningful coverage.

Completeness1/5

The server only exposes a merge request status check, missing all other essential GitLab operations such as issue, repository, and pipeline management.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides GitLab integration for AI assistants using Model Context Protocol, enabling repository operations, file management, issue tracking, merge requests, and branch/tag administration through natural language.
    2
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to interact with GitLab repositories, allowing them to manage merge requests and issues including listing projects, fetching MR details and diffs, adding comments, and updating MR titles and descriptions.
    48
    94
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Integrates GitLab with AI assistants to manage merge requests, analyze CI/CD pipelines, and create Architecture Decision Records. It enables seamless code searching, pipeline triggering, and deployment management through the Model Context Protocol.
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI-assisted code review and repository management for on-premise GitLab instances. It provides tools for interacting with merge requests, browsing source code, and searching repositories via the Model Context Protocol.
    1
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JesBrian/gitlab-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server