@zereight/mcp-gitlab 1.0.45 → 1.0.47
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 +43 -1
- package/build/schemas.js +85 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,4 +125,5 @@ When using with the Claude App, you need to set up your API key and URLs directl
|
|
|
125
125
|
48. `list_pipeline_jobs` - List all jobs in a specific pipeline
|
|
126
126
|
49. `get_pipeline_job` - Get details of a GitLab pipeline job number
|
|
127
127
|
50. `get_pipeline_job_output` - Get the output/trace of a GitLab pipeline job number
|
|
128
|
+
51. `list_merge_requests` - List merge requests in a GitLab project with filtering options
|
|
128
129
|
<!-- TOOLS-END -->
|
package/build/index.js
CHANGED
|
@@ -20,7 +20,7 @@ GetPipelineJobOutputSchema, GitLabPipelineJobSchema,
|
|
|
20
20
|
GitLabDiscussionNoteSchema, // Added
|
|
21
21
|
GitLabDiscussionSchema, UpdateMergeRequestNoteSchema, // Added
|
|
22
22
|
CreateMergeRequestNoteSchema, // Added
|
|
23
|
-
ListMergeRequestDiscussionsSchema, UpdateIssueNoteSchema, CreateIssueNoteSchema, } from "./schemas.js";
|
|
23
|
+
ListMergeRequestDiscussionsSchema, UpdateIssueNoteSchema, CreateIssueNoteSchema, ListMergeRequestsSchema, } from "./schemas.js";
|
|
24
24
|
/**
|
|
25
25
|
* Read version from package.json
|
|
26
26
|
*/
|
|
@@ -338,6 +338,11 @@ const allTools = [
|
|
|
338
338
|
description: "Get the output/trace of a GitLab pipeline job number",
|
|
339
339
|
inputSchema: zodToJsonSchema(GetPipelineJobOutputSchema),
|
|
340
340
|
},
|
|
341
|
+
{
|
|
342
|
+
name: "list_merge_requests",
|
|
343
|
+
description: "List merge requests in a GitLab project with filtering options",
|
|
344
|
+
inputSchema: zodToJsonSchema(ListMergeRequestsSchema),
|
|
345
|
+
},
|
|
341
346
|
];
|
|
342
347
|
// Define which tools are read-only
|
|
343
348
|
const readOnlyTools = [
|
|
@@ -347,6 +352,7 @@ const readOnlyTools = [
|
|
|
347
352
|
"get_merge_request_diffs",
|
|
348
353
|
"mr_discussions",
|
|
349
354
|
"list_issues",
|
|
355
|
+
"list_merge_requests",
|
|
350
356
|
"get_issue",
|
|
351
357
|
"list_issue_links",
|
|
352
358
|
"list_issue_discussions",
|
|
@@ -585,6 +591,35 @@ async function listIssues(projectId, options = {}) {
|
|
|
585
591
|
const data = await response.json();
|
|
586
592
|
return z.array(GitLabIssueSchema).parse(data);
|
|
587
593
|
}
|
|
594
|
+
/**
|
|
595
|
+
* List merge requests in a GitLab project with optional filtering
|
|
596
|
+
*
|
|
597
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
598
|
+
* @param {Object} options - Optional filtering parameters
|
|
599
|
+
* @returns {Promise<GitLabMergeRequest[]>} List of merge requests
|
|
600
|
+
*/
|
|
601
|
+
async function listMergeRequests(projectId, options = {}) {
|
|
602
|
+
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
603
|
+
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/merge_requests`);
|
|
604
|
+
// Add all query parameters
|
|
605
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
606
|
+
if (value !== undefined) {
|
|
607
|
+
if (key === "labels" && Array.isArray(value)) {
|
|
608
|
+
// Handle array of labels
|
|
609
|
+
url.searchParams.append(key, value.join(","));
|
|
610
|
+
}
|
|
611
|
+
else {
|
|
612
|
+
url.searchParams.append(key, value.toString());
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
const response = await fetch(url.toString(), {
|
|
617
|
+
...DEFAULT_FETCH_CONFIG,
|
|
618
|
+
});
|
|
619
|
+
await handleGitLabError(response);
|
|
620
|
+
const data = await response.json();
|
|
621
|
+
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
622
|
+
}
|
|
588
623
|
/**
|
|
589
624
|
* Get a single issue from a GitLab project
|
|
590
625
|
* 단일 이슈 조회
|
|
@@ -2318,6 +2353,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
2318
2353
|
],
|
|
2319
2354
|
};
|
|
2320
2355
|
}
|
|
2356
|
+
case "list_merge_requests": {
|
|
2357
|
+
const args = ListMergeRequestsSchema.parse(request.params.arguments);
|
|
2358
|
+
const mergeRequests = await listMergeRequests(args.project_id, args);
|
|
2359
|
+
return {
|
|
2360
|
+
content: [{ type: "text", text: JSON.stringify(mergeRequests, null, 2) }],
|
|
2361
|
+
};
|
|
2362
|
+
}
|
|
2321
2363
|
default:
|
|
2322
2364
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
2323
2365
|
}
|
package/build/schemas.js
CHANGED
|
@@ -38,7 +38,7 @@ export const GitLabPipelineSchema = z.object({
|
|
|
38
38
|
image: z.string().optional(),
|
|
39
39
|
size: z.string().optional(),
|
|
40
40
|
title: z.string().optional(),
|
|
41
|
-
}).optional(),
|
|
41
|
+
}).nullable().optional(),
|
|
42
42
|
favicon: z.string().optional(),
|
|
43
43
|
}).optional(),
|
|
44
44
|
});
|
|
@@ -365,14 +365,14 @@ export const GitLabUserSchema = z.object({
|
|
|
365
365
|
username: z.string(), // Changed from login to match GitLab API
|
|
366
366
|
id: z.number(),
|
|
367
367
|
name: z.string(),
|
|
368
|
-
avatar_url: z.string(),
|
|
368
|
+
avatar_url: z.string().nullable(),
|
|
369
369
|
web_url: z.string(), // Changed from html_url to match GitLab API
|
|
370
370
|
});
|
|
371
371
|
export const GitLabMilestoneSchema = z.object({
|
|
372
372
|
id: z.number(),
|
|
373
373
|
iid: z.number(), // Added to match GitLab API
|
|
374
374
|
title: z.string(),
|
|
375
|
-
description: z.string(),
|
|
375
|
+
description: z.string().nullable().default(""),
|
|
376
376
|
state: z.string(),
|
|
377
377
|
web_url: z.string(), // Changed from html_url to match GitLab API
|
|
378
378
|
});
|
|
@@ -381,7 +381,7 @@ export const GitLabIssueSchema = z.object({
|
|
|
381
381
|
iid: z.number(), // Added to match GitLab API
|
|
382
382
|
project_id: z.number(), // Added to match GitLab API
|
|
383
383
|
title: z.string(),
|
|
384
|
-
description: z.string(), // Changed from body to match GitLab API
|
|
384
|
+
description: z.string().nullable().default(""), // Changed from body to match GitLab API
|
|
385
385
|
state: z.string(),
|
|
386
386
|
author: GitLabUserSchema,
|
|
387
387
|
assignees: z.array(GitLabUserSchema),
|
|
@@ -765,6 +765,87 @@ export const ListIssuesSchema = z.object({
|
|
|
765
765
|
page: z.number().optional().describe("Page number for pagination"),
|
|
766
766
|
per_page: z.number().optional().describe("Number of items per page"),
|
|
767
767
|
});
|
|
768
|
+
// Merge Requests API operation schemas
|
|
769
|
+
export const ListMergeRequestsSchema = z.object({
|
|
770
|
+
project_id: z.string().describe("Project ID or URL-encoded path"),
|
|
771
|
+
assignee_id: z
|
|
772
|
+
.number()
|
|
773
|
+
.optional()
|
|
774
|
+
.describe("Returns merge requests assigned to the given user ID"),
|
|
775
|
+
assignee_username: z
|
|
776
|
+
.string()
|
|
777
|
+
.optional()
|
|
778
|
+
.describe("Returns merge requests assigned to the given username"),
|
|
779
|
+
author_id: z
|
|
780
|
+
.number()
|
|
781
|
+
.optional()
|
|
782
|
+
.describe("Returns merge requests created by the given user ID"),
|
|
783
|
+
author_username: z
|
|
784
|
+
.string()
|
|
785
|
+
.optional()
|
|
786
|
+
.describe("Returns merge requests created by the given username"),
|
|
787
|
+
reviewer_id: z
|
|
788
|
+
.number()
|
|
789
|
+
.optional()
|
|
790
|
+
.describe("Returns merge requests which have the user as a reviewer"),
|
|
791
|
+
reviewer_username: z
|
|
792
|
+
.string()
|
|
793
|
+
.optional()
|
|
794
|
+
.describe("Returns merge requests which have the user as a reviewer"),
|
|
795
|
+
created_after: z
|
|
796
|
+
.string()
|
|
797
|
+
.optional()
|
|
798
|
+
.describe("Return merge requests created after the given time"),
|
|
799
|
+
created_before: z
|
|
800
|
+
.string()
|
|
801
|
+
.optional()
|
|
802
|
+
.describe("Return merge requests created before the given time"),
|
|
803
|
+
updated_after: z
|
|
804
|
+
.string()
|
|
805
|
+
.optional()
|
|
806
|
+
.describe("Return merge requests updated after the given time"),
|
|
807
|
+
updated_before: z
|
|
808
|
+
.string()
|
|
809
|
+
.optional()
|
|
810
|
+
.describe("Return merge requests updated before the given time"),
|
|
811
|
+
labels: z.array(z.string()).optional().describe("Array of label names"),
|
|
812
|
+
milestone: z.string().optional().describe("Milestone title"),
|
|
813
|
+
scope: z
|
|
814
|
+
.enum(["created_by_me", "assigned_to_me", "all"])
|
|
815
|
+
.optional()
|
|
816
|
+
.describe("Return merge requests from a specific scope"),
|
|
817
|
+
search: z.string().optional().describe("Search for specific terms"),
|
|
818
|
+
state: z
|
|
819
|
+
.enum(["opened", "closed", "locked", "merged", "all"])
|
|
820
|
+
.optional()
|
|
821
|
+
.describe("Return merge requests with a specific state"),
|
|
822
|
+
order_by: z
|
|
823
|
+
.enum(["created_at", "updated_at", "priority", "label_priority", "milestone_due", "popularity"])
|
|
824
|
+
.optional()
|
|
825
|
+
.describe("Return merge requests ordered by the given field"),
|
|
826
|
+
sort: z
|
|
827
|
+
.enum(["asc", "desc"])
|
|
828
|
+
.optional()
|
|
829
|
+
.describe("Return merge requests sorted in ascending or descending order"),
|
|
830
|
+
target_branch: z
|
|
831
|
+
.string()
|
|
832
|
+
.optional()
|
|
833
|
+
.describe("Return merge requests targeting a specific branch"),
|
|
834
|
+
source_branch: z
|
|
835
|
+
.string()
|
|
836
|
+
.optional()
|
|
837
|
+
.describe("Return merge requests from a specific source branch"),
|
|
838
|
+
wip: z
|
|
839
|
+
.enum(["yes", "no"])
|
|
840
|
+
.optional()
|
|
841
|
+
.describe("Filter merge requests against their wip status"),
|
|
842
|
+
with_labels_details: z
|
|
843
|
+
.boolean()
|
|
844
|
+
.optional()
|
|
845
|
+
.describe("Return more details for each label"),
|
|
846
|
+
page: z.number().optional().describe("Page number for pagination"),
|
|
847
|
+
per_page: z.number().optional().describe("Number of items per page"),
|
|
848
|
+
});
|
|
768
849
|
export const GetIssueSchema = z.object({
|
|
769
850
|
project_id: z.string().describe("Project ID or URL-encoded path"),
|
|
770
851
|
issue_iid: z.number().describe("The internal ID of the project issue"),
|