@zereight/mcp-gitlab 2.3.15-next.178 → 2.3.15-next.179

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/build/index.js CHANGED
@@ -536,6 +536,7 @@ function createServer() {
536
536
  error instanceof ProjectAccessDeniedError;
537
537
  const safeError = logError(error);
538
538
  if (isRecoverableToolError) {
539
+ const meta = safeError instanceof GitLabApiError ? gitLabApiErrorMetadata(safeError) : undefined;
539
540
  return {
540
541
  content: [
541
542
  {
@@ -544,6 +545,7 @@ function createServer() {
544
545
  },
545
546
  ],
546
547
  isError: true,
548
+ ...(meta ? { _meta: { "io.github.zereight.gitlab-mcp/http-error": meta } } : {}),
547
549
  };
548
550
  }
549
551
  throw safeError;
@@ -1292,10 +1294,41 @@ if (!isCliInvocation(process.argv) &&
1292
1294
  exitAfterFlush(1);
1293
1295
  }
1294
1296
  class GitLabApiError extends Error {
1295
- constructor(message) {
1297
+ /** HTTP status of the GitLab response this error describes, when there was one. */
1298
+ status;
1299
+ /** GitLab's Retry-After delay in seconds, forwarded unchanged when present. */
1300
+ retryAfter;
1301
+ /**
1302
+ * @param message - The error text shown in the tool result.
1303
+ * @param response - The GitLab response the error describes; supplies status
1304
+ * and Retry-After when given.
1305
+ */
1306
+ constructor(message, response) {
1296
1307
  super(message);
1297
1308
  this.name = "GitLabApiError";
1309
+ if (response) {
1310
+ this.status = response.status;
1311
+ this.retryAfter = response.headers.get("retry-after") ?? undefined;
1312
+ }
1313
+ }
1314
+ }
1315
+ /**
1316
+ * Out-of-band HTTP metadata for an error result. Keep it separate from
1317
+ * structuredContent so clients preserve the error text and do not validate
1318
+ * this metadata against a tool's output schema.
1319
+ */
1320
+ function gitLabApiErrorMetadata(error) {
1321
+ if (error.status === undefined && error.retryAfter === undefined) {
1322
+ return undefined;
1323
+ }
1324
+ const meta = {};
1325
+ if (error.status !== undefined) {
1326
+ meta.status = error.status;
1327
+ }
1328
+ if (error.retryAfter !== undefined) {
1329
+ meta.retryAfter = error.retryAfter;
1298
1330
  }
1331
+ return meta;
1299
1332
  }
1300
1333
  class ToolInputError extends Error {
1301
1334
  constructor(message) {
@@ -1326,12 +1359,12 @@ async function handleGitLabError(response) {
1326
1359
  // before the common tool-call boundary returns/logs it.
1327
1360
  logger.error("GitLab API Rate Limit Exceeded");
1328
1361
  logger.error("User API Key Rate limit exceeded. Please try again later.");
1329
- const error = new GitLabApiError(appendRecoveryHint(`GitLab API Rate Limit Exceeded: ${errorBody}`));
1362
+ const error = new GitLabApiError(appendRecoveryHint(`GitLab API Rate Limit Exceeded: ${errorBody}`), response);
1330
1363
  throw error;
1331
1364
  }
1332
1365
  else {
1333
1366
  // Handle other API errors
1334
- const error = new GitLabApiError(appendRecoveryHint(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`));
1367
+ const error = new GitLabApiError(appendRecoveryHint(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`), response);
1335
1368
  throw error;
1336
1369
  }
1337
1370
  }
@@ -1358,7 +1391,7 @@ async function throwUserApiScopeErrorUnlessRateLimitedAsync(response) {
1358
1391
  if (isGitLabUserApiRateLimitBody(errorBody) || !isGitLabInsufficientUserScopeBody(errorBody)) {
1359
1392
  return;
1360
1393
  }
1361
- throw new GitLabApiError(USER_API_INSUFFICIENT_SCOPE_MESSAGE);
1394
+ throw new GitLabApiError(USER_API_INSUFFICIENT_SCOPE_MESSAGE, response);
1362
1395
  }
1363
1396
  async function authenticateWithJobTokenFallbackAsync(response) {
1364
1397
  if (response.ok ||
@@ -1430,7 +1463,7 @@ async function forkProject(projectId, namespace) {
1430
1463
  });
1431
1464
  // Handle case where project already exists
1432
1465
  if (response.status === 409) {
1433
- throw new GitLabApiError("Project already exists in the target namespace");
1466
+ throw new GitLabApiError("Project already exists in the target namespace", response);
1434
1467
  }
1435
1468
  await handleGitLabError(response);
1436
1469
  const data = await response.json();
@@ -1501,7 +1534,7 @@ async function getFileContents(projectId, filePath, ref) {
1501
1534
  });
1502
1535
  // Handle file not found
1503
1536
  if (response.status === 404) {
1504
- throw new GitLabApiError(`File not found: ${filePath}`);
1537
+ throw new GitLabApiError(`File not found: ${filePath}`, response);
1505
1538
  }
1506
1539
  await handleGitLabError(response);
1507
1540
  const data = await response.json();
@@ -1534,7 +1567,7 @@ async function createIssue(projectId, options) {
1534
1567
  // Handle bad request
1535
1568
  if (response.status === 400) {
1536
1569
  const errorBody = await response.text();
1537
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
1570
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
1538
1571
  }
1539
1572
  await handleGitLabError(response);
1540
1573
  const data = await response.json();
@@ -1770,7 +1803,7 @@ async function executeGraphQL(query, variables = {}) {
1770
1803
  });
1771
1804
  if (!response.ok) {
1772
1805
  const errorBody = await response.text();
1773
- throw new GitLabApiError(`GraphQL request failed (${response.status}): ${errorBody}`);
1806
+ throw new GitLabApiError(`GraphQL request failed (${response.status}): ${errorBody}`, response);
1774
1807
  }
1775
1808
  const json = await response.json();
1776
1809
  if (json.errors && json.errors.length > 0) {
@@ -3270,11 +3303,11 @@ async function createMergeRequest(projectId, options) {
3270
3303
  });
3271
3304
  if (response.status === 400) {
3272
3305
  const errorBody = await response.text();
3273
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
3306
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
3274
3307
  }
3275
3308
  if (!response.ok) {
3276
3309
  const errorBody = await response.text();
3277
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3310
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3278
3311
  }
3279
3312
  const data = await response.json();
3280
3313
  return GitLabMergeRequestSchema.parse(data);
@@ -3362,7 +3395,7 @@ async function deleteMergeRequestDiscussionNote(projectId, mergeRequestIid, disc
3362
3395
  });
3363
3396
  if (!response.ok) {
3364
3397
  const errorText = await response.text();
3365
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
3398
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
3366
3399
  }
3367
3400
  }
3368
3401
  /**
@@ -3524,7 +3557,7 @@ async function deleteMergeRequestNote(projectId, mergeRequestIid, noteId) {
3524
3557
  });
3525
3558
  if (!response.ok) {
3526
3559
  const errorText = await response.text();
3527
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
3560
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
3528
3561
  }
3529
3562
  }
3530
3563
  // --- Emoji Reactions (REST) ---
@@ -3695,7 +3728,7 @@ async function createOrUpdateFile(projectId, filePath, content, commitMessage, b
3695
3728
  });
3696
3729
  if (!response.ok) {
3697
3730
  const errorBody = await response.text();
3698
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3731
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3699
3732
  }
3700
3733
  const data = await response.json();
3701
3734
  return GitLabCreateUpdateFileResponseSchema.parse(data);
@@ -3724,11 +3757,11 @@ async function createCommit(projectId, message, branch, actions) {
3724
3757
  });
3725
3758
  if (response.status === 400) {
3726
3759
  const errorBody = await response.text();
3727
- throw new GitLabApiError(`Invalid request: ${errorBody}`);
3760
+ throw new GitLabApiError(`Invalid request: ${errorBody}`, response);
3728
3761
  }
3729
3762
  if (!response.ok) {
3730
3763
  const errorBody = await response.text();
3731
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3764
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3732
3765
  }
3733
3766
  const data = await response.json();
3734
3767
  return GitLabCommitSchema.parse(data);
@@ -3754,7 +3787,7 @@ async function searchProjects(query, page = 1, perPage = 20) {
3754
3787
  });
3755
3788
  if (!response.ok) {
3756
3789
  const errorBody = await response.text();
3757
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3790
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3758
3791
  }
3759
3792
  const unfiltered = (await response.json());
3760
3793
  const projects = filterProjectsByAllowlist(unfiltered);
@@ -3841,7 +3874,7 @@ async function createRepository(options) {
3841
3874
  });
3842
3875
  if (!response.ok) {
3843
3876
  const errorBody = await response.text();
3844
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
3877
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
3845
3878
  }
3846
3879
  const data = await response.json();
3847
3880
  return GitLabRepositorySchema.parse(data);
@@ -4215,7 +4248,7 @@ async function getBranchDiffs(projectId, from, to, straight) {
4215
4248
  });
4216
4249
  if (!response.ok) {
4217
4250
  const errorBody = await response.text();
4218
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
4251
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`, response);
4219
4252
  }
4220
4253
  const data = await response.json();
4221
4254
  return GitLabCompareResultSchema.parse(data);
@@ -4456,7 +4489,7 @@ noteableIid, body) {
4456
4489
  });
4457
4490
  if (!response.ok) {
4458
4491
  const errorText = await response.text();
4459
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4492
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4460
4493
  }
4461
4494
  return await response.json();
4462
4495
  }
@@ -4471,7 +4504,7 @@ async function getDraftNote(project_id, merge_request_iid, draft_note_id) {
4471
4504
  const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/merge_requests/${encodeGitLabPathSegment(merge_request_iid)}/draft_notes/${encodeGitLabPathSegment(draft_note_id)}`, { ...getFetchConfig() });
4472
4505
  if (!response.ok) {
4473
4506
  const errorText = await response.text();
4474
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4507
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4475
4508
  }
4476
4509
  const data = await response.json();
4477
4510
  return GitLabDraftNoteSchema.parse(data);
@@ -4485,7 +4518,7 @@ async function listDraftNotes(projectId, mergeRequestIid) {
4485
4518
  });
4486
4519
  if (!response.ok) {
4487
4520
  const errorText = await response.text();
4488
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4521
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4489
4522
  }
4490
4523
  const data = await response.json();
4491
4524
  return z.array(GitLabDraftNoteSchema).parse(data);
@@ -4520,7 +4553,7 @@ async function createDraftNote(projectId, mergeRequestIid, body, inReplyToDiscus
4520
4553
  });
4521
4554
  if (!response.ok) {
4522
4555
  const errorText = await response.text();
4523
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4556
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4524
4557
  }
4525
4558
  const data = await response.json();
4526
4559
  return GitLabDraftNoteSchema.parse(data);
@@ -4555,7 +4588,7 @@ async function updateDraftNote(projectId, mergeRequestIid, draftNoteId, body, po
4555
4588
  });
4556
4589
  if (!response.ok) {
4557
4590
  const errorText = await response.text();
4558
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4591
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4559
4592
  }
4560
4593
  const data = await response.json();
4561
4594
  return GitLabDraftNoteSchema.parse(data);
@@ -4576,7 +4609,7 @@ async function deleteDraftNote(projectId, mergeRequestIid, draftNoteId) {
4576
4609
  });
4577
4610
  if (!response.ok) {
4578
4611
  const errorText = await response.text();
4579
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4612
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4580
4613
  }
4581
4614
  }
4582
4615
  /**
@@ -4595,7 +4628,7 @@ async function publishDraftNote(projectId, mergeRequestIid, draftNoteId) {
4595
4628
  });
4596
4629
  if (!response.ok) {
4597
4630
  const errorText = await response.text();
4598
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4631
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4599
4632
  }
4600
4633
  // Handle empty response (204 No Content) or successful response
4601
4634
  const responseText = await response.text();
@@ -4698,7 +4731,7 @@ async function bulkPublishDraftNotes(projectId, mergeRequestIid, options = {}) {
4698
4731
  });
4699
4732
  if (!response.ok) {
4700
4733
  const errorText = await response.text();
4701
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4734
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4702
4735
  }
4703
4736
  // Handle empty response (204 No Content) or successful response
4704
4737
  const responseText = await response.text();
@@ -4729,7 +4762,7 @@ async function resolveMergeRequestThread(projectId, mergeRequestIid, discussionI
4729
4762
  });
4730
4763
  if (!response.ok) {
4731
4764
  const errorText = await response.text();
4732
- throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`);
4765
+ throw new GitLabApiError(`GitLab API error: ${response.status} ${response.statusText}\n${errorText}`, response);
4733
4766
  }
4734
4767
  }
4735
4768
  /**
@@ -5321,7 +5354,7 @@ async function getPipeline(projectId, pipelineId, signal) {
5321
5354
  signal,
5322
5355
  });
5323
5356
  if (response.status === 404) {
5324
- throw new GitLabApiError(`Pipeline not found`);
5357
+ throw new GitLabApiError(`Pipeline not found`, response);
5325
5358
  }
5326
5359
  await handleGitLabError(response);
5327
5360
  const data = await response.json();
@@ -5394,7 +5427,7 @@ async function getDeployment(projectId, deploymentId) {
5394
5427
  ...getFetchConfig(),
5395
5428
  });
5396
5429
  if (response.status === 404) {
5397
- throw new GitLabApiError(`Deployment not found`);
5430
+ throw new GitLabApiError(`Deployment not found`, response);
5398
5431
  }
5399
5432
  await handleGitLabError(response);
5400
5433
  const data = await response.json();
@@ -5447,7 +5480,7 @@ async function getEnvironment(projectId, environmentId) {
5447
5480
  ...getFetchConfig(),
5448
5481
  });
5449
5482
  if (response.status === 404) {
5450
- throw new GitLabApiError(`Environment not found`);
5483
+ throw new GitLabApiError(`Environment not found`, response);
5451
5484
  }
5452
5485
  await handleGitLabError(response);
5453
5486
  const data = await response.json();
@@ -5570,7 +5603,7 @@ async function getRunner(runnerId, projectId) {
5570
5603
  ...getFetchConfig(),
5571
5604
  });
5572
5605
  if (response.status === 404) {
5573
- throw new GitLabApiError("Runner not found");
5606
+ throw new GitLabApiError("Runner not found", response);
5574
5607
  }
5575
5608
  await handleGitLabError(response);
5576
5609
  const details = redactSensitiveGitLabFields(await response.json());
@@ -5634,7 +5667,7 @@ async function listPipelineJobs(projectId, pipelineId, options = {}) {
5634
5667
  ...getFetchConfig(),
5635
5668
  });
5636
5669
  if (response.status === 404) {
5637
- throw new GitLabApiError(`Pipeline not found`);
5670
+ throw new GitLabApiError(`Pipeline not found`, response);
5638
5671
  }
5639
5672
  await handleGitLabError(response);
5640
5673
  const data = await response.json();
@@ -5657,7 +5690,7 @@ async function listPipelineTriggerJobs(projectId, pipelineId, options = {}) {
5657
5690
  ...getFetchConfig(),
5658
5691
  });
5659
5692
  if (response.status === 404) {
5660
- throw new GitLabApiError(`Pipeline not found`);
5693
+ throw new GitLabApiError(`Pipeline not found`, response);
5661
5694
  }
5662
5695
  await handleGitLabError(response);
5663
5696
  const data = await response.json();
@@ -5671,7 +5704,7 @@ async function getPipelineJob(projectId, jobId, signal) {
5671
5704
  signal,
5672
5705
  });
5673
5706
  if (response.status === 404) {
5674
- throw new GitLabApiError(`Job not found`);
5707
+ throw new GitLabApiError(`Job not found`, response);
5675
5708
  }
5676
5709
  await handleGitLabError(response);
5677
5710
  const data = await response.json();
@@ -5695,7 +5728,7 @@ async function getPipelineJobOutput(projectId, jobId, query = {}) {
5695
5728
  },
5696
5729
  });
5697
5730
  if (response.status === 404) {
5698
- throw new GitLabApiError(`Job trace not found or job is not finished yet`);
5731
+ throw new GitLabApiError(`Job trace not found or job is not finished yet`, response);
5699
5732
  }
5700
5733
  await handleGitLabError(response);
5701
5734
  const pattern = query.pattern;
@@ -5784,7 +5817,7 @@ async function listJobArtifacts(projectId, jobId, options = {}) {
5784
5817
  ...getFetchConfig(),
5785
5818
  });
5786
5819
  if (response.status === 404) {
5787
- throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`);
5820
+ throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`, response);
5788
5821
  }
5789
5822
  await handleGitLabError(response);
5790
5823
  const data = await response.json();
@@ -5804,7 +5837,7 @@ async function downloadJobArtifacts(projectId, jobId, localPath) {
5804
5837
  const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/jobs/${encodeGitLabPathSegment(jobId)}/artifacts`);
5805
5838
  const response = await fetchWithValidatedRedirects(url.toString(), downloadRedirectOptions());
5806
5839
  if (response.status === 404) {
5807
- throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`);
5840
+ throw new GitLabApiError(`Job artifacts not found. The job may not have produced artifacts or the job ID is invalid.`, response);
5808
5841
  }
5809
5842
  await handleGitLabError(response);
5810
5843
  const filename = `artifacts_job_${encodeGitLabPathSegment(jobId)}.zip`;
@@ -5838,7 +5871,7 @@ async function getJobArtifactFile(projectId, jobId, artifactPath) {
5838
5871
  const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/jobs/${encodeGitLabPathSegment(jobId)}/artifacts/${encodedArtifactPath}`);
5839
5872
  const response = await fetchWithValidatedRedirects(url.toString(), downloadRedirectOptions());
5840
5873
  if (response.status === 404) {
5841
- throw new GitLabApiError(`Artifact file not found: ${artifactPath}`);
5874
+ throw new GitLabApiError(`Artifact file not found: ${artifactPath}`, response);
5842
5875
  }
5843
5876
  await handleGitLabError(response);
5844
5877
  return await response.text();
@@ -6314,10 +6347,10 @@ async function getRepositoryTree(options) {
6314
6347
  queryParams.append("pagination", options.pagination);
6315
6348
  const response = await fetch(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(options.project_id))}/repository/tree?${queryParams.toString()}`, { ...getFetchConfig() });
6316
6349
  if (response.status === 404) {
6317
- throw new GitLabApiError("Repository or path not found");
6350
+ throw new GitLabApiError("Repository or path not found", response);
6318
6351
  }
6319
6352
  if (!response.ok) {
6320
- throw new GitLabApiError(`Failed to get repository tree: ${response.statusText}`);
6353
+ throw new GitLabApiError(`Failed to get repository tree: ${response.statusText}`, response);
6321
6354
  }
6322
6355
  const data = await response.json();
6323
6356
  const items = z.array(GitLabTreeItemSchema).parse(data);
@@ -8253,7 +8286,11 @@ async function handleToolCall(params) {
8253
8286
  throw new ToolInputError(error.message);
8254
8287
  }
8255
8288
  if (error instanceof GitLabApiRequestHttpError) {
8256
- throw new GitLabApiError(error.message);
8289
+ // Carry the HTTP fields (status, Retry-After) into the tool error result.
8290
+ const apiError = new GitLabApiError(error.message);
8291
+ apiError.status = error.status;
8292
+ apiError.retryAfter = error.retryAfter;
8293
+ throw apiError;
8257
8294
  }
8258
8295
  throw error;
8259
8296
  }
@@ -34,9 +34,22 @@ export class GitLabApiRequestInputError extends Error {
34
34
  }
35
35
  }
36
36
  export class GitLabApiRequestHttpError extends Error {
37
- constructor(message) {
37
+ /** HTTP status of the GitLab response, when the error came from one. */
38
+ status;
39
+ /** GitLab's Retry-After delay in seconds, forwarded unchanged when present. */
40
+ retryAfter;
41
+ /**
42
+ * @param message - The error text shown in the tool result.
43
+ * @param response - The GitLab response the error describes; supplies status
44
+ * and Retry-After when given.
45
+ */
46
+ constructor(message, response) {
38
47
  super(message);
39
48
  this.name = "GitLabApiRequestHttpError";
49
+ if (response) {
50
+ this.status = response.status;
51
+ this.retryAfter = response.headers.get("retry-after") ?? undefined;
52
+ }
40
53
  }
41
54
  }
42
55
  const REQUEST_TIMEOUT_MS = 45_000;
@@ -253,7 +266,7 @@ export async function executeGitLabApiRequestAsync(input) {
253
266
  });
254
267
  const rawBody = await response.text();
255
268
  if (!response.ok) {
256
- throw new GitLabApiRequestHttpError(formatHttpError(response.status, response.statusText, rawBody));
269
+ throw new GitLabApiRequestHttpError(formatHttpError(response.status, response.statusText, rawBody), response);
257
270
  }
258
271
  return { content: [{ type: "text", text: formatSuccessBody(rawBody) }] };
259
272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.15-next.178",
3
+ "version": "2.3.15-next.179",
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": [