home / mcp / gitlab mcp server
gitlab-mcp-server
Configuration
View docs{
"mcpServers": {
"lucky-dersan-gitlab-mcp-server": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"GITLAB_TOKEN",
"-e",
"GITLAB_URL",
"gitlab-mcp-server:latest"
],
"env": {
"GITLAB_URL": "https://gitlab.com/",
"GITLAB_TOKEN": "token"
}
}
}
}This GitLab MCP Server lets you manage GitLab interactions through the Model Context Protocol (MCP). It runs as a Python-based MCP server built on FastMCP, and you connect it to your MCP client to perform repository actions, issues, merge requests, and more through a standardized client-server interface.
You connect your MCP client to the GitLab MCP Server to perform a range of repository operations and collaboration actions. Start by configuring your MCP client to use the server as an MCP endpoint. The server is designed to run locally or as part of your containerized environment and accepts environment variables for authentication and target GitLab instances. Once connected, you can create repositories, fork or delete them, read and write files, manage issues, create merge requests, and handle branches and tags via the MCP surface.
Prerequisites you need before installation:
Install Docker on your host if it is not already installed.
Build the MCP server image from its Dockerfile.
docker build -t gitlab-mcp-server .Run the MCP server container with the required environment variables. You will provide your GitLab token and the GitLab instance URL when starting the container.
docker run --rm -i -e GITLAB_TOKEN=YOUR_GITLAB_TOKEN \
-e GITLAB_URL=https://gitlab.com/ \
gitlab-mcp-server:latestGetting a GitLab access token is required to authorize actions against your GitLab instance. Create a personal access token with the necessary scopes for API access and repository operations.
Steps to obtain the token: Log in to GitLab, go to Settings -> Access Tokens, create a new token with scopes such as api, read_repository, and write_repository, then copy the generated token (shown only once).
json
{
"mcpServers": {
"gitlab": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"GITLAB_TOKEN",
"-e",
"GITLAB_URL",
"gitlab-mcp-server:latest"
],
"env": {
"GITLAB_TOKEN": "token",
"GITLAB_URL": "https://gitlab.com/"
}
}
}
}
``nCreate a new repository in GitLab for the configured user or group.
Fork an existing GitLab repository into the user's namespace or a target namespace.
Delete a repository from GitLab, removing it from the organization or user space.
Search repositories available to the authenticated user or token scope.
Create a new file or update an existing file in a repository at a specified path.
Push a set of files to a repository, creating commits as needed.
Retrieve the contents of a file from a repository path.
Create a new issue in a GitLab repository.
List or retrieve issues for a repository.
Open a new merge request between branches or forks.
Fetch the diff for a merge request to review changes.
Create new branches in a repository.
Delete specified branches from a repository.
Create new tags in a repository.
Delete specified tags from a repository.