gd-gitlab-mcp 0.1.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.
- package/README.md +176 -0
- package/dist/config/index.js +7 -0
- package/dist/server.js +923 -0
- package/dist/services/gitlab.service.js +477 -0
- package/dist/services/review.service.js +35 -0
- package/dist/tools/getDiff.tool.js +10 -0
- package/dist/tools/listMR.tool.js +10 -0
- package/dist/tools/reviewMR.tool.js +23 -0
- package/dist/utils/index.js +17 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# GitLab MCP Server
|
|
2
|
+
|
|
3
|
+
MCP server for GitLab — supports both **HTTP** and **stdio** transport.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Search projects
|
|
8
|
+
- List & inspect merge requests + diffs
|
|
9
|
+
- Review, comment, approve / reject MR
|
|
10
|
+
- Open & merge MR
|
|
11
|
+
- Trigger & monitor pipelines
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Quickstart (stdio — recommended for local use)
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"gitlab-mcp": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "gd-gitlab-mcp", "--stdio"],
|
|
23
|
+
"env": {
|
|
24
|
+
"GITLAB_BASE_URL": "https://gitlab.example.com",
|
|
25
|
+
"GITLAB_TOKEN": "YOUR_GITLAB_PAT"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> `GITLAB_TOKEN` — GitLab Personal Access Token with `api` scope.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Transport Modes
|
|
37
|
+
|
|
38
|
+
### Mode 1: stdio (local, no server needed)
|
|
39
|
+
|
|
40
|
+
The MCP client spawns the process directly. Configure as shown above.
|
|
41
|
+
|
|
42
|
+
**VS Code (`mcp.json`)**
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"servers": {
|
|
47
|
+
"gitlab-mcp": {
|
|
48
|
+
"type": "stdio",
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["-y", "gd-gitlab-mcp", "--stdio"],
|
|
51
|
+
"env": {
|
|
52
|
+
"GITLAB_BASE_URL": "https://gitlab.example.com",
|
|
53
|
+
"GITLAB_TOKEN": "YOUR_GITLAB_PAT"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Claude Desktop / Claude Code (`~/.claude/mcp.json`)**
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"gitlab-mcp": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "gd-gitlab-mcp", "--stdio"],
|
|
68
|
+
"env": {
|
|
69
|
+
"GITLAB_BASE_URL": "https://gitlab.example.com",
|
|
70
|
+
"GITLAB_TOKEN": "YOUR_GITLAB_PAT"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### Mode 2: HTTP server (shared / team deployment)
|
|
80
|
+
|
|
81
|
+
Run the server once, multiple users connect via URL. Each user provides their own PAT per request via header — the token is never stored server-side.
|
|
82
|
+
|
|
83
|
+
**Requirements**
|
|
84
|
+
|
|
85
|
+
- Node.js 20+
|
|
86
|
+
|
|
87
|
+
**Environment**
|
|
88
|
+
|
|
89
|
+
```env
|
|
90
|
+
GITLAB_BASE_URL=https://gitlab.example.com
|
|
91
|
+
PORT=4000 # optional, default 4000
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Run**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm install
|
|
98
|
+
npm run build
|
|
99
|
+
npm start
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Server listens at `http://localhost:4000/mcp`.
|
|
103
|
+
|
|
104
|
+
**Docker**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
docker build -t gd-gitlab-mcp:latest .
|
|
108
|
+
docker run --rm -p 4000:4000 \
|
|
109
|
+
-e GITLAB_BASE_URL=https://gitlab.example.com \
|
|
110
|
+
gd-gitlab-mcp:latest
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**VS Code (`mcp.json`)**
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"servers": {
|
|
118
|
+
"gitlab-mcp": {
|
|
119
|
+
"type": "http",
|
|
120
|
+
"url": "http://localhost:4000/mcp",
|
|
121
|
+
"headers": {
|
|
122
|
+
"x-gitlab-token": "YOUR_GITLAB_PAT"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Claude Code CLI**
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
claude mcp add --transport http --scope user gitlab-mcp \
|
|
133
|
+
http://localhost:4000/mcp --header "x-gitlab-token: YOUR_GITLAB_PAT"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Tools Available
|
|
139
|
+
|
|
140
|
+
| Tool | Description |
|
|
141
|
+
|------|-------------|
|
|
142
|
+
| `search_projects` | Search projects by name/path |
|
|
143
|
+
| `resolve_project` | Resolve project query to project ID |
|
|
144
|
+
| `list_user_repositories` | List repositories by access scope |
|
|
145
|
+
| `list_merge_requests` | List MRs with optional filters |
|
|
146
|
+
| `get_merge_request` | Get MR details including approvals |
|
|
147
|
+
| `get_merge_request_diff` | Get MR diff/changes |
|
|
148
|
+
| `merge_readiness_check` | Check if MR is ready to merge |
|
|
149
|
+
| `check_project_merge_requests` | Resolve project + list open MRs in one call |
|
|
150
|
+
| `get_mr_discussions` | Get MR discussion threads |
|
|
151
|
+
| `merge_request_action` | comment / review / approve / merge / reject |
|
|
152
|
+
| `open_merge_request` | Open a new MR |
|
|
153
|
+
| `merge_merge_request` | Merge an MR |
|
|
154
|
+
| `reject_merge_request` | Reject and close an MR |
|
|
155
|
+
| `run_staging_pipeline` | Trigger staging pipeline |
|
|
156
|
+
| `check_pipeline_status` | Check pipeline status |
|
|
157
|
+
| `list_pipeline_jobs` | List jobs in a pipeline |
|
|
158
|
+
| `retry_pipeline_job` | Retry a failed job |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm install
|
|
166
|
+
npm run dev # HTTP mode with hot reload
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Publish
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm run build
|
|
173
|
+
npm publish
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Requires npm login with access to `@greatdayhr` on npm registry.
|