GitLab MCP Server
Enables AI agents to interact with GitLab via a restricted set of 9 tools using OAuth 2.0 authentication, supporting merge requests, comments, pipelines, and labels.
README
GitLab MCP Server (OAuth)
A production-ready MCP (Model Context Protocol) server that lets AI agents
interact with GitLab through a restricted set of 9 tools. Every user
authenticates with their own GitLab account via OAuth 2.0 — no Personal
Access Tokens. The server calls the GitLab REST API directly (no glab CLI).
User → GitLab OAuth Login → MCP Server → GitLab REST API
Features
- Per-user OAuth 2.0 login (PKCE +
state), token auto-refresh, logout. - Server-issued bearer tokens — the client sends one bearer token; the server maps it to that user's GitLab session.
- Secure token storage — GitLab tokens encrypted at rest (AES-256-GCM); session tokens stored only as sha-256 hashes.
- Strict tool allowlist — only the 9 tools below; no raw API proxy, no admin/destructive operations.
- Real GitLab authorization — every action runs as the authenticated user with their own token; project access is checked before each call.
- Audit logging — every tool call recorded in PostgreSQL (secrets stripped).
- Streamable HTTP MCP transport, PostgreSQL + Prisma, Redis session cache.
- Docker Compose one-command deploy. Vitest unit + integration tests.
The 9 tools
create_merge_request, update_merge_request, get_merge_request,
list_merge_requests, add_comment, get_pipeline_status, list_pipelines,
assign_reviewer, set_labels.
Quick start (Docker)
-
Create a GitLab OAuth application (User Settings → Applications, or an instance/group app). See
docs/oauth.mdfor details.- Scopes:
read_user,api - Redirect URI:
http://localhost:3000/auth/callback - Copy the Application ID and Secret.
- Scopes:
-
Configure environment:
cp .env.example .env # edit .env: set GITLAB_CLIENT_ID, GITLAB_CLIENT_SECRET, GITLAB_REDIRECT_URI # and generate an encryption key: openssl rand -hex 32 # paste into ENCRYPTION_KEYFor self-hosted GitLab, also set
GITLAB_BASE_URL. -
Run the stack (Postgres + Redis + app, migrations run automatically):
docker compose up --build -
Log in & get your token: open http://localhost:3000/auth/login in a browser, authorize with GitLab, and copy the bearer token shown.
-
Configure your MCP client to use the Streamable HTTP endpoint:
- URL:
http://localhost:3000/mcp - Header:
Authorization: Bearer <your-token>
Example (clients supporting remote HTTP MCP servers with headers):
{ "mcpServers": { "gitlab": { "type": "http", "url": "http://localhost:3000/mcp", "headers": { "Authorization": "Bearer <your-token>" } } } } - URL:
To disconnect: curl -X POST http://localhost:3000/auth/logout -H "Authorization: Bearer <token>".
Local development (without Docker for the app)
# Start datastores only:
docker compose up -d postgres redis
cp .env.example .env # set GitLab creds + ENCRYPTION_KEY
# point DATABASE_URL/REDIS_URL at localhost (the defaults already do)
npm install
npm run db:generate
npm run db:migrate # creates/apply migrations locally
npm run dev # http://localhost:3000
Tests
npm test
GitLab is always mocked — no live calls and no credentials required.
Documentation
- Setup guide
- OAuth configuration guide
- Deployment guide
- Security review
- Architecture
CLAUDE.md— repo conventions / hard rules for contributors.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.