@zereight/mcp-gitlab 2.3.23-next.212 → 2.3.23-next.214

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
@@ -4,6 +4,7 @@
4
4
  [![npm downloads](https://badgen.net/npm/dm/@zereight/mcp-gitlab)](https://www.npmjs.com/package/@zereight/mcp-gitlab)
5
5
  [![npm](https://img.shields.io/npm/v/@zereight/mcp-gitlab.svg)](https://www.npmjs.com/package/@zereight/mcp-gitlab)
6
6
  [![GitHub License](https://badgen.net/github/license/zereight/gitlab-mcp)](https://github.com/zereight/gitlab-mcp/blob/main/LICENSE)
7
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/zereight/gitlab-mcp/badge)](https://scorecard.dev/viewer/?uri=github.com/zereight/gitlab-mcp)
7
8
  [![Ask DeepWiki](https://img.shields.io/badge/DeepWiki-Ask-blue)](https://deepwiki.com/zereight/gitlab-mcp)
8
9
  [![MCP Toplist](https://mcptoplist.com/badge/io.github.zereight%2Fgitlab-mcp.svg)](https://mcptoplist.com/server/io.github.zereight%2Fgitlab-mcp)
9
10
  [![mcpindex](https://mcpindex.ai/api/v1/badge/io-github-zereight-gitlab-mcp)](https://mcpindex.ai/server/io-github-zereight-gitlab-mcp)
package/build/index.js CHANGED
@@ -4528,22 +4528,72 @@ async function getMergeRequestApprovalState(projectId, mergeRequestIid) {
4528
4528
  source_endpoint: "approval_state",
4529
4529
  };
4530
4530
  }
4531
+ // `conflictStatus` and `conflictFiles` are experimental fields (GitLab 19.4+); an
4532
+ // instance that lacks them answers with a validation error naming exactly these
4533
+ // fields, which getMergeRequestConflicts retries without.
4534
+ const EXPERIMENTAL_CONFLICT_FIELDS = new Set(["conflictStatus", "conflictFiles"]);
4535
+ function isUnsupportedConflictFieldsError(message) {
4536
+ const fields = [...message.matchAll(/Field '(\w+)' doesn't exist on type 'MergeRequest'/g)].map(match => match[1]);
4537
+ return fields.length > 0 && fields.every(field => EXPERIMENTAL_CONFLICT_FIELDS.has(field));
4538
+ }
4531
4539
  /**
4532
- * Get the conflicts of a merge request
4540
+ * Get the conflicts of a merge request.
4541
+ *
4542
+ * There is no REST endpoint for this; GitLab only exposes conflict data over
4543
+ * GraphQL. `conflicts` (a boolean) is stable, while `conflictStatus` and
4544
+ * `conflictFiles` are experimental (GitLab 19.4+), so instances that lack them
4545
+ * are retried with just `conflicts`.
4533
4546
  *
4534
4547
  * @param {string} projectId - The ID or URL-encoded path of the project
4535
4548
  * @param {string | number} mergeRequestIid - The internal ID of the merge request
4536
4549
  * @returns {Promise<Record<string, unknown>>} The merge request conflicts
4537
4550
  */
4538
4551
  async function getMergeRequestConflicts(projectId, mergeRequestIid) {
4539
- projectId = decodeURIComponent(projectId);
4540
- const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/merge_requests/${encodeGitLabPathSegment(mergeRequestIid)}/conflicts`);
4541
- const response = await fetch(url.toString(), {
4542
- ...getFetchConfig(),
4543
- method: "GET",
4544
- });
4545
- await handleGitLabError(response);
4546
- return (await response.json());
4552
+ const fullPath = await resolveProjectFullPath(projectId);
4553
+ const variables = { fullPath, iid: String(mergeRequestIid) };
4554
+ let data;
4555
+ try {
4556
+ data = await executeGraphQL(`query getMergeRequestConflicts($fullPath: ID!, $iid: String!) {
4557
+ project(fullPath: $fullPath) {
4558
+ mergeRequest(iid: $iid) {
4559
+ conflicts
4560
+ conflictStatus
4561
+ conflictFiles {
4562
+ ourPath
4563
+ theirPath
4564
+ content
4565
+ }
4566
+ }
4567
+ }
4568
+ }`, variables);
4569
+ }
4570
+ catch (error) {
4571
+ if (!(error instanceof Error) || !isUnsupportedConflictFieldsError(error.message)) {
4572
+ throw error;
4573
+ }
4574
+ data = await executeGraphQL(`query getMergeRequestConflicts($fullPath: ID!, $iid: String!) {
4575
+ project(fullPath: $fullPath) {
4576
+ mergeRequest(iid: $iid) {
4577
+ conflicts
4578
+ }
4579
+ }
4580
+ }`, variables);
4581
+ }
4582
+ if (!data.project) {
4583
+ throw new Error(`Project not found or not accessible: ${fullPath}`);
4584
+ }
4585
+ if (!data.project.mergeRequest) {
4586
+ throw new Error(`Merge request !${mergeRequestIid} not found in project ${fullPath}`);
4587
+ }
4588
+ const { conflicts, conflictStatus, conflictFiles } = data.project.mergeRequest;
4589
+ const result = { has_conflicts: conflicts };
4590
+ if (conflictStatus !== undefined) {
4591
+ result.conflict_status = conflictStatus;
4592
+ }
4593
+ if (conflictFiles !== undefined) {
4594
+ result.conflict_files = conflictFiles;
4595
+ }
4596
+ return result;
4547
4597
  }
4548
4598
  async function getMergeRequestApprovalsFallback(projectId, mergeRequestIid) {
4549
4599
  const approvalsUrl = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/merge_requests/${encodeGitLabPathSegment(mergeRequestIid)}/approvals`);
package/build/schemas.js CHANGED
@@ -2501,7 +2501,10 @@ export const ListIssuesSchema = z
2501
2501
  created_before: z.string().optional().describe("Created before"),
2502
2502
  due_date: z.string().optional().describe("Due date"),
2503
2503
  labels: coerceStringArray.optional().describe("Label names"),
2504
- milestone: z.string().optional().describe("Milestone title"),
2504
+ milestone: z
2505
+ .string()
2506
+ .optional()
2507
+ .describe("Exact milestone title, not an ID; None for no milestone, Any for any milestone. For a milestone ID, use get_milestone_issue or get_group_milestone_issue (milestones toolset); the group tool omits subgroup issues."),
2505
2508
  issue_type: z
2506
2509
  .enum(["issue", "incident", "test_case", "task"])
2507
2510
  .optional()
@@ -3179,7 +3182,9 @@ export const ListProjectMilestonesSchema = ProjectParamsSchema.extend({
3179
3182
  }).merge(PaginationOptionsSchema);
3180
3183
  // Schema for getting a single milestone
3181
3184
  export const GetProjectMilestoneSchema = ProjectParamsSchema.extend({
3182
- milestone_id: z.coerce.string().describe("The ID of a project milestone"),
3185
+ milestone_id: z.coerce
3186
+ .string()
3187
+ .describe("Project milestone id (not iid, the number in its web URL). list_milestones returns both."),
3183
3188
  });
3184
3189
  // Schema for creating a new milestone
3185
3190
  export const CreateProjectMilestoneSchema = ProjectParamsSchema.extend({
@@ -3243,7 +3248,9 @@ export const ListGroupMilestonesSchema = z
3243
3248
  .merge(PaginationOptionsSchema);
3244
3249
  export const GetGroupMilestoneSchema = z.object({
3245
3250
  group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
3246
- milestone_id: z.coerce.string().describe("The ID of a group milestone"),
3251
+ milestone_id: z.coerce
3252
+ .string()
3253
+ .describe("Group milestone id (not iid, the number in its web URL). list_group_milestones returns both."),
3247
3254
  });
3248
3255
  export const CreateGroupMilestoneSchema = z.object({
3249
3256
  group_id: z.coerce.string().describe("Group ID or URL-encoded path"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.23-next.212",
3
+ "version": "2.3.23-next.214",
4
4
  "mcpName": "io.github.zereight/gitlab-mcp",
5
5
  "description": "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more",
6
6
  "keywords": [