gitlab
gitlab operator mcp server for AI agent
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:
-
Clone the repository: git clone https://github.com/yourusername/gitlab-mcp-server.git cd gitlab-mcp-server
-
Build the server binary: go build -o gitlab-mcp-server ./cmd/server
-
Run locally (examples): ./gitlab-mcp-server -config config.yaml -transport stdio
-
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:
-
Build the Docker image (from repo root): docker build -t gitlab-mcp-server .
-
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
trpc-agent-go
trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.
station
Station is our open-source runtime that lets teams deploy agents on their own infrastructure with full control.
tiger-cli
Tiger CLI is the command-line interface for Tiger Cloud. It includes an MCP server for helping coding agents write production-level Postgres code.
gopls
MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.
kubernetes
A Model Context Protocol (MCP) server for the Kubernetes API.
gcp-cost
💰 An MCP server that enables AI assistants to estimate Google Cloud costs, powered by Cloud Billing Catalog API and built with Genkit for Go