@myspec/mcp-server 0.4.0-next.91 → 0.4.0-next.92

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.
Files changed (2) hide show
  1. package/dist/index.js +31 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1333,6 +1333,26 @@ var PlatformPreconditionRequiredError = class extends PlatformHttpError {
1333
1333
  this.name = "PlatformPreconditionRequiredError";
1334
1334
  }
1335
1335
  };
1336
+ var QUOTA_EXCEEDED_CODE = "quota_exceeded";
1337
+ var PlatformQuotaError = class extends PlatformHttpError {
1338
+ /** The platform's machine-readable code, e.g. `quota_exceeded`. */
1339
+ code;
1340
+ constructor(message, status, details, code) {
1341
+ super(message, status, details);
1342
+ this.name = "PlatformQuotaError";
1343
+ this.code = code;
1344
+ }
1345
+ };
1346
+ function isPlatformQuotaError(err) {
1347
+ if (statusOf(err) !== 429) {
1348
+ return false;
1349
+ }
1350
+ if (typeof err !== "object" || err === null) {
1351
+ return false;
1352
+ }
1353
+ const code = err.code;
1354
+ return typeof code === "string" && code.toLowerCase() === QUOTA_EXCEEDED_CODE;
1355
+ }
1336
1356
  function isPlatformHttpError(err) {
1337
1357
  return typeof err === "object" && err !== null && err[PLATFORM_ERROR_BRAND] === true;
1338
1358
  }
@@ -1409,13 +1429,16 @@ function toConflictDetails(details) {
1409
1429
  changedAt: stringField(details, "last_modified_at")
1410
1430
  };
1411
1431
  }
1412
- function createPlatformError(message, status, details) {
1432
+ function createPlatformError(message, status, details, code) {
1413
1433
  if (status === 409) {
1414
1434
  return new PlatformConflictError(message, status, details, toConflictDetails(details));
1415
1435
  }
1416
1436
  if (status === 428) {
1417
1437
  return new PlatformPreconditionRequiredError(message, details);
1418
1438
  }
1439
+ if (status === 429 && typeof code === "string" && code.toLowerCase() === QUOTA_EXCEEDED_CODE) {
1440
+ return new PlatformQuotaError(message, status, details, code.toLowerCase());
1441
+ }
1419
1442
  return new PlatformHttpError(message, status, details);
1420
1443
  }
1421
1444
  function truncate(text) {
@@ -1426,17 +1449,19 @@ async function throwFromResponse(response, fallbackMessage) {
1426
1449
  const rawBody = await response.text().catch(() => "");
1427
1450
  let message = fallbackMessage;
1428
1451
  let details;
1452
+ let code;
1429
1453
  if (rawBody) {
1430
1454
  try {
1431
1455
  const parsed = JSON.parse(rawBody);
1432
1456
  details = parsed.details;
1457
+ code = typeof parsed.error === "string" ? parsed.error : void 0;
1433
1458
  const suffix = details ? ` [details: ${JSON.stringify(details)}]` : "";
1434
1459
  message = truncate(parsed.message ?? rawBody) + suffix;
1435
1460
  } catch {
1436
1461
  message = truncate(rawBody);
1437
1462
  }
1438
1463
  }
1439
- throw createPlatformError(`HTTP ${response.status}: ${message}`, response.status, details);
1464
+ throw createPlatformError(`HTTP ${response.status}: ${message}`, response.status, details, code);
1440
1465
  }
1441
1466
 
1442
1467
  // ../../packages/shared/logger.ts
@@ -1644,6 +1669,10 @@ var BaseHttpClient = class {
1644
1669
  this.logger.debug("Retrying after abort/timeout", { error: error.message });
1645
1670
  return true;
1646
1671
  }
1672
+ if (isPlatformQuotaError(error)) {
1673
+ this.logger.debug("Not retrying quota rejection", { status: 429 });
1674
+ return false;
1675
+ }
1647
1676
  const httpError = error;
1648
1677
  if (httpError.status !== void 0) {
1649
1678
  const shouldRetry = RETRYABLE_STATUS_CODES.includes(httpError.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myspec/mcp-server",
3
- "version": "0.4.0-next.91",
3
+ "version": "0.4.0-next.92",
4
4
  "description": "MySpec MCP server — exposes MySpec platform projects, files and attachments to MCP-aware clients via OAuth-authenticated access tokens.",
5
5
  "type": "module",
6
6
  "repository": {