@zereight/mcp-gitlab 2.0.5 → 2.0.6
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 +1 -0
- package/build/index.js +142 -99
- package/build/schemas.js +99 -100
- package/build/test/comprehensive-mcp-tests.js +378 -0
- package/build/test/readonly-mcp-tests.js +381 -0
- package/build/test/simple-mcp-tests.js +190 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -175,6 +175,7 @@ docker run -i --rm \
|
|
|
175
175
|
- `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.
|
|
176
176
|
- `SSE`: When set to 'true', enables the Server-Sent Events transport.
|
|
177
177
|
- `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
|
+
- `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.
|
|
178
179
|
|
|
179
180
|
## Tools 🛠️
|
|
180
181
|
|
package/build/index.js
CHANGED
|
@@ -213,447 +213,448 @@ const DEFAULT_FETCH_CONFIG = {
|
|
|
213
213
|
return httpAgent;
|
|
214
214
|
},
|
|
215
215
|
};
|
|
216
|
+
const toJSONSchema = (schema) => zodToJsonSchema(schema, { $refStrategy: 'none' });
|
|
216
217
|
// Define all available tools
|
|
217
218
|
const allTools = [
|
|
218
219
|
{
|
|
219
220
|
name: "merge_merge_request",
|
|
220
221
|
description: "Merge a merge request in a GitLab project",
|
|
221
|
-
inputSchema:
|
|
222
|
+
inputSchema: toJSONSchema(MergeMergeRequestSchema),
|
|
222
223
|
},
|
|
223
224
|
{
|
|
224
225
|
name: "create_or_update_file",
|
|
225
226
|
description: "Create or update a single file in a GitLab project",
|
|
226
|
-
inputSchema:
|
|
227
|
+
inputSchema: toJSONSchema(CreateOrUpdateFileSchema),
|
|
227
228
|
},
|
|
228
229
|
{
|
|
229
230
|
name: "search_repositories",
|
|
230
231
|
description: "Search for GitLab projects",
|
|
231
|
-
inputSchema:
|
|
232
|
+
inputSchema: toJSONSchema(SearchRepositoriesSchema),
|
|
232
233
|
},
|
|
233
234
|
{
|
|
234
235
|
name: "create_repository",
|
|
235
236
|
description: "Create a new GitLab project",
|
|
236
|
-
inputSchema:
|
|
237
|
+
inputSchema: toJSONSchema(CreateRepositorySchema),
|
|
237
238
|
},
|
|
238
239
|
{
|
|
239
240
|
name: "get_file_contents",
|
|
240
241
|
description: "Get the contents of a file or directory from a GitLab project",
|
|
241
|
-
inputSchema:
|
|
242
|
+
inputSchema: toJSONSchema(GetFileContentsSchema),
|
|
242
243
|
},
|
|
243
244
|
{
|
|
244
245
|
name: "push_files",
|
|
245
246
|
description: "Push multiple files to a GitLab project in a single commit",
|
|
246
|
-
inputSchema:
|
|
247
|
+
inputSchema: toJSONSchema(PushFilesSchema),
|
|
247
248
|
},
|
|
248
249
|
{
|
|
249
250
|
name: "create_issue",
|
|
250
251
|
description: "Create a new issue in a GitLab project",
|
|
251
|
-
inputSchema:
|
|
252
|
+
inputSchema: toJSONSchema(CreateIssueSchema),
|
|
252
253
|
},
|
|
253
254
|
{
|
|
254
255
|
name: "create_merge_request",
|
|
255
256
|
description: "Create a new merge request in a GitLab project",
|
|
256
|
-
inputSchema:
|
|
257
|
+
inputSchema: toJSONSchema(CreateMergeRequestSchema),
|
|
257
258
|
},
|
|
258
259
|
{
|
|
259
260
|
name: "fork_repository",
|
|
260
261
|
description: "Fork a GitLab project to your account or specified namespace",
|
|
261
|
-
inputSchema:
|
|
262
|
+
inputSchema: toJSONSchema(ForkRepositorySchema),
|
|
262
263
|
},
|
|
263
264
|
{
|
|
264
265
|
name: "create_branch",
|
|
265
266
|
description: "Create a new branch in a GitLab project",
|
|
266
|
-
inputSchema:
|
|
267
|
+
inputSchema: toJSONSchema(CreateBranchSchema),
|
|
267
268
|
},
|
|
268
269
|
{
|
|
269
270
|
name: "get_merge_request",
|
|
270
271
|
description: "Get details of a merge request (Either mergeRequestIid or branchName must be provided)",
|
|
271
|
-
inputSchema:
|
|
272
|
+
inputSchema: toJSONSchema(GetMergeRequestSchema),
|
|
272
273
|
},
|
|
273
274
|
{
|
|
274
275
|
name: "get_merge_request_diffs",
|
|
275
276
|
description: "Get the changes/diffs of a merge request (Either mergeRequestIid or branchName must be provided)",
|
|
276
|
-
inputSchema:
|
|
277
|
+
inputSchema: toJSONSchema(GetMergeRequestDiffsSchema),
|
|
277
278
|
},
|
|
278
279
|
{
|
|
279
280
|
name: "list_merge_request_diffs",
|
|
280
281
|
description: "List merge request diffs with pagination support (Either mergeRequestIid or branchName must be provided)",
|
|
281
|
-
inputSchema:
|
|
282
|
+
inputSchema: toJSONSchema(ListMergeRequestDiffsSchema),
|
|
282
283
|
},
|
|
283
284
|
{
|
|
284
285
|
name: "get_branch_diffs",
|
|
285
286
|
description: "Get the changes/diffs between two branches or commits in a GitLab project",
|
|
286
|
-
inputSchema:
|
|
287
|
+
inputSchema: toJSONSchema(GetBranchDiffsSchema),
|
|
287
288
|
},
|
|
288
289
|
{
|
|
289
290
|
name: "update_merge_request",
|
|
290
291
|
description: "Update a merge request (Either mergeRequestIid or branchName must be provided)",
|
|
291
|
-
inputSchema:
|
|
292
|
+
inputSchema: toJSONSchema(UpdateMergeRequestSchema),
|
|
292
293
|
},
|
|
293
294
|
{
|
|
294
295
|
name: "create_note",
|
|
295
296
|
description: "Create a new note (comment) to an issue or merge request",
|
|
296
|
-
inputSchema:
|
|
297
|
+
inputSchema: toJSONSchema(CreateNoteSchema),
|
|
297
298
|
},
|
|
298
299
|
{
|
|
299
300
|
name: "create_merge_request_thread",
|
|
300
301
|
description: "Create a new thread on a merge request",
|
|
301
|
-
inputSchema:
|
|
302
|
+
inputSchema: toJSONSchema(CreateMergeRequestThreadSchema),
|
|
302
303
|
},
|
|
303
304
|
{
|
|
304
305
|
name: "mr_discussions",
|
|
305
306
|
description: "List discussion items for a merge request",
|
|
306
|
-
inputSchema:
|
|
307
|
+
inputSchema: toJSONSchema(ListMergeRequestDiscussionsSchema),
|
|
307
308
|
},
|
|
308
309
|
{
|
|
309
310
|
name: "update_merge_request_note",
|
|
310
311
|
description: "Modify an existing merge request thread note",
|
|
311
|
-
inputSchema:
|
|
312
|
+
inputSchema: toJSONSchema(UpdateMergeRequestNoteSchema),
|
|
312
313
|
},
|
|
313
314
|
{
|
|
314
315
|
name: "create_merge_request_note",
|
|
315
316
|
description: "Add a new note to an existing merge request thread",
|
|
316
|
-
inputSchema:
|
|
317
|
+
inputSchema: toJSONSchema(CreateMergeRequestNoteSchema),
|
|
317
318
|
},
|
|
318
319
|
{
|
|
319
320
|
name: "get_draft_note",
|
|
320
321
|
description: "Get a single draft note from a merge request",
|
|
321
|
-
inputSchema:
|
|
322
|
+
inputSchema: toJSONSchema(GetDraftNoteSchema),
|
|
322
323
|
},
|
|
323
324
|
{
|
|
324
325
|
name: "list_draft_notes",
|
|
325
326
|
description: "List draft notes for a merge request",
|
|
326
|
-
inputSchema:
|
|
327
|
+
inputSchema: toJSONSchema(ListDraftNotesSchema),
|
|
327
328
|
},
|
|
328
329
|
{
|
|
329
330
|
name: "create_draft_note",
|
|
330
331
|
description: "Create a draft note for a merge request",
|
|
331
|
-
inputSchema:
|
|
332
|
+
inputSchema: toJSONSchema(CreateDraftNoteSchema),
|
|
332
333
|
},
|
|
333
334
|
{
|
|
334
335
|
name: "update_draft_note",
|
|
335
336
|
description: "Update an existing draft note",
|
|
336
|
-
inputSchema:
|
|
337
|
+
inputSchema: toJSONSchema(UpdateDraftNoteSchema),
|
|
337
338
|
},
|
|
338
339
|
{
|
|
339
340
|
name: "delete_draft_note",
|
|
340
341
|
description: "Delete a draft note",
|
|
341
|
-
inputSchema:
|
|
342
|
+
inputSchema: toJSONSchema(DeleteDraftNoteSchema),
|
|
342
343
|
},
|
|
343
344
|
{
|
|
344
345
|
name: "publish_draft_note",
|
|
345
346
|
description: "Publish a single draft note",
|
|
346
|
-
inputSchema:
|
|
347
|
+
inputSchema: toJSONSchema(PublishDraftNoteSchema),
|
|
347
348
|
},
|
|
348
349
|
{
|
|
349
350
|
name: "bulk_publish_draft_notes",
|
|
350
351
|
description: "Publish all draft notes for a merge request",
|
|
351
|
-
inputSchema:
|
|
352
|
+
inputSchema: toJSONSchema(BulkPublishDraftNotesSchema),
|
|
352
353
|
},
|
|
353
354
|
{
|
|
354
355
|
name: "update_issue_note",
|
|
355
356
|
description: "Modify an existing issue thread note",
|
|
356
|
-
inputSchema:
|
|
357
|
+
inputSchema: toJSONSchema(UpdateIssueNoteSchema),
|
|
357
358
|
},
|
|
358
359
|
{
|
|
359
360
|
name: "create_issue_note",
|
|
360
361
|
description: "Add a new note to an existing issue thread",
|
|
361
|
-
inputSchema:
|
|
362
|
+
inputSchema: toJSONSchema(CreateIssueNoteSchema),
|
|
362
363
|
},
|
|
363
364
|
{
|
|
364
365
|
name: "list_issues",
|
|
365
366
|
description: "List issues (default: created by current user only; use scope='all' for all accessible issues)",
|
|
366
|
-
inputSchema:
|
|
367
|
+
inputSchema: toJSONSchema(ListIssuesSchema),
|
|
367
368
|
},
|
|
368
369
|
{
|
|
369
370
|
name: "my_issues",
|
|
370
371
|
description: "List issues assigned to the authenticated user (defaults to open issues)",
|
|
371
|
-
inputSchema:
|
|
372
|
+
inputSchema: toJSONSchema(MyIssuesSchema),
|
|
372
373
|
},
|
|
373
374
|
{
|
|
374
375
|
name: "get_issue",
|
|
375
376
|
description: "Get details of a specific issue in a GitLab project",
|
|
376
|
-
inputSchema:
|
|
377
|
+
inputSchema: toJSONSchema(GetIssueSchema),
|
|
377
378
|
},
|
|
378
379
|
{
|
|
379
380
|
name: "update_issue",
|
|
380
381
|
description: "Update an issue in a GitLab project",
|
|
381
|
-
inputSchema:
|
|
382
|
+
inputSchema: toJSONSchema(UpdateIssueSchema),
|
|
382
383
|
},
|
|
383
384
|
{
|
|
384
385
|
name: "delete_issue",
|
|
385
386
|
description: "Delete an issue from a GitLab project",
|
|
386
|
-
inputSchema:
|
|
387
|
+
inputSchema: toJSONSchema(DeleteIssueSchema),
|
|
387
388
|
},
|
|
388
389
|
{
|
|
389
390
|
name: "list_issue_links",
|
|
390
391
|
description: "List all issue links for a specific issue",
|
|
391
|
-
inputSchema:
|
|
392
|
+
inputSchema: toJSONSchema(ListIssueLinksSchema),
|
|
392
393
|
},
|
|
393
394
|
{
|
|
394
395
|
name: "list_issue_discussions",
|
|
395
396
|
description: "List discussions for an issue in a GitLab project",
|
|
396
|
-
inputSchema:
|
|
397
|
+
inputSchema: toJSONSchema(ListIssueDiscussionsSchema),
|
|
397
398
|
},
|
|
398
399
|
{
|
|
399
400
|
name: "get_issue_link",
|
|
400
401
|
description: "Get a specific issue link",
|
|
401
|
-
inputSchema:
|
|
402
|
+
inputSchema: toJSONSchema(GetIssueLinkSchema),
|
|
402
403
|
},
|
|
403
404
|
{
|
|
404
405
|
name: "create_issue_link",
|
|
405
406
|
description: "Create an issue link between two issues",
|
|
406
|
-
inputSchema:
|
|
407
|
+
inputSchema: toJSONSchema(CreateIssueLinkSchema),
|
|
407
408
|
},
|
|
408
409
|
{
|
|
409
410
|
name: "delete_issue_link",
|
|
410
411
|
description: "Delete an issue link",
|
|
411
|
-
inputSchema:
|
|
412
|
+
inputSchema: toJSONSchema(DeleteIssueLinkSchema),
|
|
412
413
|
},
|
|
413
414
|
{
|
|
414
415
|
name: "list_namespaces",
|
|
415
416
|
description: "List all namespaces available to the current user",
|
|
416
|
-
inputSchema:
|
|
417
|
+
inputSchema: toJSONSchema(ListNamespacesSchema),
|
|
417
418
|
},
|
|
418
419
|
{
|
|
419
420
|
name: "get_namespace",
|
|
420
421
|
description: "Get details of a namespace by ID or path",
|
|
421
|
-
inputSchema:
|
|
422
|
+
inputSchema: toJSONSchema(GetNamespaceSchema),
|
|
422
423
|
},
|
|
423
424
|
{
|
|
424
425
|
name: "verify_namespace",
|
|
425
426
|
description: "Verify if a namespace path exists",
|
|
426
|
-
inputSchema:
|
|
427
|
+
inputSchema: toJSONSchema(VerifyNamespaceSchema),
|
|
427
428
|
},
|
|
428
429
|
{
|
|
429
430
|
name: "get_project",
|
|
430
431
|
description: "Get details of a specific project",
|
|
431
|
-
inputSchema:
|
|
432
|
+
inputSchema: toJSONSchema(GetProjectSchema),
|
|
432
433
|
},
|
|
433
434
|
{
|
|
434
435
|
name: "list_projects",
|
|
435
436
|
description: "List projects accessible by the current user",
|
|
436
|
-
inputSchema:
|
|
437
|
+
inputSchema: toJSONSchema(ListProjectsSchema),
|
|
437
438
|
},
|
|
438
439
|
{
|
|
439
440
|
name: "list_project_members",
|
|
440
441
|
description: "List members of a GitLab project",
|
|
441
|
-
inputSchema:
|
|
442
|
+
inputSchema: toJSONSchema(ListProjectMembersSchema),
|
|
442
443
|
},
|
|
443
444
|
{
|
|
444
445
|
name: "list_labels",
|
|
445
446
|
description: "List labels for a project",
|
|
446
|
-
inputSchema:
|
|
447
|
+
inputSchema: toJSONSchema(ListLabelsSchema),
|
|
447
448
|
},
|
|
448
449
|
{
|
|
449
450
|
name: "get_label",
|
|
450
451
|
description: "Get a single label from a project",
|
|
451
|
-
inputSchema:
|
|
452
|
+
inputSchema: toJSONSchema(GetLabelSchema),
|
|
452
453
|
},
|
|
453
454
|
{
|
|
454
455
|
name: "create_label",
|
|
455
456
|
description: "Create a new label in a project",
|
|
456
|
-
inputSchema:
|
|
457
|
+
inputSchema: toJSONSchema(CreateLabelSchema),
|
|
457
458
|
},
|
|
458
459
|
{
|
|
459
460
|
name: "update_label",
|
|
460
461
|
description: "Update an existing label in a project",
|
|
461
|
-
inputSchema:
|
|
462
|
+
inputSchema: toJSONSchema(UpdateLabelSchema),
|
|
462
463
|
},
|
|
463
464
|
{
|
|
464
465
|
name: "delete_label",
|
|
465
466
|
description: "Delete a label from a project",
|
|
466
|
-
inputSchema:
|
|
467
|
+
inputSchema: toJSONSchema(DeleteLabelSchema),
|
|
467
468
|
},
|
|
468
469
|
{
|
|
469
470
|
name: "list_group_projects",
|
|
470
471
|
description: "List projects in a GitLab group with filtering options",
|
|
471
|
-
inputSchema:
|
|
472
|
+
inputSchema: toJSONSchema(ListGroupProjectsSchema),
|
|
472
473
|
},
|
|
473
474
|
{
|
|
474
475
|
name: "list_wiki_pages",
|
|
475
476
|
description: "List wiki pages in a GitLab project",
|
|
476
|
-
inputSchema:
|
|
477
|
+
inputSchema: toJSONSchema(ListWikiPagesSchema),
|
|
477
478
|
},
|
|
478
479
|
{
|
|
479
480
|
name: "get_wiki_page",
|
|
480
481
|
description: "Get details of a specific wiki page",
|
|
481
|
-
inputSchema:
|
|
482
|
+
inputSchema: toJSONSchema(GetWikiPageSchema),
|
|
482
483
|
},
|
|
483
484
|
{
|
|
484
485
|
name: "create_wiki_page",
|
|
485
486
|
description: "Create a new wiki page in a GitLab project",
|
|
486
|
-
inputSchema:
|
|
487
|
+
inputSchema: toJSONSchema(CreateWikiPageSchema),
|
|
487
488
|
},
|
|
488
489
|
{
|
|
489
490
|
name: "update_wiki_page",
|
|
490
491
|
description: "Update an existing wiki page in a GitLab project",
|
|
491
|
-
inputSchema:
|
|
492
|
+
inputSchema: toJSONSchema(UpdateWikiPageSchema),
|
|
492
493
|
},
|
|
493
494
|
{
|
|
494
495
|
name: "delete_wiki_page",
|
|
495
496
|
description: "Delete a wiki page from a GitLab project",
|
|
496
|
-
inputSchema:
|
|
497
|
+
inputSchema: toJSONSchema(DeleteWikiPageSchema),
|
|
497
498
|
},
|
|
498
499
|
{
|
|
499
500
|
name: "get_repository_tree",
|
|
500
501
|
description: "Get the repository tree for a GitLab project (list files and directories)",
|
|
501
|
-
inputSchema:
|
|
502
|
+
inputSchema: toJSONSchema(GetRepositoryTreeSchema),
|
|
502
503
|
},
|
|
503
504
|
{
|
|
504
505
|
name: "list_pipelines",
|
|
505
506
|
description: "List pipelines in a GitLab project with filtering options",
|
|
506
|
-
inputSchema:
|
|
507
|
+
inputSchema: toJSONSchema(ListPipelinesSchema),
|
|
507
508
|
},
|
|
508
509
|
{
|
|
509
510
|
name: "get_pipeline",
|
|
510
511
|
description: "Get details of a specific pipeline in a GitLab project",
|
|
511
|
-
inputSchema:
|
|
512
|
+
inputSchema: toJSONSchema(GetPipelineSchema),
|
|
512
513
|
},
|
|
513
514
|
{
|
|
514
515
|
name: "list_pipeline_jobs",
|
|
515
516
|
description: "List all jobs in a specific pipeline",
|
|
516
|
-
inputSchema:
|
|
517
|
+
inputSchema: toJSONSchema(ListPipelineJobsSchema),
|
|
517
518
|
},
|
|
518
519
|
{
|
|
519
520
|
name: "list_pipeline_trigger_jobs",
|
|
520
521
|
description: "List all trigger jobs (bridges) in a specific pipeline that trigger downstream pipelines",
|
|
521
|
-
inputSchema:
|
|
522
|
+
inputSchema: toJSONSchema(ListPipelineTriggerJobsSchema),
|
|
522
523
|
},
|
|
523
524
|
{
|
|
524
525
|
name: "get_pipeline_job",
|
|
525
526
|
description: "Get details of a GitLab pipeline job number",
|
|
526
|
-
inputSchema:
|
|
527
|
+
inputSchema: toJSONSchema(GetPipelineJobOutputSchema),
|
|
527
528
|
},
|
|
528
529
|
{
|
|
529
530
|
name: "get_pipeline_job_output",
|
|
530
531
|
description: "Get the output/trace of a GitLab pipeline job with optional pagination to limit context window usage",
|
|
531
|
-
inputSchema:
|
|
532
|
+
inputSchema: toJSONSchema(GetPipelineJobOutputSchema),
|
|
532
533
|
},
|
|
533
534
|
{
|
|
534
535
|
name: "create_pipeline",
|
|
535
536
|
description: "Create a new pipeline for a branch or tag",
|
|
536
|
-
inputSchema:
|
|
537
|
+
inputSchema: toJSONSchema(CreatePipelineSchema),
|
|
537
538
|
},
|
|
538
539
|
{
|
|
539
540
|
name: "retry_pipeline",
|
|
540
541
|
description: "Retry a failed or canceled pipeline",
|
|
541
|
-
inputSchema:
|
|
542
|
+
inputSchema: toJSONSchema(RetryPipelineSchema),
|
|
542
543
|
},
|
|
543
544
|
{
|
|
544
545
|
name: "cancel_pipeline",
|
|
545
546
|
description: "Cancel a running pipeline",
|
|
546
|
-
inputSchema:
|
|
547
|
+
inputSchema: toJSONSchema(CancelPipelineSchema),
|
|
547
548
|
},
|
|
548
549
|
{
|
|
549
550
|
name: "play_pipeline_job",
|
|
550
551
|
description: "Run a manual pipeline job",
|
|
551
|
-
inputSchema:
|
|
552
|
+
inputSchema: toJSONSchema(PlayPipelineJobSchema),
|
|
552
553
|
},
|
|
553
554
|
{
|
|
554
555
|
name: "retry_pipeline_job",
|
|
555
556
|
description: "Retry a failed or canceled pipeline job",
|
|
556
|
-
inputSchema:
|
|
557
|
+
inputSchema: toJSONSchema(RetryPipelineJobSchema),
|
|
557
558
|
},
|
|
558
559
|
{
|
|
559
560
|
name: "cancel_pipeline_job",
|
|
560
561
|
description: "Cancel a running pipeline job",
|
|
561
|
-
inputSchema:
|
|
562
|
+
inputSchema: toJSONSchema(CancelPipelineJobSchema),
|
|
562
563
|
},
|
|
563
564
|
{
|
|
564
565
|
name: "list_merge_requests",
|
|
565
566
|
description: "List merge requests in a GitLab project with filtering options",
|
|
566
|
-
inputSchema:
|
|
567
|
+
inputSchema: toJSONSchema(ListMergeRequestsSchema),
|
|
567
568
|
},
|
|
568
569
|
{
|
|
569
570
|
name: "list_milestones",
|
|
570
571
|
description: "List milestones in a GitLab project with filtering options",
|
|
571
|
-
inputSchema:
|
|
572
|
+
inputSchema: toJSONSchema(ListProjectMilestonesSchema),
|
|
572
573
|
},
|
|
573
574
|
{
|
|
574
575
|
name: "get_milestone",
|
|
575
576
|
description: "Get details of a specific milestone",
|
|
576
|
-
inputSchema:
|
|
577
|
+
inputSchema: toJSONSchema(GetProjectMilestoneSchema),
|
|
577
578
|
},
|
|
578
579
|
{
|
|
579
580
|
name: "create_milestone",
|
|
580
581
|
description: "Create a new milestone in a GitLab project",
|
|
581
|
-
inputSchema:
|
|
582
|
+
inputSchema: toJSONSchema(CreateProjectMilestoneSchema),
|
|
582
583
|
},
|
|
583
584
|
{
|
|
584
585
|
name: "edit_milestone",
|
|
585
586
|
description: "Edit an existing milestone in a GitLab project",
|
|
586
|
-
inputSchema:
|
|
587
|
+
inputSchema: toJSONSchema(EditProjectMilestoneSchema),
|
|
587
588
|
},
|
|
588
589
|
{
|
|
589
590
|
name: "delete_milestone",
|
|
590
591
|
description: "Delete a milestone from a GitLab project",
|
|
591
|
-
inputSchema:
|
|
592
|
+
inputSchema: toJSONSchema(DeleteProjectMilestoneSchema),
|
|
592
593
|
},
|
|
593
594
|
{
|
|
594
595
|
name: "get_milestone_issue",
|
|
595
596
|
description: "Get issues associated with a specific milestone",
|
|
596
|
-
inputSchema:
|
|
597
|
+
inputSchema: toJSONSchema(GetMilestoneIssuesSchema),
|
|
597
598
|
},
|
|
598
599
|
{
|
|
599
600
|
name: "get_milestone_merge_requests",
|
|
600
601
|
description: "Get merge requests associated with a specific milestone",
|
|
601
|
-
inputSchema:
|
|
602
|
+
inputSchema: toJSONSchema(GetMilestoneMergeRequestsSchema),
|
|
602
603
|
},
|
|
603
604
|
{
|
|
604
605
|
name: "promote_milestone",
|
|
605
606
|
description: "Promote a milestone to the next stage",
|
|
606
|
-
inputSchema:
|
|
607
|
+
inputSchema: toJSONSchema(PromoteProjectMilestoneSchema),
|
|
607
608
|
},
|
|
608
609
|
{
|
|
609
610
|
name: "get_milestone_burndown_events",
|
|
610
611
|
description: "Get burndown events for a specific milestone",
|
|
611
|
-
inputSchema:
|
|
612
|
+
inputSchema: toJSONSchema(GetMilestoneBurndownEventsSchema),
|
|
612
613
|
},
|
|
613
614
|
{
|
|
614
615
|
name: "get_users",
|
|
615
616
|
description: "Get GitLab user details by usernames",
|
|
616
|
-
inputSchema:
|
|
617
|
+
inputSchema: toJSONSchema(GetUsersSchema),
|
|
617
618
|
},
|
|
618
619
|
{
|
|
619
620
|
name: "list_commits",
|
|
620
621
|
description: "List repository commits with filtering options",
|
|
621
|
-
inputSchema:
|
|
622
|
+
inputSchema: toJSONSchema(ListCommitsSchema),
|
|
622
623
|
},
|
|
623
624
|
{
|
|
624
625
|
name: "get_commit",
|
|
625
626
|
description: "Get details of a specific commit",
|
|
626
|
-
inputSchema:
|
|
627
|
+
inputSchema: toJSONSchema(GetCommitSchema),
|
|
627
628
|
},
|
|
628
629
|
{
|
|
629
630
|
name: "get_commit_diff",
|
|
630
631
|
description: "Get changes/diffs of a specific commit",
|
|
631
|
-
inputSchema:
|
|
632
|
+
inputSchema: toJSONSchema(GetCommitDiffSchema),
|
|
632
633
|
},
|
|
633
634
|
{
|
|
634
635
|
name: "list_group_iterations",
|
|
635
636
|
description: "List group iterations with filtering options",
|
|
636
|
-
inputSchema:
|
|
637
|
+
inputSchema: toJSONSchema(ListGroupIterationsSchema),
|
|
637
638
|
},
|
|
638
639
|
{
|
|
639
640
|
name: "upload_markdown",
|
|
640
641
|
description: "Upload a file to a GitLab project for use in markdown content",
|
|
641
|
-
inputSchema:
|
|
642
|
+
inputSchema: toJSONSchema(MarkdownUploadSchema),
|
|
642
643
|
},
|
|
643
644
|
{
|
|
644
645
|
name: "download_attachment",
|
|
645
646
|
description: "Download an uploaded file from a GitLab project by secret and filename",
|
|
646
|
-
inputSchema:
|
|
647
|
+
inputSchema: toJSONSchema(DownloadAttachmentSchema),
|
|
647
648
|
},
|
|
648
649
|
{
|
|
649
650
|
name: "list_events",
|
|
650
651
|
description: "List all events for the currently authenticated user. Note: before/after parameters accept date format YYYY-MM-DD only",
|
|
651
|
-
inputSchema:
|
|
652
|
+
inputSchema: toJSONSchema(ListEventsSchema),
|
|
652
653
|
},
|
|
653
654
|
{
|
|
654
655
|
name: "get_project_events",
|
|
655
656
|
description: "List all visible events for a specified project. Note: before/after parameters accept date format YYYY-MM-DD only",
|
|
656
|
-
inputSchema:
|
|
657
|
+
inputSchema: toJSONSchema(GetProjectEventsSchema),
|
|
657
658
|
},
|
|
658
659
|
];
|
|
659
660
|
// Define which tools are read-only
|
|
@@ -763,6 +764,7 @@ function normalizeGitLabApiUrl(url) {
|
|
|
763
764
|
const GITLAB_API_URL = normalizeGitLabApiUrl(process.env.GITLAB_API_URL || "");
|
|
764
765
|
const GITLAB_PROJECT_ID = process.env.GITLAB_PROJECT_ID;
|
|
765
766
|
const GITLAB_ALLOWED_PROJECT_IDS = process.env.GITLAB_ALLOWED_PROJECT_IDS?.split(',').map(id => id.trim()).filter(Boolean) || [];
|
|
767
|
+
const GITLAB_COMMIT_FILES_PER_PAGE = process.env.GITLAB_COMMIT_FILES_PER_PAGE ? parseInt(process.env.GITLAB_COMMIT_FILES_PER_PAGE) : 20;
|
|
766
768
|
if (!GITLAB_PERSONAL_ACCESS_TOKEN) {
|
|
767
769
|
logger.error("GITLAB_PERSONAL_ACCESS_TOKEN environment variable is not set");
|
|
768
770
|
process.exit(1);
|
|
@@ -3012,17 +3014,35 @@ async function getCommit(projectId, sha, stats) {
|
|
|
3012
3014
|
*
|
|
3013
3015
|
* @param {string} projectId - Project ID or URL-encoded path
|
|
3014
3016
|
* @param {string} sha - The commit hash or name of a repository branch or tag
|
|
3017
|
+
* @param {boolean} [full_diff] - Whether to return the full diff or only first page
|
|
3015
3018
|
* @returns {Promise<GitLabMergeRequestDiff[]>} The commit diffs
|
|
3016
3019
|
*/
|
|
3017
|
-
async function getCommitDiff(projectId, sha) {
|
|
3020
|
+
async function getCommitDiff(projectId, sha, full_diff) {
|
|
3018
3021
|
projectId = decodeURIComponent(projectId);
|
|
3019
|
-
const
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3022
|
+
const baseUrl = `${GITLAB_API_URL}/projects/${encodeURIComponent(getEffectiveProjectId(projectId))}/repository/commits/${encodeURIComponent(sha)}/diff`;
|
|
3023
|
+
let allDiffs = [];
|
|
3024
|
+
let page = 1;
|
|
3025
|
+
while (true) {
|
|
3026
|
+
const url = new URL(baseUrl);
|
|
3027
|
+
if (full_diff) {
|
|
3028
|
+
url.searchParams.append("page", page.toString());
|
|
3029
|
+
}
|
|
3030
|
+
const response = await fetch(url.toString(), {
|
|
3031
|
+
...DEFAULT_FETCH_CONFIG,
|
|
3032
|
+
});
|
|
3033
|
+
await handleGitLabError(response);
|
|
3034
|
+
const data = await response.json();
|
|
3035
|
+
const diffs = z.array(GitLabDiffSchema).parse(data);
|
|
3036
|
+
allDiffs.push(...diffs);
|
|
3037
|
+
if (!full_diff) {
|
|
3038
|
+
break;
|
|
3039
|
+
}
|
|
3040
|
+
if (diffs.length < GITLAB_COMMIT_FILES_PER_PAGE) {
|
|
3041
|
+
break;
|
|
3042
|
+
}
|
|
3043
|
+
page++;
|
|
3044
|
+
}
|
|
3045
|
+
return allDiffs;
|
|
3026
3046
|
}
|
|
3027
3047
|
/**
|
|
3028
3048
|
* Get the current authenticated user
|
|
@@ -3114,8 +3134,8 @@ async function listGroupIterations(groupId, options = {}) {
|
|
|
3114
3134
|
url.searchParams.append("state", options.state);
|
|
3115
3135
|
if (options.search)
|
|
3116
3136
|
url.searchParams.append("search", options.search);
|
|
3117
|
-
if (options.
|
|
3118
|
-
url.searchParams.append("in", options.
|
|
3137
|
+
if (options.search_in)
|
|
3138
|
+
url.searchParams.append("in", options.search_in.join(","));
|
|
3119
3139
|
if (options.include_ancestors !== undefined)
|
|
3120
3140
|
url.searchParams.append("include_ancestors", options.include_ancestors.toString());
|
|
3121
3141
|
if (options.include_descendants !== undefined)
|
|
@@ -4096,7 +4116,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
4096
4116
|
}
|
|
4097
4117
|
case "get_commit_diff": {
|
|
4098
4118
|
const args = GetCommitDiffSchema.parse(request.params.arguments);
|
|
4099
|
-
const diff = await getCommitDiff(args.project_id, args.sha);
|
|
4119
|
+
const diff = await getCommitDiff(args.project_id, args.sha, args.full_diff);
|
|
4100
4120
|
return {
|
|
4101
4121
|
content: [{ type: "text", text: JSON.stringify(diff, null, 2) }],
|
|
4102
4122
|
};
|
|
@@ -4269,6 +4289,29 @@ async function startStreamableHTTPServer() {
|
|
|
4269
4289
|
});
|
|
4270
4290
|
}
|
|
4271
4291
|
});
|
|
4292
|
+
// to delete a mcp server session explicitly
|
|
4293
|
+
app.delete("/mcp", async (req, res) => {
|
|
4294
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
4295
|
+
if (!sessionId) {
|
|
4296
|
+
res.status(400).json({ error: "mcp-session-id header is required" });
|
|
4297
|
+
return;
|
|
4298
|
+
}
|
|
4299
|
+
const transport = streamableTransports[sessionId];
|
|
4300
|
+
if (transport) {
|
|
4301
|
+
try {
|
|
4302
|
+
await transport.close();
|
|
4303
|
+
logger.info(`Explicitly closed session via DELETE request: ${sessionId}`);
|
|
4304
|
+
res.status(204).send();
|
|
4305
|
+
}
|
|
4306
|
+
catch (error) {
|
|
4307
|
+
logger.error(`Error closing session ${sessionId}:`, error);
|
|
4308
|
+
res.status(500).json({ error: "Failed to close session" });
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
else {
|
|
4312
|
+
res.status(404).json({ error: "Session not found" });
|
|
4313
|
+
}
|
|
4314
|
+
});
|
|
4272
4315
|
// Health check endpoint
|
|
4273
4316
|
app.get("/health", (_, res) => {
|
|
4274
4317
|
res.status(200).json({
|