@zereight/mcp-gitlab 2.0.7 โ†’ 2.0.8

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
@@ -161,7 +161,20 @@ docker run -i --rm \
161
161
 
162
162
  ### Environment Variables
163
163
 
164
- - `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token.
164
+ #### Authentication Configuration
165
+
166
+ - `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token. **Required in standard mode**; not used when `REMOTE_AUTHORIZATION=true`.
167
+ - `REMOTE_AUTHORIZATION`: When set to 'true', enables remote per-session authorization via HTTP headers. In this mode:
168
+ - The server accepts GitLab PAT tokens from HTTP headers (`Authorization: Bearer <token>` or `Private-Token: <token>`) on a per-session basis
169
+ - `GITLAB_PERSONAL_ACCESS_TOKEN` environment variable is **not required** and ignored
170
+ - Only works with **Streamable HTTP transport** (`STREAMABLE_HTTP=true`) because session management was already handled by the transport layer
171
+ - **SSE transport is disabled** - attempting to use SSE with remote authorization will cause the server to exit with an error
172
+ - Each client session can use a different token, enabling multi-user support with secure session isolation
173
+ - Tokens are stored per session and automatically cleaned up when sessions close or timeout
174
+ - `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`.
175
+
176
+ #### Server Configuration
177
+
165
178
  - `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`)
166
179
  - `GITLAB_PROJECT_ID`: Default project ID. If set, Overwrite this value when making an API request.
167
180
  - `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 +190,84 @@ docker run -i --rm \
177
190
  - `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
191
  - `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
192
 
193
+ #### Performance & Security Configuration
194
+
195
+ - `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.
196
+ - `MAX_REQUESTS_PER_MINUTE`: Rate limit per session in requests per minute. Default: `60`. Valid range: 1-1000. Exceeded requests return HTTP 429.
197
+ - `PORT`: Server port. Default: `3002`. Valid range: 1-65535.
198
+
199
+ #### Monitoring Endpoints
200
+
201
+ When using Streamable HTTP transport, the following endpoints are available:
202
+
203
+ - `/health`: Health check endpoint returning server status, active sessions count, and uptime.
204
+ - `/metrics`: Detailed metrics including:
205
+ - Active and total session counts
206
+ - Authentication metrics (failures, expirations)
207
+ - Rate limiting statistics
208
+ - Resource usage (memory, uptime)
209
+ - Configuration summary
210
+
211
+ ### Remote Authorization Setup (Multi-User Support)
212
+
213
+ 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:
214
+ - Shared MCP server instances where each user needs their own GitLab access
215
+ - IDE integrations that can inject user-specific tokens into MCP requests
216
+
217
+ **Setup Example:**
218
+
219
+ ```bash
220
+ # Start server with remote authorization
221
+ docker run -d \
222
+ -e STREAMABLE_HTTP=true \
223
+ -e REMOTE_AUTHORIZATION=true \
224
+ -e GITLAB_API_URL="https://gitlab.com/api/v4" \
225
+ -e GITLAB_READ_ONLY_MODE=true \
226
+ -e SESSION_TIMEOUT_SECONDS=3600 \
227
+ -p 3333:3002 \
228
+ iwakitakuma/gitlab-mcp
229
+ ```
230
+
231
+ **Client Configuration:**
232
+
233
+ Your IDE or MCP client must send one of these headers with each request:
234
+
235
+ ```
236
+ Authorization: Bearer glpat-xxxxxxxxxxxxxxxxxxxx
237
+ ```
238
+
239
+ or
240
+
241
+ ```
242
+ Private-Token: glpat-xxxxxxxxxxxxxxxxxxxx
243
+ ```
244
+
245
+ The token is stored per session (identified by `mcp-session-id` header) and reused for subsequent requests in the same session.
246
+
247
+ #### Remote Authorization Client Configuration Example with Cursor
248
+
249
+ ```json
250
+ {
251
+ "mcpServers": {
252
+ "GitLab": {
253
+ "url": "http(s)://<your_mcp_gitlab_server>/mcp",
254
+ "headers": {
255
+ "Authorization": "Bearer glpat-..."
256
+ }
257
+ }
258
+ }
259
+ }
260
+ ```
261
+
262
+ **Important Notes:**
263
+ - Remote authorization **only works with Streamable HTTP transport**
264
+ - Each session is isolated - tokens from one session cannot access another session's data
265
+ Tokens are automatically cleaned up when sessions close
266
+ - **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.
267
+ - Each request resets the timeout timer for that session
268
+ - **Rate limiting:** Each session is limited to `MAX_REQUESTS_PER_MINUTE` requests per minute (default 60)
269
+ - **Capacity limit:** Server accepts up to `MAX_SESSIONS` concurrent sessions (default 1000)
270
+
180
271
  ## Tools ๐Ÿ› ๏ธ
181
272
 
182
273
  <details>
@@ -272,6 +363,33 @@ docker run -i --rm \
272
363
  86. `download_attachment` - Download an uploaded file from a GitLab project by secret and filename
273
364
  87. `list_events` - List all events for the currently authenticated user
274
365
  88. `get_project_events` - List all visible events for a specified project
366
+ 89. `list_releases` - List all releases for a project
367
+ 90. `get_release` - Get a release by tag name
368
+ 91. `create_release` - Create a new release in a GitLab project
369
+ 92. `update_release` - Update an existing release in a GitLab project
370
+ 93. `delete_release` - Delete a release from a GitLab project (does not delete the associated tag)
371
+ 94. `create_release_evidence` - Create release evidence for an existing release (GitLab Premium/Ultimate only)
372
+ 95. `download_release_asset` - Download a release asset file by direct asset path
275
373
  <!-- TOOLS-END -->
276
374
 
277
375
  </details>
376
+
377
+ ## Testing ๐Ÿงช
378
+
379
+ The project includes comprehensive test coverage including remote authorization:
380
+
381
+ ```bash
382
+ # Run all tests (API validation + remote auth)
383
+ npm test
384
+
385
+ # Run only remote authorization tests
386
+ npm run test:remote-auth
387
+
388
+ # Run all tests including readonly MCP tests
389
+ npm run test:all
390
+
391
+ # Run only API validation
392
+ npm run test:integration
393
+ ```
394
+
395
+ All remote authorization tests use a mock GitLab server and do not require actual GitLab credentials.