@zereight/mcp-gitlab 2.0.7 โ†’ 2.0.9

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 CHANGED
@@ -67,6 +67,28 @@ When using with the Claude App, you need to set up your API key and URLs directl
67
67
  }
68
68
  ```
69
69
 
70
+ #### Strands Agents SDK (MCP Tools)
71
+
72
+ ```python
73
+ env_vars = {
74
+ "GITLAB_PERSONAL_ACCESS_TOKEN": gitlab_access_token,
75
+ "GITLAB_API_URL": gitlab_api_url,
76
+ "USE_GITLAB_WIKI": use_gitlab_wiki
77
+ # ......the rest of the optional parameters
78
+ }
79
+
80
+ stdio_gitlab_mcp_client = MCPClient(
81
+ lambda: stdio_client(
82
+ StdioServerParameters(
83
+ command="npx",
84
+ args=["-y", "@zereight/mcp-gitlab"],
85
+ env=env_vars,
86
+ )
87
+ )
88
+ )
89
+ ```
90
+
91
+
70
92
  #### Docker
71
93
 
72
94
  - stdio mcp.json
@@ -161,7 +183,20 @@ docker run -i --rm \
161
183
 
162
184
  ### Environment Variables
163
185
 
164
- - `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token.
186
+ #### Authentication Configuration
187
+
188
+ - `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token. **Required in standard mode**; not used when `REMOTE_AUTHORIZATION=true`.
189
+ - `REMOTE_AUTHORIZATION`: When set to 'true', enables remote per-session authorization via HTTP headers. In this mode:
190
+ - The server accepts GitLab PAT tokens from HTTP headers (`Authorization: Bearer <token>` or `Private-Token: <token>`) on a per-session basis
191
+ - `GITLAB_PERSONAL_ACCESS_TOKEN` environment variable is **not required** and ignored
192
+ - Only works with **Streamable HTTP transport** (`STREAMABLE_HTTP=true`) because session management was already handled by the transport layer
193
+ - **SSE transport is disabled** - attempting to use SSE with remote authorization will cause the server to exit with an error
194
+ - Each client session can use a different token, enabling multi-user support with secure session isolation
195
+ - Tokens are stored per session and automatically cleaned up when sessions close or timeout
196
+ - `SESSION_TIMEOUT_SECONDS`: Session auth token timeout in seconds. Default: `3600` (1 hour). Valid range: 1-86400 seconds (recommended: 60+). After this period of inactivity, the auth token is removed but the transport session remains active. The client must provide auth headers again on the next request. Only applies when `REMOTE_AUTHORIZATION=true`.
197
+
198
+ #### Server Configuration
199
+
165
200
  - `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`)
166
201
  - `GITLAB_PROJECT_ID`: Default project ID. If set, Overwrite this value when making an API request.
167
202
  - `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:
@@ -177,6 +212,84 @@ docker run -i --rm \
177
212
  - `STREAMABLE_HTTP`: When set to 'true', enables the Streamable HTTP transport. If both **SSE** and **STREAMABLE_HTTP** are set to 'true', the server will prioritize Streamable HTTP over SSE transport.
178
213
  - `GITLAB_COMMIT_FILES_PER_PAGE`: The number of files per page that GitLab returns for commit diffs. This value should match the server-side GitLab setting. Adjust this if your GitLab instance uses a custom per-page value for commit diffs.
179
214
 
