Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

A read-only MCP server for self-hosted GitLab, enabling listing projects, inspecting branches and commits, browsing file trees, and reading file contents.

README.md

gitlab-mcp-server

An MCP (Model Context Protocol) server for a self-hosted GitLab instance, focused on browsing projects and repositories. It exposes read-only tools so an MCP client (Claude desktop, Claude Code, etc.) can list projects, inspect branches and commits, browse the file tree, and read file contents.

Tools

| Tool | Purpose | |------|---------| | gitlab_list_projects | List / search projects, filter by owned or membership | | gitlab_get_project | Detailed info for one project (default branch, clone URLs, etc.) | | gitlab_list_branches | List repository branches with their tip commit | | gitlab_list_commits | List commits, filter by ref / path / date range | | gitlab_get_commit | Full details and line-change stats for one commit | | gitlab_list_repository_tree | Browse files & directories at a path (optionally recursive) | | gitlab_get_file | Read decoded contents of a single file |

All tools are read-only and support pagination (page, per_page) and a response_format of markdown (default) or json.

Requirements

  • Node.js 18+
  • A GitLab Personal Access Token (PAT)

Setup

npm install
npm run build

Create a Personal Access Token

In GitLab: User Settings → Access Tokens. Create a token with these scopes:

  • read_api — required for listing projects, branches and commits
  • read_repository — required for the repository tree and file contents

Keep the token secret. It is read from an environment variable, never stored in code.

Configuration

| Variable | Required | Description | |----------|----------|-------------| | GITLAB_BASE_URL | yes | Base URL of your instance, e.g. https://gitlab.example.com (no /api/v4 suffix needed) | | GITLAB_TOKEN | yes | Your Personal Access Token | | TRANSPORT | no | stdio (default) or http | | PORT | no | Port for http transport (default 3000) |

Running

# stdio (default — for local MCP clients)
GITLAB_BASE_URL=https://gitlab.example.com GITLAB_TOKEN=glpat-xxxx npm start

# HTTP transport (binds to 127.0.0.1)
TRANSPORT=http PORT=3000 GITLAB_BASE_URL=https://gitlab.example.com GITLAB_TOKEN=glpat-xxxx npm start

Connecting to an MCP client

Most desktop clients use a JSON config block. Point it at the built entry point and supply the environment variables:

{
  "mcpServers": {
    "gitlab": {
      "command": "node",
      "args": ["/absolute/path/to/gitlab-mcp-server/dist/index.js"],
      "env": {
        "GITLAB_BASE_URL": "https://gitlab.example.com",
        "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Replace the path with the absolute path to dist/index.js on your machine, and fill in your instance URL and token. Restart the client to pick up the new server.

Project structure

gitlab-mcp-server/
├── package.json
├── tsconfig.json
├── README.md
└── src/
    ├── index.ts            # Entry point, transport selection, env validation
    ├── constants.ts        # Config readers and limits
    ├── types.ts            # GitLab resource interfaces
    ├── schemas/common.ts   # Shared Zod schema fragments
    ├── services/client.ts  # Authenticated API client, pagination, errors
    └── tools/projects.ts   # Tool definitions and registration

Identifying projects

Wherever a project_id is required, you can pass either:

  • the numeric project ID, e.g. 42, or
  • the namespace path, e.g. mygroup/myrepo (the server URL-encodes it for you).

Notes

  • This server only performs read operations. It never creates, edits, or deletes anything in GitLab.
  • Large file or list responses are truncated at 25,000 characters; use pagination or narrower filters to retrieve more.
  • For development with auto-reload: npm run dev.

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Developer Tools servers.