@carrierllc/mcp 0.13.27 → 0.13.28
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/{chunk-HLST3I4L.js → chunk-RF3NNGZX.js} +2 -2
- package/dist/{chunk-HLST3I4L.js.map → chunk-RF3NNGZX.js.map} +1 -1
- package/dist/cli.js +20 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +70 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/storefront/package-lock.json +10 -6
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
verifyStorefront,
|
|
81
81
|
withOcsListSummary,
|
|
82
82
|
withTemplateResellerId
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-RF3NNGZX.js";
|
|
84
84
|
import "./chunk-SHKKVIIA.js";
|
|
85
85
|
|
|
86
86
|
// src/index.ts
|
|
@@ -6922,6 +6922,7 @@ var STRIPE_CONNECT_TOOL_SCOPES = {
|
|
|
6922
6922
|
stripe_connect_status: "read",
|
|
6923
6923
|
stripe_connect_payouts: "read",
|
|
6924
6924
|
stripe_connect_balance: "read",
|
|
6925
|
+
stripe_connect_charges_list: "read",
|
|
6925
6926
|
stripe_connect_refund: "write",
|
|
6926
6927
|
stripe_connect_dispute_list: "read",
|
|
6927
6928
|
radar_review_list: "read",
|
|
@@ -6935,7 +6936,16 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
6935
6936
|
const operatorId = props2.org_id ?? props2.sub;
|
|
6936
6937
|
const kvKey = `stripe_account:${operatorId}`;
|
|
6937
6938
|
async function getAccountId() {
|
|
6938
|
-
|
|
6939
|
+
if (env.BILLING_DB) {
|
|
6940
|
+
try {
|
|
6941
|
+
const row = await env.BILLING_DB.prepare(
|
|
6942
|
+
"SELECT stripe_account_id FROM operator_stripe_accounts WHERE operator_id = ?"
|
|
6943
|
+
).bind(operatorId).first();
|
|
6944
|
+
if (row?.stripe_account_id) return row.stripe_account_id;
|
|
6945
|
+
} catch {
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6948
|
+
return env.CARRIER_USERS ? env.CARRIER_USERS.get(kvKey) : null;
|
|
6939
6949
|
}
|
|
6940
6950
|
server2.registerTool(
|
|
6941
6951
|
"stripe_connect_status",
|
|
@@ -7038,6 +7048,64 @@ function registerStripeConnectTools(server2, ctx) {
|
|
|
7038
7048
|
}
|
|
7039
7049
|
}
|
|
7040
7050
|
);
|
|
7051
|
+
server2.registerTool(
|
|
7052
|
+
"stripe_connect_charges_list",
|
|
7053
|
+
{
|
|
7054
|
+
title: "Stripe Connect Charges",
|
|
7055
|
+
description: "List recent payments (charges) on the operator's connected Stripe account, e.g. storefront purchases. Read-only. Params: limit (1-100), starting_after (charge id for paging). Returns: { charges: [{ id, amount, amount_refunded, currency, status, paid, captured, refunded, created, payment_intent, payment_method_type, metadata }], has_more }. Do NOT use this for payouts to the bank \u2014 use `stripe_connect_payouts`.",
|
|
7056
|
+
inputSchema: {
|
|
7057
|
+
limit: z8.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
|
|
7058
|
+
starting_after: z8.string().regex(/^(ch|py)_[A-Za-z0-9]+$/).optional().describe("Charge id to page after.")
|
|
7059
|
+
},
|
|
7060
|
+
annotations: annotationsFor("stripe_connect_charges_list", "read")
|
|
7061
|
+
},
|
|
7062
|
+
async ({ limit, starting_after }) => {
|
|
7063
|
+
const denied = denyUnlessScoped(props2, "stripe_connect_charges_list", STRIPE_CONNECT_TOOL_SCOPES);
|
|
7064
|
+
if (denied) return denied;
|
|
7065
|
+
const start = Date.now();
|
|
7066
|
+
try {
|
|
7067
|
+
const stripeKey = env.STRIPE_ORG_SECRET_KEY ?? env.STRIPE_SECRET_KEY;
|
|
7068
|
+
if (!stripeKey) return err2("Stripe not configured");
|
|
7069
|
+
const accountId = await getAccountId();
|
|
7070
|
+
if (!accountId) return err2("No connected Stripe account found.");
|
|
7071
|
+
const params = new URLSearchParams({ limit: String(limit) });
|
|
7072
|
+
if (starting_after) params.set("starting_after", starting_after);
|
|
7073
|
+
const result2 = await stripeGet(
|
|
7074
|
+
stripeKey,
|
|
7075
|
+
`/v1/charges?${params.toString()}`,
|
|
7076
|
+
accountId
|
|
7077
|
+
);
|
|
7078
|
+
if (!result2.ok) return err2(`Stripe error: ${JSON.stringify(result2.data)}`);
|
|
7079
|
+
writeAudit(env, {
|
|
7080
|
+
tool_name: "stripe_connect_charges_list",
|
|
7081
|
+
ocs_method: "stripe.charges.list",
|
|
7082
|
+
status: "ok",
|
|
7083
|
+
dry_run: false,
|
|
7084
|
+
duration_ms: Date.now() - start,
|
|
7085
|
+
sub: props2.sub,
|
|
7086
|
+
reseller_id: props2.reseller_id
|
|
7087
|
+
});
|
|
7088
|
+
const charges = (result2.data.data ?? []).map((ch) => ({
|
|
7089
|
+
id: ch["id"],
|
|
7090
|
+
amount: ch["amount"],
|
|
7091
|
+
amount_refunded: ch["amount_refunded"],
|
|
7092
|
+
currency: ch["currency"],
|
|
7093
|
+
status: ch["status"],
|
|
7094
|
+
paid: ch["paid"],
|
|
7095
|
+
captured: ch["captured"],
|
|
7096
|
+
refunded: ch["refunded"],
|
|
7097
|
+
created: ch["created"],
|
|
7098
|
+
payment_intent: ch["payment_intent"],
|
|
7099
|
+
payment_method_type: ch["payment_method_details"]?.type ?? null,
|
|
7100
|
+
metadata: ch["metadata"]
|
|
7101
|
+
}));
|
|
7102
|
+
return ok(JSON.stringify({ charges, has_more: result2.data.has_more }));
|
|
7103
|
+
} catch (e) {
|
|
7104
|
+
Sentry3.captureException(e);
|
|
7105
|
+
return err2(`stripe_connect_charges_list failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
7106
|
+
}
|
|
7107
|
+
}
|
|
7108
|
+
);
|
|
7041
7109
|
server2.registerTool(
|
|
7042
7110
|
"stripe_connect_balance",
|
|
7043
7111
|
{
|