215
+ #### Performance & Security Configuration
216
+
217
+ - `MAX_SESSIONS`: Maximum number of concurrent sessions allowed. Default: `1000`. Valid range: 1-10000. When limit is reached, new connections are rejected with HTTP 503.
218
+ - `MAX_REQUESTS_PER_MINUTE`: Rate limit per session in requests per minute. Default: `60`. Valid range: 1-1000. Exceeded requests return HTTP 429.
219
+ - `PORT`: Server port. Default: `3002`. Valid range: 1-65535.
220
+
221
+ #### Monitoring Endpoints
222
+
223
+ When using Streamable HTTP transport, the following endpoints are available:
224
+
225
+ - `/health`: Health check endpoint returning server status, active sessions count, and uptime.
226
+ - `/metrics`: Detailed metrics including:
227
+ - Active and total session counts
228
+ - Authentication metrics (failures, expirations)
229
+ - Rate limiting statistics
230
+ - Resource usage (memory, uptime)
231
+ - Configuration summary
232
+
233
+ ### Remote Authorization Setup (Multi-User Support)
234
+
235
+ When using `REMOTE_AUTHORIZATION=true`, the MCP server can support multiple users, each with their own GitLab token passed via HTTP headers. This is useful for:
236
+ - Shared MCP server instances where each user needs their own GitLab access
237
+ - IDE integrations that can inject user-specific tokens into MCP requests
238
+
239
+ **Setup Example:**
240
+
241
+ ```bash
242
+ # Start server with remote authorization
243
+ docker run -d \
244
+ -e STREAMABLE_HTTP=true \
245
+ -e REMOTE_AUTHORIZATION=true \
246
+ -e GITLAB_API_URL="https://gitlab.com/api/v4" \
247
+ -e GITLAB_READ_ONLY_MODE=true \
248
+ -e SESSION_TIMEOUT_SECONDS=3600 \
249
+ -p 3333:3002 \
250
+ iwakitakuma/gitlab-mcp
251
+ ```
252
+
253
+ **Client Configuration:**
254
+
255
+ Your IDE or MCP client must send one of these headers with each request:
256
+
257
+ ```
258
+ Authorization: Bearer glpat-xxxxxxxxxxxxxxxxxxxx
259
+ ```
260
+
261
+ or
262
+
263
+ ```
264
+ Private-Token: glpat-xxxxxxxxxxxxxxxxxxxx
265
+ ```
266
+
267
+ The token is stored per session (identified by `mcp-session-id` header) and reused for subsequent requests in the same session.
268
+
269
+ #### Remote Authorization Client Configuration Example with Cursor
270
+
271
+ ```json
272
+ {
273
+ "mcpServers": {
274
+ "GitLab": {
275
+ "url": "http(s)://<your_mcp_gitlab_server>/mcp",
276
+ "headers": {
277
+ "Authorization": "Bearer glpat-..."
278
+ }
279
+ }
280
+ }
281
+ }
282
+ ```
283
+
284
+ **Important Notes:**
285
+ - Remote authorization **only works with Streamable HTTP transport**
286
+ - Each session is isolated - tokens from one session cannot access another session's data
287
+ Tokens are automatically cleaned up when sessions close
288
+ - **Session timeout:** Auth tokens expire after `SESSION_TIMEOUT_SECONDS` (default 1 hour) of inactivity. After timeout, the client must send auth headers again. The transport session remains active.
289
+ - Each request resets the timeout timer for that session
290
+ - **Rate limiting:** Each session is limited to `MAX_REQUESTS_PER_MINUTE` requests per minute (default 60)
291
+ - **Capacity limit:** Server accepts up to `MAX_SESSIONS` concurrent sessions (default 1000)
292
+
180
293
  ## Tools ๐Ÿ› ๏ธ
181
294
 
182
295
  <details>
@@ -272,6 +385,33 @@ docker run -i --rm \
272
385
  86. `download_attachment` - Download an uploaded file from a GitLab project by secret and filename
273
386
  87. `list_events` - List all events for the currently authenticated user
274
387
  88. `get_project_events` - List all visible events for a specified project
388
+ 89. `list_releases` - List all releases for a project
389
+ 90. `get_release` - Get a release by tag name
390
+ 91. `create_release` - Create a new release in a GitLab project
391
+ 92. `update_release` - Update an existing release in a GitLab project
392
+ 93. `delete_release` - Delete a release from a GitLab project (does not delete the associated tag)
393
+ 94. `create_release_evidence` - Create release evidence for an existing release (GitLab Premium/Ultimate only)
394
+ 95. `download_release_asset` - Download a release asset file by direct asset path
275
395
  <!-- TOOLS-END -->
276
396
 
277
397
  </details>
398
+
399
+ ## Testing ๐Ÿงช
400
+
401
+ The project includes comprehensive test coverage including remote authorization:
402
+
403
+ ```bash
404
+ # Run all tests (API validation + remote auth)
405
+ npm test
406
+
407
+ # Run only remote authorization tests
408
+ npm run test:remote-auth
409
+
410
+ # Run all tests including readonly MCP tests
411
+ npm run test:all
412
+
413
+ # Run only API validation
414
+ npm run test:integration
415
+ ```
416
+
417
+ All remote authorization tests use a mock GitLab server and do not require actual GitLab credentials.