@productbrain/mcp 0.0.1-beta.2203 → 0.0.1-beta.2208

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/dist/http.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SERVER_VERSION,
3
3
  createProductBrainServer,
4
4
  initFeatureFlags
5
- } from "./chunk-WM3GBWEF.js";
5
+ } from "./chunk-OD5YVZBQ.js";
6
6
  import {
7
7
  DEFAULT_CLOUD_URL,
8
8
  bootstrapHttp,
@@ -1035,6 +1035,7 @@ app.post(
1035
1035
  const candidates = [primaryUrl, ...fallbackUrls];
1036
1036
  let foundUrl;
1037
1037
  let anyDefinitiveReject = false;
1038
+ let rateLimitedRetryAfter;
1038
1039
  for (const url2 of candidates) {
1039
1040
  let checkData = null;
1040
1041
  try {
@@ -1052,9 +1053,21 @@ app.post(
1052
1053
  foundUrl = checkData.deploymentUrl ?? url2;
1053
1054
  break;
1054
1055
  }
1056
+ if (checkData.error === "rate_limited") {
1057
+ rateLimitedRetryAfter = checkData.retryAfterSeconds;
1058
+ continue;
1059
+ }
1055
1060
  anyDefinitiveReject = true;
1056
1061
  }
1057
1062
  if (!foundUrl) {
1063
+ if (rateLimitedRetryAfter != null && !anyDefinitiveReject) {
1064
+ sendError(
1065
+ "Rate limited",
1066
+ `This API key is valid but temporarily rate limited. Try again in ${rateLimitedRetryAfter}s.`,
1067
+ 429
1068
+ );
1069
+ return;
1070
+ }
1058
1071
  if (anyDefinitiveReject) {
1059
1072
  sendError(
1060
1073
  "Key not recognized",