@carrierllc/mcp 0.13.17 → 0.13.18

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/cli.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  verifyStorefront,
40
40
  walletScreen,
41
41
  which
42
- } from "./chunk-SAZFMURF.js";
42
+ } from "./chunk-VXROP2SU.js";
43
43
  import {
44
44
  copyTree,
45
45
  exists,
package/dist/index.js CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  verifyStorefront,
81
81
  withOcsListSummary,
82
82
  withTemplateResellerId
83
- } from "./chunk-SAZFMURF.js";
83
+ } from "./chunk-VXROP2SU.js";
84
84
  import "./chunk-SHKKVIIA.js";
85
85
 
86
86
  // src/index.ts
@@ -6827,6 +6827,33 @@ function requireBinding(binding, tool, name, subject) {
6827
6827
  );
6828
6828
  }
6829
6829
 
6830
+ // src/stripe-headers.ts
6831
+ var STRIPE_API_VERSION = "2025-08-27.basil";
6832
+ function isStripeOrgKey(stripeKey) {
6833
+ return stripeKey.startsWith("sk_org_");
6834
+ }
6835
+ function stripeAccountHeaders(stripeKey, connectedAccountId, platformAccountId) {
6836
+ if (isStripeOrgKey(stripeKey)) {
6837
+ if (connectedAccountId) {
6838
+ return {
6839
+ "Stripe-Context": platformAccountId ? `${platformAccountId}/${connectedAccountId}` : connectedAccountId
6840
+ };
6841
+ }
6842
+ return platformAccountId ? { "Stripe-Context": platformAccountId } : {};
6843
+ }
6844
+ if (connectedAccountId) return { "Stripe-Account": connectedAccountId };
6845
+ return {};
6846
+ }
6847
+ function buildStripeHeaders(stripeKey, opts = {}) {
6848
+ const headers = {
6849
+ Authorization: `Bearer ${stripeKey}`,
6850
+ "Stripe-Version": STRIPE_API_VERSION,
6851
+ ...stripeAccountHeaders(stripeKey, opts.connectedAccountId, opts.platformAccountId)
6852
+ };
6853
+ if (opts.idempotencyKey) headers["Idempotency-Key"] = opts.idempotencyKey;
6854
+ return headers;
6855
+ }
6856
+
6830
6857
  // src/stripe-connect-tools.ts
