@productbrain/mcp 0.0.1-beta.9539 → 0.0.1-beta.9562

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-J5MP5CNG.js";
5
+ } from "./chunk-QJ6KOXG6.js";
6
6
  import {
7
7
  DEFAULT_CLOUD_URL,
8
8
  apiKeysUrl,
@@ -299,6 +299,15 @@ function checkRegistrationRedirects(redirectUris, allowlist) {
299
299
  }
300
300
 
301
301
  // src/lib/oauthAuthCode.ts
302
+ function normalisePastedKey(raw) {
303
+ if (typeof raw !== "string") return "";
304
+ const trimmed = raw.trim();
305
+ const first = trimmed[0];
306
+ if (trimmed.length >= 2 && (first === '"' || first === "'" || first === "`") && trimmed.endsWith(first)) {
307
+ return trimmed.slice(1, -1).trim();
308
+ }
309
+ return trimmed;
310
+ }
302
311
  function pendingCodeRefusal(pending, redirectUri, now) {
303
312
  if (!pending) return "unknown_code";
304
313
  if (pending.redirectUri !== redirectUri) return "redirect_mismatch";
@@ -939,7 +948,6 @@ ${cmdScript}
939
948
  e.preventDefault();
940
949
  var v=k.value.trim();
941
950
  if(!v){iw.classList.add('has-error');hint.classList.add('is-error');hint.textContent='Paste your key first';hint.removeAttribute('hidden');return}
942
- if(v.indexOf('pb_sk_')!==0){iw.classList.add('has-error');hint.classList.add('is-error');hint.textContent='Key must start with pb_sk_';hint.removeAttribute('hidden');return}
943
951
  sb.disabled=true;bt.textContent='Verifying';
944
952
  show(pVerify);
945
953
 
@@ -1018,7 +1026,8 @@ app.post(
1018
1026
  authLimiter,
1019
1027
  express.urlencoded({ extended: false }),
1020
1028
  async (req, res) => {
1021
- const { api_key, redirect_uri, code_challenge, code_challenge_method, state, client_id } = req.body;
1029
+ const { redirect_uri, code_challenge, code_challenge_method, state, client_id } = req.body;
1030
+ const api_key = normalisePastedKey(req.body.api_key);
1022
1031
  const wantsJson = String(req.headers["accept"] ?? "").includes("application/json");
1023
1032
  const retryParams = new URLSearchParams({
1024
1033
  redirect_uri: redirect_uri ?? "",
@@ -1035,7 +1044,7 @@ app.post(
1035
1044
  res.status(status).type("html").send(authorizeErrorPage(title, trustedDetailHtml, retryUrl));
1036
1045
  }
1037
1046
  }
1038
- if (!api_key?.startsWith("pb_sk_")) {
1047
+ if (!api_key.startsWith("pb_sk_")) {
1039
1048
  sendError(
1040
1049
  "Invalid key format",
1041
1050
  "API keys start with <code>pb_sk_</code>. Check your key and try again."