Custom GitLab MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
npm install
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "GITLAB_PERSONAL_ACCESS_TOKEN=${GITLAB_PERSONAL_ACCESS_TOKEN}" -e "GITLAB_API_URL=${GITLAB_API_URL}" custom-gitlab -- node "<FULL_PATH_TO_CUSTOM_GITLAB>/dist/index.js"

Replace <FULL_PATH_TO_CUSTOM_GITLAB>/dist/index.js with the actual folder you prepared in step 1.

Required:GITLAB_PERSONAL_ACCESS_TOKENGITLAB_API_URL
README.md

A custom implementation of the GitLab MCP server for AI assistants.

Custom GitLab MCP Server

A custom implementation of the GitLab MCP (Model Context Protocol) server for integration with Claude and other MCP-compliant AI assistants.

Overview

This MCP server provides seamless integration with GitLab repositories, allowing AI assistants to:

  • Search GitLab repositories
  • Fetch file contents
  • Create or update files
  • Push multiple files in a single commit
  • Create issues and merge requests
  • Fork repositories
  • Create branches

Fixed Implementation

This custom implementation fixes issues with schema validation that were present in the standard GitLab MCP server implementation, specifically for the search_repositories tool.

Installation

  1. Clone this repository
  2. Install dependencies:
    npm install
    
  3. Configure in your Claude settings file or Claude Desktop config file:
    {
      "mcpServers": {
        "github.com/modelcontextprotocol/servers/tree/main/src/gitlab": {
          "command": "node",
          "args": [
            "/path/to/custom-gitlab-server/index.js"
          ],
          "env": {
            "GITLAB_PERSONAL_ACCESS_TOKEN": "your-gitlab-token",
            "GITLAB_API_URL": "https://your-gitlab-instance/api/v4"
          }
        }
      }
    }
    

Prerequisites

  • Node.js (v14 or higher)
  • GitLab Personal Access Token with appropriate scopes:
    • api for full API access
    • read_api for read-only access
    • read_repository and write_repository for repository operations

Available Tools

Tool Name Description
search_repositories Search for GitLab projects
get_file_contents Get contents of a file or directory
create_or_update_file Create or update a single file
push_files Push multiple files in a single commit
create_repository Create a new GitLab project
create_issue Create a new issue
create_merge_request Create a new merge request
fork_repository Fork a project
create_branch Create a new branch

License

MIT

Tools (9)

search_repositoriesSearch for GitLab projects
get_file_contentsGet contents of a file or directory
create_or_update_fileCreate or update a single file
push_filesPush multiple files in a single commit
create_repositoryCreate a new GitLab project
create_issueCreate a new issue
create_merge_requestCreate a new merge request
fork_repositoryFork a project
create_branchCreate a new branch

Environment Variables

GITLAB_PERSONAL_ACCESS_TOKENrequiredPersonal Access Token with API scopes
GITLAB_API_URLrequiredThe base URL for your GitLab instance API

Configuration

claude_desktop_config.json
{"mcpServers": {"gitlab": {"command": "node", "args": ["/path/to/custom-gitlab-server/index.js"], "env": {"GITLAB_PERSONAL_ACCESS_TOKEN": "your-gitlab-token", "GITLAB_API_URL": "https://your-gitlab-instance/api/v4"}}}}

Try it

Search for all repositories in my GitLab account related to the project 'frontend-refactor'.
Create a new issue in the 'my-app' repository titled 'Fix login bug' with a description of the issue.
Read the contents of the README.md file in the main branch of the 'docs-repo' project.
Create a new branch named 'feature/new-ui' in the 'web-app' repository.
Push the updated index.html and styles.css files to the repository in a single commit.

Frequently Asked Questions

What are the key features of Custom GitLab?

Search GitLab repositories. Fetch and manage file contents. Create and update files with multi-file commit support. Manage GitLab issues and merge requests. Repository lifecycle management including forking and branching.

What can I use Custom GitLab for?

Automating repository documentation updates by having Claude read and write files directly.. Streamlining development workflows by creating issues and merge requests via natural language.. Managing multiple repository branches for feature development without leaving the chat interface.. Quickly searching through large GitLab project lists to find relevant codebases..

How do I install Custom GitLab?

Install Custom GitLab by running: npm install

What MCP clients work with Custom GitLab?

Custom GitLab works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Custom GitLab docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare