@structured-world/gitlab-mcp 6.30.1 → 6.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +63 -1070
  2. package/dist/src/cli/docker/container-runtime.d.ts +4 -0
  3. package/dist/src/cli/docker/container-runtime.js +85 -0
  4. package/dist/src/cli/docker/container-runtime.js.map +1 -0
  5. package/dist/src/cli/docker/docker-utils.d.ts +1 -0
  6. package/dist/src/cli/docker/docker-utils.js +85 -61
  7. package/dist/src/cli/docker/docker-utils.js.map +1 -1
  8. package/dist/src/cli/docker/index.d.ts +1 -0
  9. package/dist/src/cli/docker/index.js +1 -0
  10. package/dist/src/cli/docker/index.js.map +1 -1
  11. package/dist/src/cli/docker/types.d.ts +12 -0
  12. package/dist/src/cli/docker/types.js.map +1 -1
  13. package/dist/src/cli/setup/discovery.d.ts +3 -0
  14. package/dist/src/cli/setup/discovery.js +71 -0
  15. package/dist/src/cli/setup/discovery.js.map +1 -0
  16. package/dist/src/cli/setup/flows/configure-existing.d.ts +2 -0
  17. package/dist/src/cli/setup/flows/configure-existing.js +211 -0
  18. package/dist/src/cli/setup/flows/configure-existing.js.map +1 -0
  19. package/dist/src/cli/setup/flows/local-setup.d.ts +2 -0
  20. package/dist/src/cli/setup/flows/local-setup.js +206 -0
  21. package/dist/src/cli/setup/flows/local-setup.js.map +1 -0
  22. package/dist/src/cli/setup/flows/server-setup.d.ts +2 -0
  23. package/dist/src/cli/setup/flows/server-setup.js +185 -0
  24. package/dist/src/cli/setup/flows/server-setup.js.map +1 -0
  25. package/dist/src/cli/setup/flows/tool-selection.d.ts +3 -0
  26. package/dist/src/cli/setup/flows/tool-selection.js +265 -0
  27. package/dist/src/cli/setup/flows/tool-selection.js.map +1 -0
  28. package/dist/src/cli/setup/index.d.ts +4 -0
  29. package/dist/src/cli/setup/index.js +29 -0
  30. package/dist/src/cli/setup/index.js.map +1 -0
  31. package/dist/src/cli/setup/presets.d.ts +7 -0
  32. package/dist/src/cli/setup/presets.js +248 -0
  33. package/dist/src/cli/setup/presets.js.map +1 -0
  34. package/dist/src/cli/setup/types.d.ts +68 -0
  35. package/dist/src/cli/setup/types.js +3 -0
  36. package/dist/src/cli/setup/types.js.map +1 -0
  37. package/dist/src/cli/setup/wizard.d.ts +4 -0
  38. package/dist/src/cli/setup/wizard.js +128 -0
  39. package/dist/src/cli/setup/wizard.js.map +1 -0
  40. package/dist/src/cli-utils.d.ts +2 -0
  41. package/dist/src/cli-utils.js +12 -0
  42. package/dist/src/cli-utils.js.map +1 -1
  43. package/dist/src/main.js +14 -3
  44. package/dist/src/main.js.map +1 -1
  45. package/dist/src/profiles/builtin/code-reviewer.yaml +41 -0
  46. package/dist/src/profiles/builtin/full-access.yaml +29 -0
  47. package/dist/structured-world-gitlab-mcp-6.31.0.tgz +0 -0
  48. package/dist/tsconfig.build.tsbuildinfo +1 -1
  49. package/package.json +7 -3
  50. package/dist/structured-world-gitlab-mcp-6.30.1.tgz +0 -0
package/README.md CHANGED
@@ -1,40 +1,13 @@
1
1
  # GitLab MCP Server
2
2
 
3
- **Maintained by:** [Dmitry Prudnikov](https://github.com/polaz) | **Original Author:** [zereight](https://github.com/zereight)
3
+ [![npm version](https://img.shields.io/npm/v/@structured-world/gitlab-mcp)](https://www.npmjs.com/package/@structured-world/gitlab-mcp) [![npm downloads](https://img.shields.io/npm/dm/@structured-world/gitlab-mcp)](https://www.npmjs.com/package/@structured-world/gitlab-mcp) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Release](https://github.com/structured-world/gitlab-mcp/workflows/Release/badge.svg)](https://github.com/structured-world/gitlab-mcp/actions) [![Coverage Report](https://img.shields.io/badge/Coverage-Live%20Report-brightgreen?logo=github)](https://structured-world.github.io/gitlab-mcp/coverage/)
4
4
 
5
- ## @structured-world/gitlab-mcp
5
+ A [Model Context Protocol](https://modelcontextprotocol.io) server that connects AI agents to the GitLab API — 47 tools across 17 entity types with CQRS architecture, OAuth 2.1, and multiple transport modes.
6
6
 
7
- A fork of the original [zereight/gitlab-mcp](https://github.com/zereight/gitlab-mcp)
7
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_MCP_Server-007ACC?style=for-the-badge&logo=visualstudiocode&logoColor=white)](vscode:mcp/install?%7B%22name%22%3A%22gitlab-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40structured-world%2Fgitlab-mcp%22%5D%7D)
8
+ [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_MCP_Server-24bfa5?style=for-the-badge&logo=visualstudiocode&logoColor=white)](vscode-insiders:mcp/install?%7B%22name%22%3A%22gitlab-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40structured-world%2Fgitlab-mcp%22%5D%7D)
8
9
 
9
- ![npm version](https://img.shields.io/npm/v/@structured-world/gitlab-mcp) ![npm downloads](https://img.shields.io/npm/dm/@structured-world/gitlab-mcp) ![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg) ![Release](https://github.com/structured-world/gitlab-mcp/workflows/Release/badge.svg) ![Codecov](https://codecov.io/gh/structured-world/gitlab-mcp/branch/main/graph/badge.svg) [![Coverage Report](https://img.shields.io/badge/Coverage-Live%20Report-brightgreen?logo=github)](https://structured-world.github.io/gitlab-mcp/coverage/)
10
-
11
- GitLab MCP(Model Context Protocol) Server. **Includes bug fixes and improvements over the original GitLab MCP server.**
12
-
13
- This fork is actively maintained and enhanced with strict TypeScript standards, Yarn 4 support, and improved development workflows.
14
-
15
- ## Requirements
16
-
17
- - **Node.js**: >=24.0.0 (required for native fetch with Undici dispatcher pattern)
18
- - **GitLab**: Compatible with GitLab.com and self-hosted instances
19
-
20
- ## Usage
21
-
22
- ### Using with Codex, Claude App, Cline, Roo Code, Cursor, Kilo Code
23
-
24
- When using with the Claude App, you need to set up your API key and URLs directly.
25
-
26
- #### Codex
27
-
28
- Add to your `~/.codex/config.toml`:
29
-
30
- ```toml
31
- [mcp_servers.gitlab]
32
- command = "yarn"
33
- args = ["dlx", "-q", "@structured-world/gitlab-mcp@latest", "stdio"]
34
- env = { "GITLAB_TOKEN" = "mytoken", "GITLAB_API_URL" = "https://gitlab.com" }
35
- ```
36
-
37
- #### npx
10
+ ## Quick Start
38
11
 
39
12
  ```json
40
13
  {
@@ -44,1082 +17,102 @@ env = { "GITLAB_TOKEN" = "mytoken", "GITLAB_API_URL" = "https://gitlab.com" }
44
17
  "args": ["-y", "@structured-world/gitlab-mcp"],
45
18
  "env": {
46
19
  "GITLAB_TOKEN": "your_gitlab_token",
47
- "GITLAB_API_URL": "your_gitlab_api_url",
48
- "GITLAB_PROJECT_ID": "your_project_id", // Optional: default project
49
- "GITLAB_ALLOWED_PROJECT_IDS": "", // Optional: comma-separated list of allowed project IDs
50
- "GITLAB_READ_ONLY_MODE": "false",
51
- "GITLAB_API_TIMEOUT_MS": "10000", // API timeout in milliseconds (default: 10000)
52
- "USE_GITLAB_WIKI": "false", // use wiki api?
53
- "USE_MILESTONE": "false", // use milestone api?
54
- "USE_PIPELINE": "false", // use pipeline api?
55
- "USE_VARIABLES": "true", // use variables api?
56
- "USE_WEBHOOKS": "true", // use webhooks api?
57
- "USE_SNIPPETS": "true", // use snippets api?
58
- "USE_INTEGRATIONS": "true", // use integrations api?
59
- "SKIP_TLS_VERIFY": "false" // skip SSL cert verification (dev only)
60
- }
61
- }
62
- }
63
- }
64
- ```
65
-
66
- #### vscode .vscode/mcp.json
67
-
68
- ```json
69
- {
70
- "inputs": [
71
- {
72
- "type": "promptString",
73
- "id": "gitlab-token",
74
- "description": "Gitlab Token to read API",
75
- "password": true
76
- }
77
- ],
78
- "servers": {
79
- "GitLab-MCP": {
80
- "type": "stdio",
81
- "command": "npx",
82
- "args": ["-y", "@structured-world/gitlab-mcp"],
83
- "env": {
84
- "GITLAB_TOKEN": "${input:gitlab-token}",
85
- "GITLAB_API_URL": "your-fancy-gitlab-url",
86
- "GITLAB_READ_ONLY_MODE": "true",
87
- ...
88
- }
89
- }
90
- }
91
- }
92
- ```
93
-
94
- #### Docker
95
-
96
- **Transport Mode Selection:**
97
- - **PORT environment variable present** → Server starts in HTTP mode with both SSE and StreamableHTTP endpoints (`/sse` and `/mcp`)
98
- - **No PORT environment variable** → Server starts in stdio mode for direct MCP communication
99
- - **Explicit `stdio` argument** → Forces stdio mode regardless of PORT
100
-
101
- - stdio mcp.json
102
-
103
- ```json
104
- {
105
- "mcpServers": {
106
- "gitlab": {
107
- "command": "docker",
108
- "args": [
109
- "run",
110
- "-i",
111
- "--rm",
112
- "-e",
113
- "GITLAB_TOKEN",
114
- "-e",
115
- "GITLAB_API_URL",
116
- "-e",
117
- "GITLAB_READ_ONLY_MODE",
118
- "-e",
119
- "USE_GITLAB_WIKI",
120
- "-e",
121
- "USE_MILESTONE",
122
- "-e",
123
- "USE_PIPELINE",
124
- "-e",
125
- "USE_VARIABLES",
126
- "-e",
127
- "USE_WEBHOOKS",
128
- "-e",
129
- "USE_SNIPPETS",
130
- "-e",
131
- "USE_INTEGRATIONS",
132
- "ghcr.io/structured-world/gitlab-mcp:latest"
133
- ],
134
- "env": {
135
- "GITLAB_TOKEN": "your_gitlab_token",
136
- "GITLAB_API_URL": "https://gitlab.com", // Optional, for self-hosted GitLab
137
- "GITLAB_READ_ONLY_MODE": "false",
138
- "USE_GITLAB_WIKI": "true",
139
- "USE_MILESTONE": "true",
140
- "USE_PIPELINE": "true",
141
- "USE_VARIABLES": "true",
142
- "USE_WEBHOOKS": "true",
143
- "USE_SNIPPETS": "true",
144
- "USE_INTEGRATIONS": "true"
145
- }
146
- }
147
- }
148
- }
149
- ```
150
-
151
- - HTTP Server (SSE + StreamableHTTP)
152
-
153
- ```shell
154
- docker run -i --rm \
155
- -e PORT=3002 \
156
- -e GITLAB_TOKEN=your_gitlab_token \
157
- -e GITLAB_API_URL="https://gitlab.com" \
158
- -e GITLAB_READ_ONLY_MODE=true \
159
- -e USE_GITLAB_WIKI=true \
160
- -e USE_MILESTONE=true \
161
- -e USE_PIPELINE=true \
162
- -p 3333:3002 \
163
- ghcr.io/structured-world/gitlab-mcp:latest
164
- ```
165
-
166
- **For modern MCP clients (recommended):**
167
- ```json
168
- {
169
- "mcpServers": {
170
- "gitlab": {
171
- "type": "streamable-http",
172
- "url": "http://localhost:3333/mcp"
173
- }
174
- }
175
- }
176
- ```
177
-
178
- **For legacy SSE clients (backwards compatibility):**
179
- ```json
180
- {
181
- "mcpServers": {
182
- "gitlab": {
183
- "type": "sse",
184
- "url": "http://localhost:3333/sse"
185
- }
186
- }
187
- }
188
- ```
189
-
190
- ## Auto-Discovery
191
-
192
- The `--auto` flag automatically detects GitLab configuration from the current git repository's remote URL.
193
-
194
- ### Usage
195
-
196
- ```bash
197
- # Auto-discover from current directory
198
- gitlab-mcp --auto
199
-
200
- # Auto-discover from specific directory
201
- gitlab-mcp --auto --cwd /path/to/repo
202
-
203
- # Use specific remote (default: origin)
204
- gitlab-mcp --auto --remote upstream
205
-
206
- # Dry-run: see what would be detected without applying
207
- gitlab-mcp --auto --dry-run
208
- ```
209
-
210
- ### Configuration Priority
211
-
212
- When multiple configuration sources are available, they are applied in this order (highest to lowest priority):
213
-
214
- | Priority | Source | What it provides |
215
- |----------|--------|------------------|
216
- | 1 (highest) | `--profile` CLI argument | Selects user profile (host, auth, features) |
217
- | 2 | Project config files (`.gitlab-mcp/`) | Adds restrictions and tool selection |
218
- | 3 (lowest) | Auto-discovered profile | Fallback profile selection from git remote |
219
-
220
- **Important notes:**
221
-
222
- - **`--profile` always wins**: If you specify `--profile work`, it will be used even if auto-discovery detected a different profile. A warning is logged when this happens.
223
- - **Project config adds restrictions**: The `.gitlab-mcp/` directory configuration (preset.yaml, profile.yaml) adds restrictions ON TOP of the selected profile - it doesn't replace it.
224
- - **Auto-discovery sets defaults**: Even when a higher-priority source is used, auto-discovery still sets `GITLAB_DEFAULT_PROJECT` and `GITLAB_DEFAULT_NAMESPACE` from the git remote.
225
-
226
- ### How Auto-Discovery Works
227
-
228
- 1. Parses git remote URL (SSH or HTTPS format)
229
- 2. Extracts GitLab host and project path
230
- 3. Matches host to configured user profiles
231
- 4. Sets default project context for convenience
232
-
233
- **Supported URL formats:**
234
- - SSH: `git@gitlab.company.com:group/project.git`
235
- - SSH with port: `ssh://git@gitlab.company.com:2222/group/project.git`
236
- - HTTPS: `https://gitlab.company.com/group/project.git`
237
- - HTTPS with port: `https://gitlab.company.com:8443/group/project.git`
238
-
239
- ## Transport Modes
240
-
241
- The GitLab MCP Server automatically selects the appropriate transport mode based on your configuration:
242
-
243
- ### Automatic Mode Selection
244
-
245
- | Configuration | Transport Mode | Endpoints Available | Use Case |
246
- |--------------|----------------|-------------------|----------|
247
- | **PORT** env var present | HTTP (Dual) | `/sse` and `/mcp` | Web clients, HTTP-based MCP clients |
248
- | **No PORT** env var | stdio | N/A | Direct MCP communication, CLI usage |
249
- | **`stdio` argument** | stdio | N/A | Force stdio mode (overrides PORT) |
250
-
251
- ### Mode Details
252
-
253
- **HTTP Mode (Dual Transport):**
254
- - Runs Express server on specified PORT
255
- - Provides both SSE (`/sse`) and StreamableHTTP (`/mcp`) endpoints simultaneously
256
- - Perfect for web-based MCP clients and backwards compatibility
257
- - Supports session management and reconnection
258
-
259
- **stdio Mode:**
260
- - Direct stdin/stdout communication
261
- - No HTTP server required
262
- - Optimal for command-line tools and direct MCP protocol usage
263
- - Lower resource usage
264
-
265
- ## TLS/HTTPS Configuration
266
-
267
- GitLab MCP Server supports secure HTTPS connections via:
268
-
269
- | Approach | Best For | HTTP/2 | Auto-Renewal |
270
- |----------|----------|--------|--------------|
271
- | **Direct TLS** | Development, simple deployments | No | Manual |
272
- | **Reverse Proxy** | Production (recommended) | Yes | Yes |
273
-
274
- **Quick Start - Direct TLS:**
275
- ```bash
276
- docker run -d \
277
- -e PORT=3000 \
278
- -e SSL_CERT_PATH=/certs/server.crt \
279
- -e SSL_KEY_PATH=/certs/server.key \
280
- -e GITLAB_TOKEN=your_token \
281
- -v $(pwd)/certs:/certs:ro \
282
- -p 3000:3000 \
283
- ghcr.io/structured-world/gitlab-mcp:latest
284
- ```
285
-
286
- **Quick Start - Reverse Proxy (Caddy):**
287
- ```
288
- gitlab-mcp.example.com {
289
- reverse_proxy gitlab-mcp:3002 {
290
- flush_interval -1
291
- }
292
- }
293
- ```
294
-
295
- For complete setup guides including **nginx**, **Envoy**, **Caddy**, and **Traefik** configurations with HTTP/2 support, see **[SSL.md](SSL.md)**.
296
-
297
- ## OAuth Authentication (Claude Custom Connector)
298
-
299
- GitLab MCP Server supports OAuth 2.1 authentication for use as a **Claude Custom Connector**. This enables secure per-user authentication without sharing GitLab tokens.
300
-
301
- ### When to Use OAuth Mode
302
-
303
- | Scenario | Recommended Mode |
304
- |----------|------------------|
305
- | Personal/local use | Static Token (`GITLAB_TOKEN`) |
306
- | Team access via Claude Web/Desktop | **OAuth Mode** |
307
- | Private LAN GitLab with public MCP server | **OAuth Mode** |
308
- | CI/CD or automated pipelines | Static Token |
309
-
310
- ### Prerequisites
311
-
312
- 1. **GitLab 17.1+** (Device Authorization Grant support)
313
- 2. **HTTPS endpoint** for gitlab-mcp (required for OAuth)
314
- 3. **GitLab OAuth Application** configured
315
-
316
- ### Setup Guide
317
-
318
- #### Step 1: Create GitLab OAuth Application
319
-
320
- 1. In GitLab, navigate to **User Settings > Applications** (or **Admin > Applications** for instance-wide)
321
- 2. Create a new application:
322
- - **Name**: `GitLab MCP Server`
323
- - **Redirect URI**: `https://your-mcp-server.com/oauth/callback` (required for Authorization Code Flow)
324
- - **Confidential**: `No` (PKCE provides security without client secret)
325
- - **Scopes**: Select `api` and `read_user`
326
- 3. Save and copy the **Application ID**
327
-
328
- > **Note**: The redirect URI is used by Claude.ai Custom Connectors (Authorization Code Flow). CLI clients use Device Flow which doesn't require redirect URI.
329
-
330
- #### Step 2: Configure gitlab-mcp Server
331
-
332
- ```bash
333
- # Required for OAuth mode
334
- OAUTH_ENABLED=true
335
- OAUTH_SESSION_SECRET=your-minimum-32-character-secret-key
336
- GITLAB_OAUTH_CLIENT_ID=your-gitlab-application-id
337
- GITLAB_API_URL=https://your-gitlab-instance.com
338
-
339
- # Server configuration
340
- PORT=3000
341
- HOST=0.0.0.0
342
-
343
- # Optional OAuth settings
344
- GITLAB_OAUTH_CLIENT_SECRET=your-secret # Required only if GitLab app is confidential
345
- GITLAB_OAUTH_SCOPES=api,read_user # Default scopes
346
- OAUTH_TOKEN_TTL=3600 # Token lifetime (seconds)
347
- OAUTH_REFRESH_TOKEN_TTL=604800 # Refresh token lifetime (seconds)
348
- OAUTH_DEVICE_POLL_INTERVAL=5 # Device flow poll interval (seconds)
349
- OAUTH_DEVICE_TIMEOUT=300 # Auth timeout (seconds)
350
- ```
351
-
352
- #### Step 3: Deploy with HTTPS
353
-
354
- OAuth requires HTTPS. Example with Docker:
355
-
356
- ```bash
357
- docker run -d \
358
- --name gitlab-mcp \
359
- -e OAUTH_ENABLED=true \
360
- -e OAUTH_SESSION_SECRET="$(openssl rand -base64 32)" \
361
- -e GITLAB_OAUTH_CLIENT_ID=your-app-id \
362
- -e GITLAB_API_URL=https://gitlab.example.com \
363
- -e PORT=3000 \
364
- -p 3000:3000 \
365
- ghcr.io/structured-world/gitlab-mcp:latest
366
- ```
367
-
368
- Use a reverse proxy (nginx, Caddy, Traefik) to add HTTPS.
369
-
370
- ### Claude Web Setup
371
-
372
- 1. Go to [claude.ai](https://claude.ai) and sign in
373
- 2. Navigate to **Settings > Connectors**
374
- 3. Click **Add custom connector**
375
- 4. Enter your gitlab-mcp server URL: `https://your-mcp-server.com`
376
- 5. Click **Add**
377
- 6. When prompted, complete authentication:
378
- - You'll see a device code (e.g., `ABCD-1234`)
379
- - Open your GitLab instance and enter the code
380
- - Approve the authorization request
381
- 7. The connector is now active
382
-
383
- ### Claude Desktop Setup
384
-
385
- #### macOS / Linux
386
-
387
- Edit `~/.config/claude/claude_desktop_config.json`:
388
-
389
- ```json
390
- {
391
- "mcpServers": {
392
- "gitlab": {
393
- "type": "streamable-http",
394
- "url": "https://your-mcp-server.com/mcp"
395
- }
396
- }
397
- }
398
- ```
399
-
400
- #### Windows
401
-
402
- Edit `%APPDATA%\Claude\claude_desktop_config.json`:
403
-
404
- ```json
405
- {
406
- "mcpServers": {
407
- "gitlab": {
408
- "type": "streamable-http",
409
- "url": "https://your-mcp-server.com/mcp"
410
- }
411
- }
412
- }
413
- ```
414
-
415
- After adding the server:
416
- 1. Restart Claude Desktop
417
- 2. Claude will prompt you to authenticate
418
- 3. Complete the device flow authorization in GitLab
419
- 4. Start using GitLab tools with your personal identity
420
-
421
- ### Private LAN GitLab Architecture
422
-
423
- For GitLab instances on private networks (not internet-accessible):
424
-
425
- ```
426
- +-------------------+ +-------------------+ +-------------------+
427
- | Claude Cloud | HTTPS | gitlab-mcp | HTTP | GitLab Server |
428
- | or Desktop |-------->| (Public IP) |-------->| (Private LAN) |
429
- +-------------------+ +-------------------+ +-------------------+
430
- |
431
- | Device code displayed
432
- v
433
- +-------------------+
434
- | User (on VPN) |
435
- | visits GitLab |
436
- | enters code |
437
- +-------------------+
438
- ```
439
-
440
- **How it works:**
441
- 1. gitlab-mcp server has network access to GitLab (same network or VPN)
442
- 2. User connects to gitlab-mcp via Claude (public internet)
443
- 3. gitlab-mcp initiates device authorization with GitLab
444
- 4. User receives a code and visits GitLab directly (requires VPN/internal access)
445
- 5. User authenticates in GitLab and enters the code
446
- 6. gitlab-mcp receives the token and issues an MCP session token
447
- 7. All subsequent requests use the user's GitLab identity
448
-
449
- **Requirements:**
450
- - gitlab-mcp must reach GitLab API (deploy on same network or use VPN)
451
- - Users must be able to access GitLab web UI (typically via VPN)
452
- - gitlab-mcp must be accessible from internet (for Claude to connect)
453
-
454
- ### OAuth vs Static Token Comparison
455
-
456
- | Feature | Static Token | OAuth Mode |
457
- |---------|--------------|------------|
458
- | Setup complexity | Simple | Moderate |
459
- | Per-user identity | No (shared token) | Yes |
460
- | Token management | Manual | Automatic |
461
- | Audit trail | Single identity | Per-user actions |
462
- | Security | Token in config | No tokens in config |
463
- | Best for | Personal use, CI/CD | Teams, shared access |
464
-
465
- ### OAuth Flows
466
-
467
- The server supports two OAuth flows automatically:
468
-
469
- | Flow | Trigger | Used By | How It Works |
470
- |------|---------|---------|--------------|
471
- | **Authorization Code Flow** | `redirect_uri` present | Claude.ai Custom Connectors | Redirects to GitLab OAuth, then back to client |
472
- | **Device Flow** | No `redirect_uri` | CLI clients, Claude Desktop | Shows device code page for manual entry |
473
-
474
- The flow is selected automatically based on the presence of `redirect_uri` in the authorization request.
475
-
476
- ### OAuth Endpoints
477
-
478
- When OAuth is enabled, the following endpoints are available:
479
-
480
- | Endpoint | Method | Description |
481
- |----------|--------|-------------|
482
- | `/.well-known/oauth-authorization-server` | GET | OAuth metadata discovery |
483
- | `/.well-known/oauth-protected-resource` | GET | Protected resource metadata (RFC 9470) |
484
- | `/authorize` | GET | Start authorization (auto-selects flow) |
485
- | `/oauth/callback` | GET | GitLab callback (Auth Code Flow only) |
486
- | `/oauth/poll` | GET | Poll for completion (Device Flow only) |
487
- | `/token` | POST | Exchange code for tokens |
488
- | `/health` | GET | Health check endpoint |
489
-
490
- ### Troubleshooting
491
-
492
- **"OAuth not configured" error**
493
- - Ensure `OAUTH_ENABLED=true` is set
494
- - Verify `OAUTH_SESSION_SECRET` is at least 32 characters
495
- - Check `GITLAB_OAUTH_CLIENT_ID` is correct
496
-
497
- **Device code not accepted**
498
- - Verify GitLab version is 17.1 or later
499
- - Check OAuth application scopes include `api`
500
- - Ensure the application is not set as "Confidential"
501
-
502
- **"Failed to refresh token" error**
503
- - GitLab refresh token may have expired
504
- - Re-authenticate through Claude connector settings
505
-
506
- **Cannot reach GitLab for authentication**
507
- - For private LAN GitLab, connect to VPN first
508
- - Verify you can access GitLab web UI in your browser
509
-
510
- ### Environment Variables
511
-
512
- - `GITLAB_TOKEN`: Your GitLab personal access token.
513
- - `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com`)
514
- - `GITLAB_PROJECT_ID`: Default project ID. If set, Overwrite this value when making an API request.
515
- - `GITLAB_ALLOWED_PROJECT_IDS`: Optional comma-separated list of allowed project IDs. When set with a single value, acts as a default project (like the old "lock" mode). When set with multiple values, restricts access to only those projects. Examples:
516
- - Single value `123`: MCP server can only access project 123 and uses it as default
517
- - Multiple values `123,456,789`: MCP server can access projects 123, 456, and 789 but requires explicit project ID in requests
518
- - `GITLAB_READ_ONLY_MODE`: When set to 'true', restricts the server to only expose read-only operations. Useful for enhanced security or when write access is not needed. Also useful for using with Cursor and it's 40 tool limit.
519
- - `GITLAB_DENIED_TOOLS_REGEX`: When set as a regular expression, it excludes the matching tools.
520
- - `GITLAB_API_TIMEOUT_MS`: API request timeout in milliseconds. (Default: `10000` - 10 seconds). If GitLab API doesn't respond within this time, the request will be aborted. For idempotent operations (GET/HEAD/OPTIONS requests), automatic retry with exponential backoff is attempted before returning a timeout error.
521
- - `GITLAB_API_RETRY_ENABLED`: Enable automatic retry for idempotent operations (GET/HEAD/OPTIONS). (Default: `true`). When enabled, failed requests due to timeouts, network errors, 5xx server errors, or 429 rate limits are automatically retried with exponential backoff. For 429 responses, the Retry-After header is honored when present.
522
- - `GITLAB_API_RETRY_MAX_ATTEMPTS`: Maximum number of retry attempts for failed requests. (Default: `3`). Set to `0` to disable retries.
523
- - `GITLAB_API_RETRY_BASE_DELAY_MS`: Base delay in milliseconds for exponential backoff. (Default: `1000` - 1 second). Actual delays: 1s, 2s, 4s for attempts 1, 2, 3.
524
- - `GITLAB_API_RETRY_MAX_DELAY_MS`: Maximum delay cap for exponential backoff. (Default: `4000` - 4 seconds). Prevents delays from growing too large.
525
- - `USE_GITLAB_WIKI`: When set to 'true', enables the wiki-related tools (list_wiki_pages, get_wiki_page, create_wiki_page, update_wiki_page, delete_wiki_page). Supports both project-level and group-level wikis. By default, wiki features are disabled.
526
- - `USE_MILESTONE`: When set to 'true', enables the milestone-related tools (list_milestones, get_milestone, create_milestone, edit_milestone, delete_milestone, get_milestone_issue, get_milestone_merge_requests, promote_milestone, get_milestone_burndown_events). By default, milestone features are disabled.
527
- - `USE_PIPELINE`: When set to 'true', enables the pipeline-related tools (list_pipelines, get_pipeline, list_pipeline_jobs, list_pipeline_trigger_jobs, get_pipeline_job, get_pipeline_job_output, create_pipeline, retry_pipeline, cancel_pipeline, play_pipeline_job, retry_pipeline_job, cancel_pipeline_job). By default, pipeline features are disabled.
528
- - `USE_LABELS`: When set to 'true', enables the label-related tools (list_labels, get_label, create_label, update_label, delete_label). By default, label features are enabled.
529
- - `USE_MRS`: When set to 'true', enables the merge request-related tools (browse_merge_requests, browse_mr_discussions, manage_merge_request, manage_mr_discussion, manage_draft_notes). These 5 CQRS tools consolidate all MR operations. By default, merge request features are enabled.
530
- - `USE_FILES`: When set to 'true', enables the file-related tools (browse_files, manage_files). These 2 CQRS tools consolidate all file operations. By default, file operation features are enabled.
531
- - `USE_VARIABLES`: When set to 'true', enables the CI/CD variables-related tools (browse_variables, manage_variable). These 2 CQRS tools consolidate all variable operations. Supports both project-level and group-level variables. By default, variables features are enabled.
532
- - `USE_WORKITEMS`: When set to 'true', enables the work items-related tools (browse_work_items, manage_work_item). These 2 CQRS tools consolidate all work item operations using GitLab GraphQL API. By default, work items features are enabled.
533
- - `USE_WEBHOOKS`: When set to 'true', enables the webhooks-related tools (list_webhooks, manage_webhook). These 2 tools provide full CRUD operations plus testing for both project and group webhooks. Group webhooks require GitLab Premium tier. By default, webhooks features are enabled.
534
- - `USE_SNIPPETS`: When set to 'true', enables the snippets-related tools (list_snippets, manage_snippet). These 2 CQRS tools provide full listing and CRUD operations for both personal and project snippets. Supports multi-file snippets, visibility control, and flexible scoping. By default, snippets features are enabled.
535
- - `USE_INTEGRATIONS`: When set to 'true', enables the integrations-related tools (list_integrations, manage_integration). These 2 CQRS tools provide full listing and management of 50+ project integrations (Slack, Jira, Discord, Jenkins, etc.). By default, integrations features are enabled.
536
- - `GITLAB_AUTH_COOKIE_PATH`: Path to an authentication cookie file for GitLab instances that require cookie-based authentication. When provided, the cookie will be included in all GitLab API requests.
537
- - `SKIP_TLS_VERIFY`: When set to 'true', skips TLS certificate verification for all GitLab API requests (both REST and GraphQL). **WARNING**: This bypasses SSL certificate validation and should only be used for testing with self-signed certificates or trusted internal GitLab instances. Never use this in production environments.
538
- - `SSL_CERT_PATH`: Path to PEM certificate file for direct HTTPS/TLS termination. Requires `SSL_KEY_PATH` to also be set.
539
- - `SSL_KEY_PATH`: Path to PEM private key file for direct HTTPS/TLS termination. Requires `SSL_CERT_PATH` to also be set.
540
- - `SSL_CA_PATH`: Optional path to CA certificate chain for client certificate validation.
541
- - `SSL_PASSPHRASE`: Optional passphrase for encrypted private keys.
542
- - `TRUST_PROXY`: Enable Express trust proxy for reverse proxy deployments. Values: `true`, `false`, `loopback`, `linklocal`, `uniquelocal`, hop count, or specific IP addresses.
543
-
544
- ### Dynamic Tool Description Customization
545
-
546
- You can customize tool descriptions at runtime using environment variables following the pattern `GITLAB_TOOL_{TOOL_NAME}`. This feature is specifically designed to optimize agentic usage by:
547
-
548
- - **Improving AI agent tool selection** - Customize descriptions to match your specific workflows and use cases
549
- - **Enhancing semantic clarity** - Provide context-specific descriptions that help AI agents understand when to use each tool
550
- - **Reducing ambiguity** - Replace generic descriptions with precise, workflow-oriented explanations
551
- - **Optimizing for your domain** - Use terminology and concepts familiar to your AI agents and team
552
-
553
- #### Format
554
- ```bash
555
- GITLAB_TOOL_{TOOL_NAME}="Your custom description"
556
- ```
557
-
558
- Where `{TOOL_NAME}` is the uppercase version of the tool name with underscores preserved.
559
-
560
- #### Examples
561
- ```bash
562
- # Customize the list_projects tool description
563
- export GITLAB_TOOL_LIST_PROJECTS="Show all available GitLab projects in our organization"
564
-
565
- # Customize the create_merge_request tool description
566
- export GITLAB_TOOL_CREATE_MERGE_REQUEST="Create a new MR following our team's review process"
567
-
568
- # Customize the get_file_contents tool description
569
- export GITLAB_TOOL_GET_FILE_CONTENTS="Read source code files from the repository"
570
-
571
- # Multiple customizations
572
- export GITLAB_TOOL_LIST_PROJECTS="List user projects"
573
- export GITLAB_TOOL_GET_PROJECT="Get project details including settings"
574
- export GITLAB_TOOL_MANAGE_WORK_ITEM="Create and manage tickets for our sprint planning"
575
- ```
576
-
577
- #### Usage in Configuration Files
578
- ```json
579
- {
580
- "mcpServers": {
581
- "gitlab": {
582
- "command": "npx",
583
- "args": ["-y", "@structured-world/gitlab-mcp"],
584
- "env": {
585
- "GITLAB_TOKEN": "your_token",
586
- "GITLAB_API_URL": "https://gitlab.com",
587
-
588
- "GITLAB_TOOL_LIST_PROJECTS": "Show our team's GitLab projects",
589
- "GITLAB_TOOL_CREATE_MERGE_REQUEST": "Create MR with our review standards",
590
- "GITLAB_TOOL_GET_FILE_CONTENTS": "Read code from repo"
591
- }
592
- }
593
- }
594
- }
595
- ```
596
-
597
- #### Important Notes
598
-
599
- - **Description Override Only**: Only the tool description is overridden - the tool name and functionality remain unchanged
600
- - **Schema Preservation**: Schema field descriptions are NOT affected - they remain hardcoded for consistency
601
- - **Case Sensitivity**: Tool names in environment variables must be UPPERCASE (e.g., `LIST_PROJECTS` not `list_projects`)
602
- - **Invalid Names**: Invalid tool names in environment variables are ignored with a warning in debug logs
603
- - **Content Guidelines**: Descriptions can be any valid string but should be kept concise for better UX
604
- - **Scope**: Works with all 59 available tools across all entities (Core, Work Items, Merge Requests, Files, Snippets, etc.)
605
-
606
- ### Fine-Grained Action Filtering (CQRS Tools)
607
-
608
- For CQRS tools (those with `action` parameter like `manage_milestone`, `browse_merge_requests`), you can disable specific actions while keeping others available. This provides granular control and **reduces AI context token usage** by removing disabled actions and their exclusive parameters from the schema.
609
-
610
- #### Environment Variable
611
-
612
- ```bash
613
- GITLAB_DENIED_ACTIONS="tool_name:action,tool_name:action,..."
614
- ```
615
-
616
- #### Examples
617
-
618
- ```bash
619
- # Disable delete and promote actions for milestones
620
- export GITLAB_DENIED_ACTIONS="manage_milestone:delete,manage_milestone:promote"
621
-
622
- # Disable multiple actions across different tools
623
- export GITLAB_DENIED_ACTIONS="manage_milestone:delete,browse_milestones:burndown,manage_merge_request:merge"
624
-
625
- # Disable all write actions for a tool (read-only for specific tool)
626
- export GITLAB_DENIED_ACTIONS="manage_variable:create,manage_variable:update,manage_variable:delete"
627
- ```
628
-
629
- #### How It Works
630
-
631
- 1. **Schema Filtering**: Denied actions are removed from the tool's JSON schema
632
- 2. **Parameter Optimization**: Parameters exclusive to denied actions are automatically removed
633
- 3. **Runtime Validation**: Attempts to call denied actions are rejected with clear error messages
634
- 4. **Token Savings**: Smaller schemas = fewer tokens consumed by AI agents
635
-
636
- #### Token Savings Example
637
-
638
- When only `create` action is allowed for `manage_milestone`:
639
-
640
- | State | Properties in Schema | Token Impact |
641
- |-------|---------------------|--------------|
642
- | All actions | `action`, `namespace`, `milestone_id`, `title`, `description`, `due_date`, `start_date`, `state_event` | 100% |
643
- | Only `create` | `action`, `namespace`, `title`, `description`, `due_date`, `start_date` | ~60% (milestone_id, state_event removed) |
644
-
645
- #### Usage in Configuration
646
-
647
- ```json
648
- {
649
- "mcpServers": {
650
- "gitlab": {
651
- "command": "npx",
652
- "args": ["-y", "@structured-world/gitlab-mcp"],
653
- "env": {
654
- "GITLAB_TOKEN": "your_token",
655
- "GITLAB_API_URL": "https://gitlab.com",
656
- "GITLAB_DENIED_ACTIONS": "manage_milestone:delete,manage_milestone:promote"
20
+ "GITLAB_API_URL": "https://gitlab.com"
657
21
  }
658
22
  }
659
23
  }
660
24
  }
661
25
  ```
662
26
 
663
- ### Action & Parameter Description Customization
664
-
665
- Beyond tool-level descriptions, you can customize descriptions for specific actions and parameters within CQRS tools.
666
-
667
- #### Action Descriptions
668
-
669
- Override the description for a specific action within a tool:
670
-
671
- ```bash
672
- # Format: GITLAB_ACTION_{TOOL}_{ACTION}="description"
673
- export GITLAB_ACTION_MANAGE_MILESTONE_DELETE="Permanently remove milestone (requires admin)"
674
- export GITLAB_ACTION_BROWSE_MERGE_REQUESTS_LIST="Show team's active merge requests"
675
- ```
676
-
677
- #### Parameter Descriptions
678
-
679
- Override the description for a specific parameter within a tool:
680
-
681
- ```bash
682
- # Format: GITLAB_PARAM_{TOOL}_{PARAM}="description"
683
- export GITLAB_PARAM_MANAGE_MILESTONE_NAMESPACE="Project or group path (e.g., 'myteam/myproject')"
684
- export GITLAB_PARAM_BROWSE_WORK_ITEMS_TYPES="Filter by type: ISSUE, EPIC, TASK, etc."
685
- ```
686
-
687
- #### Combined Example
688
-
689
- ```json
690
- {
691
- "mcpServers": {
692
- "gitlab": {
693
- "command": "npx",
694
- "args": ["-y", "@structured-world/gitlab-mcp"],
695
- "env": {
696
- "GITLAB_TOKEN": "your_token",
697
-
698
- "GITLAB_DENIED_ACTIONS": "manage_milestone:delete",
699
-
700
- "GITLAB_TOOL_MANAGE_MILESTONE": "Manage sprint milestones for our team",
701
- "GITLAB_ACTION_MANAGE_MILESTONE_CREATE": "Create new sprint milestone",
702
- "GITLAB_PARAM_MANAGE_MILESTONE_TITLE": "Sprint name (e.g., 'Sprint 42')"
703
- }
704
- }
705
- }
706
- }
707
- ```
708
-
709
- ### Schema Mode Configuration
710
-
711
- Configure how CQRS tool schemas are delivered to AI clients:
712
-
713
- ```bash
714
- # Configure schema output format
715
- GITLAB_SCHEMA_MODE=flat|discriminated
716
- ```
717
-
718
- | Mode | Description | Best For |
719
- |------|-------------|----------|
720
- | `flat` (default) | Merged properties with action enum | Current AI clients (Claude, GPT) |
721
- | `discriminated` | Full `oneOf` with action-specific branches | Advanced AI clients with native oneOf support |
722
-
723
- #### Schema Pipeline
724
-
725
- When a tool is registered, the schema goes through a transformation pipeline:
726
-
727
- 1. **Filter Denied Actions** - Removes branches for actions listed in `GITLAB_DENIED_ACTIONS`
728
- 2. **Apply Description Overrides** - Applies `GITLAB_ACTION_*` and `GITLAB_PARAM_*` overrides
729
- 3. **Conditional Flatten** - Converts `oneOf` to flat schema when `GITLAB_SCHEMA_MODE=flat` (default)
730
-
731
- This pipeline ensures that:
732
- - Denied actions never appear in the schema (saves AI context tokens)
733
- - Description customizations work regardless of schema format
734
- - Future AI clients can receive native discriminated union schemas
735
-
736
- #### Future Enhancements
737
-
738
- Per-client capability detection may be added, allowing the server to automatically deliver the optimal schema format based on client capabilities announced during MCP handshake.
27
+ **Requirements:** Node.js >= 24.0.0
739
28
 
740
- ## Tools 🛠️
29
+ ## Highlights
741
30
 
742
- **62 Tools Available** - Organized by entity and functionality below.
31
+ - **47 tools** across 17 entity types — projects, merge requests, pipelines, work items, wiki, and more
32
+ - **CQRS architecture** — `browse_*` for queries, `manage_*` for commands
33
+ - **Multiple transports** — stdio, SSE, StreamableHTTP
34
+ - **OAuth 2.1** — Per-user authentication via Claude Custom Connector
35
+ - **Read-only mode** — Safe operation for production environments
36
+ - **Auto-discovery** — Detects GitLab config from git remotes
37
+ - **Fine-grained control** — Enable/disable tool groups, filter actions, customize descriptions
38
+ - **Docker support** — `ghcr.io/structured-world/gitlab-mcp:latest`
743
39
 
744
- ### Key Features:
745
- - **CQRS Pattern** - Consolidated action-based tools: `browse_*` for reads, `manage_*` for writes
746
- - **Modular Entity Architecture** - Separate entities for Labels, Merge Requests, Files, Pipelines, etc.
747
- - **Environment-Gated Features** - Enable/disable tool groups with USE_* environment variables
748
- - **Work Items Management** - Modern GraphQL API for Issues, Epics, Tasks, and more
749
- - **Complete GitLab API Coverage** - Repository, Merge Requests, Pipelines, Wiki, and more
750
- - **Tier-based Feature Detection** - Automatically enables features based on your GitLab tier
751
- - **Read-only Mode Support** - Safe operation mode for production environments
40
+ ## Documentation
752
41
 
753
- ## Complete Tool Reference
42
+ Full documentation is available at **[docs.gitlab-mcp.sw.foundation](https://docs.gitlab-mcp.sw.foundation)**
754
43
 
755
- ### Legend
756
- - 📖 = Read-only tool (available in GITLAB_READ_ONLY_MODE)
757
- - ✏️ = Read/Write tool (disabled in GITLAB_READ_ONLY_MODE)
44
+ | Section | Description |
45
+ |---------|-------------|
46
+ | [Installation](https://docs.gitlab-mcp.sw.foundation/guide/installation/npm) | npm, Docker, VS Code, Codex |
47
+ | [Configuration](https://docs.gitlab-mcp.sw.foundation/guide/configuration) | Environment variables, feature flags |
48
+ | [Tool Reference](https://docs.gitlab-mcp.sw.foundation/tools/) | All 47 tools with parameters |
49
+ | [OAuth Setup](https://docs.gitlab-mcp.sw.foundation/security/oauth) | Team authentication with Claude |
50
+ | [TLS/HTTPS](https://docs.gitlab-mcp.sw.foundation/advanced/tls) | Production deployment with SSL |
51
+ | [Customization](https://docs.gitlab-mcp.sw.foundation/advanced/customization) | Tool descriptions, action filtering |
52
+ | [CLI Tools](https://docs.gitlab-mcp.sw.foundation/cli/list-tools) | Browse and export tool documentation |
758
53
 
759
- ### Core Tools (14 tools)
760
- Core GitLab functionality always available. Uses CQRS pattern with consolidated action-based tools.
54
+ ### Auto-generated Tool Reference
761
55
 
762
- #### Repository & Project Management
763
- - 📖 **`browse_projects`**: PROJECT DISCOVERY: Find, browse, or inspect GitLab projects. Actions: "search" finds projects by name/topic, "list" browses accessible projects, "get" retrieves full details.
764
- - ✏️ **`manage_repository`**: REPOSITORY MANAGEMENT: Create or fork GitLab projects. Actions: "create" starts new project, "fork" creates your copy of existing project.
765
- - 📖 **`list_project_members`**: List members of a GitLab project with access levels.
766
-
767
- #### Namespaces & Groups
768
- - 📖 **`browse_namespaces`**: NAMESPACE OPERATIONS: Explore groups and user namespaces. Actions: "list" discovers namespaces, "get" retrieves details, "verify" checks if path exists.
769
- - ✏️ **`create_group`**: Create a new GitLab group/namespace. Can create subgroups with parent_id.
770
-
771
- #### Commits & History
772
- - 📖 **`browse_commits`**: COMMIT HISTORY: Explore repository commit history. Actions: "list" browses commits with filters, "get" retrieves commit metadata, "diff" shows code changes.
773
- - ✏️ **`create_branch`**: Create a new branch in a GitLab project from existing ref.
774
-
775
- #### Events & Activity
776
- - 📖 **`browse_events`**: ACTIVITY FEED: Track GitLab activity. Actions: "user" shows your activity, "project" monitors project activity. Filter by date/action type.
777
- - 📖 **`list_group_iterations`**: List group iterations/sprints for agile planning. Requires GitLab Premium.
778
-
779
- #### Users & Utilities
780
- - 📖 **`get_users`**: Search GitLab users with smart pattern detection. Auto-detects emails, usernames, or names.
781
- - 📖 **`download_attachment`**: Download file attachments from issues/MRs by secret and filename.
782
-
783
- #### Todos (Task Queue)
784
- - 📖 **`list_todos`**: View your GitLab todos (notifications requiring action). Filter by state, action type, or target type.
785
- - ✏️ **`manage_todos`**: Manage todo items. Actions: "mark_done" completes single todo, "mark_all_done" clears queue, "restore" undoes completed todo.
786
-
787
- #### Context Management
788
- - 📖 **`manage_context`**: CONTEXT: Manage runtime session context. Actions: "show" returns current context (host, preset, scope, mode); "list_presets" lists available presets; "list_profiles" lists OAuth profiles (OAuth mode only); "switch_preset" changes active preset; "switch_profile" changes OAuth profile (OAuth mode only); "set_scope" restricts operations to a namespace with auto-detection (group vs project); "reset" restores initial context.
789
-
790
- ### Labels Management (5 tools)
791
- Requires USE_LABELS=true environment variable (enabled by default). Supports both project and group labels.
792
-
793
- - ✏️ **`create_label`**: Create a new label in a project or group
794
- - ✏️ **`update_label`**: Update an existing label in a project or group
795
- - ✏️ **`delete_label`**: Delete a label from a project or group
796
- - 📖 **`get_label`**: Get a single label from a project or group
797
- - 📖 **`list_labels`**: List labels for a project or group
798
-
799
- ### Merge Requests Management (5 CQRS tools)
800
- Requires USE_MRS=true environment variable (enabled by default). Uses CQRS pattern with action-based tools.
801
-
802
- #### Merge Request Browsing (Query)
803
- - 📖 **`browse_merge_requests`**: BROWSE merge requests. Actions: "list" shows MRs with filtering, "get" retrieves single MR by IID or branch, "diffs" shows file changes, "compare" diffs two branches/commits.
804
- - 📖 **`browse_mr_discussions`**: BROWSE MR discussions and draft notes. Actions: "list" shows all discussion threads, "drafts" lists unpublished draft notes, "draft" gets single draft note.
805
-
806
- #### Merge Request Management (Command)
807
- - ✏️ **`manage_merge_request`**: MANAGE merge requests. Actions: "create" creates new MR, "update" modifies existing MR, "merge" merges approved MR into target branch.
808
- - ✏️ **`manage_mr_discussion`**: MANAGE MR discussions. Actions: "comment" adds comment to issue/MR, "thread" starts new discussion, "reply" responds to existing thread, "update" modifies note.
809
- - ✏️ **`manage_draft_notes`**: MANAGE draft notes. Actions: "create" creates draft note, "update" modifies draft, "publish" publishes single draft, "publish_all" publishes all drafts, "delete" removes draft.
810
-
811
- ### File Operations (2 CQRS tools)
812
- Requires USE_FILES=true environment variable (enabled by default). Uses CQRS pattern with action-based tools.
813
-
814
- - 📖 **`browse_files`**: BROWSE repository files. Actions: "tree" lists files/folders with pagination, "content" reads file contents. Use for exploring project structure or reading source code.
815
- - ✏️ **`manage_files`**: MANAGE repository files. Actions: "single" creates/updates one file, "batch" commits multiple files atomically, "upload" adds markdown attachments.
816
-
817
- ### CI/CD Variables (2 CQRS tools)
818
- Requires USE_VARIABLES=true environment variable (enabled by default). Uses CQRS pattern with action-based tools. Supports both project-level and group-level variables.
819
-
820
- #### Variable Browsing (Query)
821
- - 📖 **`browse_variables`**: BROWSE CI/CD variables. Actions: "list" shows all variables in project/group with pagination, "get" retrieves single variable details by key with optional environment scope filter.
822
-
823
- #### Variable Management (Command)
824
- - ✏️ **`manage_variable`**: MANAGE CI/CD variables. Actions: "create" adds new variable (requires key and value), "update" modifies existing variable, "delete" removes variable permanently. Supports environment scoping and protection settings.
825
-
826
- ### Work Items (2 CQRS tools)
827
- Modern GraphQL API for issues, epics, tasks, and more. Requires USE_WORKITEMS=true (enabled by default). Uses CQRS pattern with action-based tools.
828
-
829
- #### Work Item Browsing (Query)
830
- - 📖 **`browse_work_items`**: BROWSE work items. Actions: "list" shows work items with filtering (groups return epics, projects return issues/tasks), "get" retrieves single work item by ID with full widget details.
831
-
832
- #### Work Item Management (Command)
833
- - ✏️ **`manage_work_item`**: MANAGE work items. Actions: "create" creates new work item (Epics need GROUP namespace, Issues/Tasks need PROJECT), "update" modifies properties/widgets, "delete" permanently removes.
834
-
835
- ### Wiki Management (5 tools)
836
- Requires USE_GITLAB_WIKI=true environment variable. Supports both project-level and group-level wikis.
837
-
838
- - ✏️ **`create_wiki_page`**: Create a new wiki page in a GitLab project or group
839
- - ✏️ **`update_wiki_page`**: Update an existing wiki page in a GitLab project or group
840
- - ✏️ **`delete_wiki_page`**: Delete a wiki page from a GitLab project or group
841
- - 📖 **`get_wiki_page`**: Get details of a specific wiki page from a project or group
842
- - 📖 **`list_wiki_pages`**: List wiki pages in a GitLab project or group
843
-
844
- ### Milestones (9 tools)
845
- Requires USE_MILESTONE=true environment variable. Supports both project and group milestones.
846
-
847
- - ✏️ **`create_milestone`**: Create a new milestone in a GitLab project or group
848
- - ✏️ **`edit_milestone`**: Edit an existing milestone in a GitLab project or group
849
- - ✏️ **`delete_milestone`**: Delete a milestone from a GitLab project or group
850
- - ✏️ **`promote_milestone`**: Promote a project milestone to a group milestone
851
- - 📖 **`get_milestone`**: Get details of a specific project or group milestone
852
- - 📖 **`get_milestone_issue`**: Get issues associated with a specific project or group milestone
853
- - 📖 **`get_milestone_merge_requests`**: Get merge requests associated with a specific project or group milestone
854
- - 📖 **`get_milestone_burndown_events`**: Get burndown events for a specific project or group milestone
855
- - 📖 **`list_milestones`**: List milestones in a GitLab project or group with filtering options
856
-
857
- ### Pipelines & CI/CD (12 tools)
858
- Requires USE_PIPELINE=true environment variable.
859
-
860
- - ✏️ **`create_pipeline`**: Create a new pipeline for a branch or tag
861
- - ✏️ **`retry_pipeline`**: Retry a failed or canceled pipeline
862
- - ✏️ **`cancel_pipeline`**: Cancel a running pipeline
863
- - ✏️ **`play_pipeline_job`**: Run a manual pipeline job
864
- - ✏️ **`retry_pipeline_job`**: Retry a failed or canceled pipeline job
865
- - ✏️ **`cancel_pipeline_job`**: Cancel a running pipeline job
866
- - 📖 **`get_pipeline`**: Get details of a specific pipeline in a GitLab project
867
- - 📖 **`get_pipeline_job`**: Get details of a GitLab pipeline job number
868
- - 📖 **`get_pipeline_job_output`**: Get the output/trace of a GitLab pipeline job with optional pagination to limit context window usage
869
- - 📖 **`list_pipelines`**: List pipelines in a GitLab project with filtering options
870
- - 📖 **`list_pipeline_jobs`**: List all jobs in a specific pipeline
871
- - 📖 **`list_pipeline_trigger_jobs`**: List all trigger jobs (bridges) in a specific pipeline that trigger downstream pipelines
872
-
873
- ### Webhooks Management (2 tools)
874
- Requires USE_WEBHOOKS=true environment variable (enabled by default). Supports both project and group webhooks. Group webhooks require GitLab Premium tier.
875
-
876
- - 📖 **`list_webhooks`**: List all webhooks configured for a project or group. Shows webhook URLs, enabled event types, SSL settings, and delivery status. Group webhooks (Premium tier) are inherited by all child projects.
877
- - ✏️ **`manage_webhook`**: Manage webhooks with full CRUD operations plus testing. Actions: "create" (add new webhook with URL and event types), "read" (get webhook details), "update" (modify URL, events, or settings), "delete" (remove webhook), "test" (trigger test delivery for specific event type). Test action sends actual HTTP request to configured URL. In read-only mode, only "read" action is allowed.
878
-
879
- #### Supported Event Types
880
- Webhooks can be configured to trigger on:
881
- - **Push events** - Push to repository (with optional branch filter)
882
- - **Tag push events** - New tag pushed
883
- - **Merge request events** - MR created, updated, merged
884
- - **Issue events** - Issue created, updated, closed (including confidential)
885
- - **Note events** - Comments on issues, MRs, snippets (including confidential)
886
- - **Pipeline events** - Pipeline status changes
887
- - **Job events** - Build/job status changes
888
- - **Wiki page events** - Wiki page created or updated
889
- - **Deployment events** - Deployment triggered
890
- - **Release events** - Release created
891
- - **Milestone events** - Milestone created, updated, closed
892
- - **Emoji events** - Emoji reactions added
893
- - **Feature flag events** - Feature flag changes
894
- - **Resource access token events** - Token created/revoked
895
- - **Member events** - Member added/removed
896
- - **Subgroup events** - Subgroup created/removed (group webhooks only)
897
- - **Project events** - Project created/removed (group webhooks only)
898
-
899
- ### Snippets Management (2 tools)
900
- Requires USE_SNIPPETS=true environment variable (enabled by default). Uses CQRS pattern with action-based tools. Supports personal, project, and public snippets with multi-file support.
901
-
902
- #### Snippet Browsing (Query)
903
- - 📖 **`list_snippets`**: LIST GitLab code snippets with flexible scoping. Use scope='personal' for current user's snippets, scope='project' for project-specific snippets (requires projectId), or scope='public' to discover all public snippets. Filter by visibility level (private/internal/public) and creation date. Supports pagination.
904
-
905
- #### Snippet Management (Command)
906
- - ✏️ **`manage_snippet`**: MANAGE GitLab snippets with full CRUD operations via action parameter. Actions: "read" retrieves snippet metadata or raw content, "create" creates new snippet with multiple files and visibility control, "update" modifies title/description/visibility/files (supports file create/update/delete/move actions), "delete" permanently removes snippet. Supports both personal and project snippets.
907
-
908
- #### Multi-file Snippet Support
909
- Snippets can contain multiple files with individual operations:
910
- - **Create action** - Files array with `file_path` and `content` for each file
911
- - **Update action** - Files array with `action` field: "create" (add new), "update" (modify existing), "delete" (remove), "move" (rename with `previous_path`)
912
-
913
- ### Integrations Management (2 tools)
914
- Requires USE_INTEGRATIONS=true environment variable (enabled by default). Uses CQRS pattern with action-based tools. Supports 50+ project integrations for connecting with external services.
915
-
916
- #### Integration Browsing (Query)
917
- - 📖 **`list_integrations`**: LIST all active integrations for a project. Returns configured integrations like Slack, Jira, Discord, Microsoft Teams, Jenkins, etc. Only shows enabled/configured integrations with their settings.
918
-
919
- #### Integration Management (Command)
920
- - ✏️ **`manage_integration`**: MANAGE project integrations. Actions: "get" retrieves integration settings (read-only), "update" modifies or enables integration with specific config, "disable" removes integration. Supports 50+ integration types. Note: gitlab-slack-application cannot be created via API - requires OAuth install from GitLab UI.
921
-
922
- #### Supported Integration Types
923
- GitLab supports 50+ integrations organized by category:
924
- - **Communication** - Slack, Discord, Microsoft Teams, Mattermost, Telegram, Matrix, Pumble, and more
925
- - **Issue Trackers** - Jira, Bugzilla, Redmine, YouTrack, ClickUp, Linear, Phorge, Asana
926
- - **CI/CD** - Jenkins, TeamCity, Bamboo, Buildkite, Drone CI, Datadog
927
- - **Documentation** - Confluence, External Wiki
928
- - **Mobile/Publishing** - Apple App Store, Google Play, Packagist
929
- - **Cloud** - Google Cloud Platform (Artifact Registry, Workload Identity), Harbor
930
- - **Security** - GitGuardian
931
- - **Other** - GitHub, Emails on Push, Pipelines Email, Pushover
932
-
933
- #### Common Event Triggers
934
- Most integrations support configuring which events trigger notifications:
935
- - Push events, Tag push events, Issue events, Merge request events
936
- - Note events, Pipeline events, Job events, Wiki page events
937
- - Deployment events, Release events, Vulnerability events
938
-
939
- ## CLI Tools 🔧
940
-
941
- ### list-tools - Browse Available Tools
942
-
943
- The `list-tools` CLI utility helps you explore all available GitLab MCP tools, their descriptions, parameters, and tier requirements.
944
-
945
- #### Installation
946
-
947
- ```bash
948
- # Install dependencies
949
- yarn install
950
-
951
- # Build the project
952
- yarn build
953
- ```
954
-
955
- #### Usage
56
+ For the complete tool reference with parameters:
956
57
 
957
58
  ```bash
958
- # List all tools with descriptions and tier badges
959
- yarn list-tools
960
-
961
- # Show all tools with full parameter details
59
+ # View locally
962
60
  yarn list-tools --detail
963
61
 
964
- # List tools in simple format (names only)
965
- yarn list-tools --simple
966
-
967
- # Show tools for a specific entity
968
- yarn list-tools --entity workitems
969
- yarn list-tools --entity "merge requests"
970
-
971
- # Get detailed info for a specific tool
972
- yarn list-tools --tool create_work_item
973
-
974
- # Export as JSON for programmatic use
975
- yarn list-tools --json
976
-
977
- # Show environment configuration
978
- yarn list-tools --env
979
-
980
- # Test with different configurations
981
- GITLAB_READONLY=true yarn list-tools # Show only read-only tools
982
- USE_WORKITEMS=false yarn list-tools # Hide work items tools
983
- ```
984
-
985
- #### Generate TOOLS.md Documentation
986
-
987
- ```bash
988
- # Generate complete markdown documentation
989
- yarn list-tools --export > docs/TOOLS.md
990
-
991
- # Include table of contents
62
+ # Generate documentation
992
63
  yarn list-tools --export --toc > docs/TOOLS.md
993
-
994
- # Generate without example JSON blocks (more compact)
995
- yarn list-tools --export --no-examples > docs/TOOLS.md
996
64
  ```
997
65
 
998
- The `--export` mode generates comprehensive documentation with:
999
- - **Actions table** - Available actions extracted from CQRS schemas
1000
- - **Parameters table** - All parameters with types, required status, and action hints
1001
- - **Example JSON** - Sample request for each tool
1002
- - **Tier badges** - GitLab tier requirements
1003
- - **Version info** - Package version and generation timestamp
1004
-
1005
- #### Features
1006
-
1007
- - **Tier Badges** - Visual indicators for GitLab tier requirements:
1008
- - 🟢 Free - Available in all GitLab tiers
1009
- - 🟡 Premium - Requires GitLab Premium or higher
1010
- - 🔴 Ultimate - Requires GitLab Ultimate
1011
-
1012
- - **Parameter Documentation** - Shows all input parameters with:
1013
- - Parameter name and type
1014
- - Required/optional status
1015
- - Detailed descriptions
1016
-
1017
- - **Environment Filtering** - Respects environment variables:
1018
- - `GITLAB_READONLY` - Show only read-only tools
1019
- - `USE_*` flags - Enable/disable tool categories
1020
- - `GITLAB_DENIED_TOOLS_REGEX` - Filter tools by regex pattern
1021
-
1022
- - **Multiple Output Formats**:
1023
- - Markdown (default) - Human-readable with formatting
1024
- - JSON - Machine-readable for automation
1025
- - Simple - Just tool names for scripting
66
+ See [docs/TOOLS.md](docs/TOOLS.md) for the auto-generated reference.
1026
67
 
1027
- #### Examples
68
+ ## Docker
1028
69
 
1029
70
  ```bash
1030
- # Find all tools related to merge requests
1031
- yarn list-tools --entity mrs
1032
-
1033
- # Check what parameters are needed for creating a work item
1034
- yarn list-tools --tool create_work_item
1035
-
1036
- # List all available tools with their input schemas (for MCP agents)
1037
- yarn list-tools --detail
1038
-
1039
- # Export tool list for documentation
1040
- yarn list-tools --json > tools.json
1041
-
1042
- # Verify read-only mode configuration
1043
- GITLAB_READONLY=true yarn list-tools --simple | wc -l
1044
- ```
1045
-
1046
- ## Testing
1047
-
1048
- This project includes comprehensive integration tests that verify functionality against a real GitLab instance.
1049
-
1050
- ### Running Tests
1051
-
1052
- ```bash
1053
- # Run all tests (requires .env.test configuration)
1054
- yarn test
1055
-
1056
- # Run with verbose output
1057
- yarn test --verbose
1058
-
1059
- # Run specific test suites
1060
- yarn test tests/integration/data-lifecycle.test.ts
1061
- yarn test tests/integration/schemas/workitems.test.ts
1062
- ```
1063
-
1064
- ### Quick Tool Testing
1065
-
1066
- For rapid testing of individual MCP tools:
71
+ # HTTP mode
72
+ docker run -e PORT=3002 -e GITLAB_TOKEN=your_token -p 3333:3002 \
73
+ ghcr.io/structured-world/gitlab-mcp:latest
1067
74
 
1068
- ```bash
1069
- # Test specific tools directly
1070
- ./scripts/test_mcp.sh '{"name": "browse_work_items", "arguments": {"action": "list", "namespace": "test"}}'
1071
- ./scripts/test_mcp.sh '{"name": "browse_work_items", "arguments": {"action": "get", "id": "gid://gitlab/WorkItem/123"}}'
1072
- ./scripts/test_mcp.sh '{"name": "manage_work_item", "arguments": {"action": "create", "namespace": "test", "workItemType": "EPIC", "title": "Test Epic"}}'
75
+ # stdio mode
76
+ docker run -i --rm -e GITLAB_TOKEN=your_token \
77
+ ghcr.io/structured-world/gitlab-mcp:latest
1073
78
  ```
1074
79
 
1075
- The `test_mcp.sh` script automatically:
1076
- - Loads environment from `.env.test`
1077
- - Sends proper MCP initialization sequence
1078
- - Executes your tool call with proper JSON-RPC formatting
1079
- - Perfect for debugging individual tools and handlers
80
+ ## Feature Flags
1080
81
 
1081
- ### Test Architecture
82
+ | Flag | Default | Tools Enabled |
83
+ |------|---------|---------------|
84
+ | `USE_LABELS` | `true` | Label management |
85
+ | `USE_MRS` | `true` | Merge requests |
86
+ | `USE_FILES` | `true` | File operations |
87
+ | `USE_VARIABLES` | `true` | CI/CD variables |
88
+ | `USE_WORKITEMS` | `true` | Issues, epics, tasks |
89
+ | `USE_WEBHOOKS` | `true` | Webhook management |
90
+ | `USE_SNIPPETS` | `true` | Code snippets |
91
+ | `USE_INTEGRATIONS` | `true` | 50+ integrations |
92
+ | `USE_GITLAB_WIKI` | `true` | Wiki pages |
93
+ | `USE_MILESTONE` | `true` | Milestones |
94
+ | `USE_PIPELINE` | `true` | Pipelines & CI/CD |
95
+ | `USE_RELEASES` | `true` | Release management |
96
+ | `USE_REFS` | `true` | Branch & tag management |
97
+ | `USE_MEMBERS` | `true` | Team members |
98
+ | `USE_SEARCH` | `true` | Cross-project search |
1082
99
 
1083
- - **200+ integration tests** running against real GitLab 18.3 Ultimate instance
1084
- - **Data lifecycle pattern** - Creates test infrastructure once, shared across dependent tests
1085
- - **Work Items CRUD testing** - Complete Create/Read/Update/Delete for both Issues and Epics
1086
- - **Schema validation** - All 50+ schemas validated against real API responses
1087
- - **Dependency chain** - Tests run in proper order using `--runInBand` for reliable results
100
+ ## Contributing
1088
101
 
1089
- For detailed testing documentation, see [TESTING.md](TESTING.md).
102
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing, and PR guidelines.
1090
103
 
1091
- ## 💖 Support the Project
1092
-
1093
- This GitLab MCP Server is developed and maintained with care for the community. If it saves you time or helps your workflow, consider supporting its continued development!
104
+ ## Support the Project
1094
105
 
1095
106
  <div align="center">
1096
107
 
1097
108
  ![USDT TRC-20 Donation QR Code](assets/usdt-qr.svg)
1098
109
 
1099
- ☕ **Buy me a coffee with USDT (TRC-20)**
1100
- `TFDsezHa1cBkoeZT5q2T49Wp66K8t2DmdA`
1101
-
1102
- 📱 *Scan QR code with your wallet (TronLink, Trust Wallet, Exodus, etc.)*
1103
-
1104
- **Every contribution helps keep this project alive and growing! 🚀**
110
+ USDT (TRC-20): `TFDsezHa1cBkoeZT5q2T49Wp66K8t2DmdA`
1105
111
 
1106
112
  </div>
1107
113
 
1108
- ---
1109
-
1110
114
  ## License
1111
115
 
1112
- This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
1113
-
1114
- ### Attribution
1115
-
1116
- This software includes code originally developed under the MIT License:
1117
- - Original project: [zereight/gitlab-mcp](https://github.com/zereight/gitlab-mcp)
1118
- - See [LICENSE.MIT](LICENSE.MIT) for the original MIT license
1119
-
1120
- The migration to Apache 2.0 provides improved patent protection and clearer contributor terms while remaining fully compatible with the original MIT-licensed code.
1121
-
1122
- ---
116
+ Apache License 2.0 see [LICENSE](LICENSE) for details.
1123
117
 
1124
- **Maintained with ❤️ by [Dmitry Prudnikov](https://github.com/polaz)**
1125
- **Original work by [zereight](https://github.com/zereight) - Thank you for the foundation!**
118
+ Based on [zereight/gitlab-mcp](https://github.com/zereight/gitlab-mcp) (MIT). See [LICENSE.MIT](LICENSE.MIT).