6831
6858
  async function verifyConfirmToken(env, sub, toolName, token2) {
6832
6859
  requireBinding(
@@ -6861,23 +6888,21 @@ function err2(text) {
6861
6888
  return { isError: true, content: [{ type: "text", text }] };
6862
6889
  }
6863
6890
  async function stripeGet(stripeKey, path, connectedAccountId) {
6864
- const headers = {
6865
- Authorization: `Bearer ${stripeKey}`,
6866
- "Stripe-Version": "2025-08-27.basil"
6867
- };
6868
- if (connectedAccountId) headers["Stripe-Account"] = connectedAccountId;
6891
+ const headers = buildStripeHeaders(stripeKey, {
6892
+ connectedAccountId,
6893
+ platformAccountId: process.env.STRIPE_PLATFORM_ACCOUNT_ID
6894
+ });
6869
6895
  const res = await fetch(`https://api.stripe.com${path}`, { headers });
6870
6896
  const data = await res.json();
6871
6897
  return { ok: res.ok, status: res.status, data };
6872
6898
  }
6873
6899
  async function stripePost(stripeKey, path, params, connectedAccountId, idempotencyKey) {
6874
- const headers = {
6875
- Authorization: `Bearer ${stripeKey}`,
6876
- "Stripe-Version": "2025-08-27.basil",
6877
- "Content-Type": "application/x-www-form-urlencoded"
6878
- };
6879
- if (connectedAccountId) headers["Stripe-Account"] = connectedAccountId;
6880
- if (idempotencyKey) headers["Idempotency-Key"] = idempotencyKey;
6900
+ const headers = buildStripeHeaders(stripeKey, {
6901
+ connectedAccountId,
6902
+ platformAccountId: process.env.STRIPE_PLATFORM_ACCOUNT_ID,
6903
+ idempotencyKey
6904
+ });
6905
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
6881
6906
  const res = await fetch(`https://api.stripe.com${path}`, {
6882
6907
  method: "POST",
6883
6908
  headers,
@@ -6932,7 +6957,7 @@ function registerStripeConnectTools(server2, ctx) {
6932
6957
  const opKvKey = operator_id ? `stripe_account:${operator_id}` : kvKey;
6933
6958
  const start = Date.now();
6934
6959
  try {
6935
- const stripeKey = env.STRIPE_SECRET_KEY;
6960
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
6936
6961
  if (!stripeKey) return err2("Stripe not configured");
6937
6962
  const accountId = await env.CARRIER_USERS.get(opKvKey);
6938
6963
  if (!accountId) {
@@ -6985,7 +7010,7 @@ function registerStripeConnectTools(server2, ctx) {
6985
7010
  if (denied) return denied;
6986
7011
  const start = Date.now();
6987
7012
  try {
6988
- const stripeKey = env.STRIPE_SECRET_KEY;
7013
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
6989
7014
  if (!stripeKey) return err2("Stripe not configured");
6990
7015
  const accountId = await getAccountId();
6991
7016
  if (!accountId) return err2("No connected Stripe account found.");
@@ -7022,7 +7047,7 @@ function registerStripeConnectTools(server2, ctx) {
7022
7047
  if (denied) return denied;
7023
7048
  const start = Date.now();
7024
7049
  try {
7025
- const stripeKey = env.STRIPE_SECRET_KEY;
7050
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
7026
7051
  if (!stripeKey) return err2("Stripe not configured");
7027
7052
  const accountId = await getAccountId();
7028
7053
  if (!accountId) return err2("No connected Stripe account found.");
@@ -7079,7 +7104,7 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7079
7104
  return err2("Invalid or expired confirm_token. Call without token to get a new one.");
7080
7105
  }
7081
7106
  try {
7082
- const stripeKey = env.STRIPE_SECRET_KEY;
7107
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
7083
7108
  if (!stripeKey) return err2("Stripe not configured");
7084
7109
  const accountId = await getAccountId();
7085
7110
  if (!accountId) return err2("No connected Stripe account found.");
@@ -7126,7 +7151,7 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7126
7151
  if (denied) return denied;
7127
7152
  const start = Date.now();
7128
7153
  try {
7129
- const stripeKey = env.STRIPE_SECRET_KEY;
7154
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
7130
7155
  if (!stripeKey) return err2("Stripe not configured");
7131
7156
  const accountId = await getAccountId();
7132
7157
  if (!accountId) return err2("No connected Stripe account found.");
@@ -7171,7 +7196,7 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7171
7196
  }
7172
7197
  const start = Date.now();
7173
7198
  try {
7174
- const stripeKey = env.STRIPE_SECRET_KEY;
7199
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
7175
7200
  if (!stripeKey) return err2("Stripe not configured");
7176
7201
  const params = new URLSearchParams({ limit: String(limit) });
7177
7202
  if (open_only) params.set("open", "true");
@@ -7225,7 +7250,7 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
7225
7250
  const valid = await verifyConfirmToken(env, props2.sub, toolName, confirm_token);
7226
7251
  if (!valid) return err2("Invalid or expired confirm_token.");
7227
7252
  try {
7228
- const stripeKey = env.STRIPE_SECRET_KEY;
7253
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
7229
7254
  if (!stripeKey) return err2("Stripe not configured");
7230
7255
  const result2 = await stripePost(
7231
7256
  stripeKey,
@@ -7281,7 +7306,7 @@ Expires in 5 minutes.`
7281
7306
  const valid = await verifyConfirmToken(env, props2.sub, toolName, confirm_token);
7282
7307
  if (!valid) return err2("Invalid or expired confirm_token.");
7283
7308
  try {
7284
- const stripeKey = env.STRIPE_SECRET_KEY;
7309
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
7285
7310
  if (!stripeKey) return err2("Stripe not configured");
7286
7311
  const result2 = await stripePost(
7287
7312
  stripeKey,
@@ -7338,7 +7363,7 @@ Expires in 5 minutes.`
7338
7363
  const valid = await verifyConfirmToken(env, props2.sub, toolName, confirm_token);
7339
7364
  if (!valid) return err2("Invalid or expired confirm_token.");
7340
7365
  try {
7341
- const stripeKey = env.STRIPE_SECRET_KEY;
7366
+ const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
7342
7367
  if (!stripeKey) return err2("Stripe not configured");
7343
7368
  const result2 = await stripePost(
7344
7369
  stripeKey,
@@ -12573,6 +12598,10 @@ var stdioEnv = {
12573
12598
  CARRIER_USERS: null,
12574
12599
  DOWNLOADS: null,
12575
12600
  STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY ?? "",
12601
+ // Undefined (not "") when absent so `ORG ?? SECRET` falls back in the
12602
+ // stripe-connect tools; an empty string would shadow the legacy key.
12603
+ STRIPE_ORG_SECRET_KEY: process.env.STRIPE_ORG_SECRET_KEY,
12604
+ STRIPE_PLATFORM_ACCOUNT_ID: process.env.STRIPE_PLATFORM_ACCOUNT_ID,
12576
12605
  // Browser Use Cloud. Read from the environment with a real fallback, the way
12577
12606
  // STRIPE_SECRET_KEY above and the wallet values below are — unlike the
12578
12607
  // MANUS_API_KEY this replaces, which was hardcoded to "" with no fallback at