Get the FREE Ultimate OpenClaw Setup Guide →

gitlab

gitlab operator mcp server for AI agent

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio codyrao-gitlab-mcp-server ./gitlab-mcp-server -config config.yaml -transport stdio \
  --env GITLAB_HOST="https://gitlab.com" \
  --env GITLAB_TOKEN="your-gitlab-token" \
  --env GITLAB_MCP_PORT="8080" \
  --env GITLAB_MCP_TRANSPORT="stdio"

How to use

This MCP server provides a GitLab-integrated interface for AI assistants to interact with GitLab APIs in a structured, secure manner. It exposes a set of read-only operations by default and a subset of write operations with safety restrictions to prevent unintended changes to critical branches. The server supports multiple transport methods, including stdio, SSE, and streamable transports, allowing you to connect using different MCP clients. Available tools allow listing projects, fetching project and MR details, reading files and commits, and creating MR notes or MRs under controlled constraints. To start, configure the server with your GitLab token and host, choose a transport (stdio for local use, or sse for streaming), and run the binary or Docker image. Connect your MCP client to the appropriate endpoint (for SSE, typically an HTTP URL like /connect) and begin issuing requests through the provided tool functions such as gitlab_list_projects, gitlab_get_project, gitlab_list_mrs, gitlab_get_file_content, and gitlab_create_MR_note. The tools are designed to mirror common GitLab operations while enforcing the server’s security restrictions.

How to install

Prerequisites:

  • Go tooling installed (go version 1.18+)
  • Docker (optional, for container deployment)
  • Git for cloning the repository

From Source:

  1. Clone the repository: git clone https://github.com/yourusername/gitlab-mcp-server.git cd gitlab-mcp-server

  2. Build the server binary: go build -o gitlab-mcp-server ./cmd/server

  3. Run locally (examples): ./gitlab-mcp-server -config config.yaml -transport stdio

  4. Create a configuration file (config.yaml) as described in the repository to specify GitLab host and token, and transport settings. Example: server: host: "0.0.0.0" port: 8080 transport: "stdio" gitlab: host: "https://gitlab.com" token: "your-gitlab-token-here" logging: level: "info"

Using Docker:

  1. Build the Docker image (from repo root): docker build -t gitlab-mcp-server .

  2. Run the container with required environment variables: docker run -e GITLAB_TOKEN="your-token"
    -e GITLAB_HOST="https://gitlab.com"
    gitlab-mcp-server

Pull from Docker Hub (example): docker pull codyrao/gitlab-mcp-server:latest docker run -e GITLAB_TOKEN="your-token"
-e GITLAB_HOST="https://gitlab.com"
codyrao/gitlab-mcp-server:latest

Additional notes

Tips and notes:

  • Environment variables govern access to GitLab; ensure GITLAB_TOKEN has appropriate permissions (api, read_api, read_repository, write_repository for MR creation).
  • The server blocks actions on protected branches (e.g., master, main, test, develop, release) and disallows merges, deletes, and certain configuration changes to protect critical data.
  • Transport can be stdio for local clients or sse/streamable for real-time connections; configure GITLAB_MCP_TRANSPORT and GITLAB_MCP_PORT accordingly.
  • If using Docker, ensure the container has network access to your GitLab instance and that GITLAB_HOST is correctly set.
  • When deploying in production, consider mounting a configuration file and securing secrets via environment management practices.

Related MCP Servers

Sponsor this space

Reach thousands of developers