@agentwonderland/mcp 0.1.48 → 0.1.49

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.
@@ -133,6 +133,25 @@ describe("payment method initialization", () => {
133
133
  expect(linkTokenRequest?.context).toContain("up to USD 100.00");
134
134
  expect(linkTokenRequest?.context).toContain("quoted at USD 0.25");
135
135
  });
136
+ it("keeps Link approval floor at $100 even if a low env override is present", async () => {
137
+ process.env.AGENTWONDERLAND_LINK_APPROVAL_LIMIT_CENTS = "10";
138
+ currentLink = {
139
+ paymentMethodId: "csmrpd_link_123",
140
+ label: "Visa ****4242",
141
+ };
142
+ const { getPaymentFetch } = await import("../payments.js");
143
+ await getPaymentFetch("link");
144
+ const stripeConfig = mockStripe.mock.calls[0]?.[0];
145
+ await stripeConfig.createToken({
146
+ amount: "10",
147
+ currency: "usd",
148
+ expiresAt: 1778290000,
149
+ networkId: "profile_test",
150
+ });
151
+ expect(mockCreateLinkSharedPaymentToken).toHaveBeenCalledWith(expect.objectContaining({
152
+ amount: "10000",
153
+ }));
154
+ });
136
155
  it("advertises Link as Stripe SPT compatibility", async () => {
137
156
  currentLink = {
138
157
  paymentMethodId: "csmrpd_link_123",
@@ -165,7 +165,7 @@ function getLinkApprovalLimitAmount(actualAmount) {
165
165
  const actualAmountCents = Number(actualAmount);
166
166
  const configuredLimit = Number(process.env.AGENTWONDERLAND_LINK_APPROVAL_LIMIT_CENTS);
167
167
  const defaultLimit = Number.isFinite(configuredLimit) && configuredLimit > 0
168
- ? Math.floor(configuredLimit)
168
+ ? Math.max(Math.floor(configuredLimit), DEFAULT_LINK_APPROVAL_LIMIT_CENTS)
169
169
  : DEFAULT_LINK_APPROVAL_LIMIT_CENTS;
170
170
  return String(Math.max(actualAmountCents, defaultLimit));
171
171
  }
@@ -189,6 +189,8 @@ async function initLink() {
189
189
  paymentMethod: linkConfig.paymentMethodId,
190
190
  createToken: async (params) => {
191
191
  const approvalAmount = getLinkApprovalLimitAmount(params.amount);
192
+ console.error(`Requesting Link approval up to ${formatMinorCurrencyAmount(params.currency, approvalAmount)} ` +
193
+ `for this ${formatMinorCurrencyAmount(params.currency, params.amount)} Agent Wonderland run.`);
192
194
  return createLinkSharedPaymentToken({
193
195
  amount: approvalAmount,
194
196
  currency: params.currency,
@@ -1 +1 @@
1
- export declare const MCP_PACKAGE_VERSION = "0.1.48";
1
+ export declare const MCP_PACKAGE_VERSION = "0.1.49";
@@ -1 +1 @@
1
- export const MCP_PACKAGE_VERSION = "0.1.48";
1
+ export const MCP_PACKAGE_VERSION = "0.1.49";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentwonderland/mcp",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "type": "module",
5
5
  "description": "MCP server for the Agent Wonderland AI agent marketplace",
6
6
  "bin": {
@@ -177,6 +177,38 @@ describe("payment method initialization", () => {
177
177
  expect(linkTokenRequest?.context).toContain("quoted at USD 0.25");
178
178
  });
179
179
 
180
+ it("keeps Link approval floor at $100 even if a low env override is present", async () => {
181
+ process.env.AGENTWONDERLAND_LINK_APPROVAL_LIMIT_CENTS = "10";
182
+ currentLink = {
183
+ paymentMethodId: "csmrpd_link_123",
184
+ label: "Visa ****4242",
185
+ };
186
+
187
+ const { getPaymentFetch } = await import("../payments.js");
188
+ await getPaymentFetch("link");
189
+
190
+ const stripeConfig = mockStripe.mock.calls[0]?.[0] as {
191
+ createToken: (params: {
192
+ amount: string;
193
+ currency: string;
194
+ expiresAt: number;
195
+ networkId: string;
196
+ }) => Promise<string>;
197
+ };
198
+ await stripeConfig.createToken({
199
+ amount: "10",
200
+ currency: "usd",
201
+ expiresAt: 1778290000,
202
+ networkId: "profile_test",
203
+ });
204
+
205
+ expect(mockCreateLinkSharedPaymentToken).toHaveBeenCalledWith(
206
+ expect.objectContaining({
207
+ amount: "10000",
208
+ }),
209
+ );
210
+ });
211
+
180
212
  it("advertises Link as Stripe SPT compatibility", async () => {
181
213
  currentLink = {
182
214
  paymentMethodId: "csmrpd_link_123",
@@ -201,7 +201,7 @@ function getLinkApprovalLimitAmount(actualAmount: string): string {
201
201
  const actualAmountCents = Number(actualAmount);
202
202
  const configuredLimit = Number(process.env.AGENTWONDERLAND_LINK_APPROVAL_LIMIT_CENTS);
203
203
  const defaultLimit = Number.isFinite(configuredLimit) && configuredLimit > 0
204
- ? Math.floor(configuredLimit)
204
+ ? Math.max(Math.floor(configuredLimit), DEFAULT_LINK_APPROVAL_LIMIT_CENTS)
205
205
  : DEFAULT_LINK_APPROVAL_LIMIT_CENTS;
206
206
  return String(Math.max(actualAmountCents, defaultLimit));
207
207
  }
@@ -240,6 +240,10 @@ async function initLink(): Promise<typeof fetch | null> {
240
240
  metadata?: Record<string, string>;
241
241
  }) => {
242
242
  const approvalAmount = getLinkApprovalLimitAmount(params.amount);
243
+ console.error(
244
+ `Requesting Link approval up to ${formatMinorCurrencyAmount(params.currency, approvalAmount)} ` +
245
+ `for this ${formatMinorCurrencyAmount(params.currency, params.amount)} Agent Wonderland run.`,
246
+ );
243
247
  return createLinkSharedPaymentToken({
244
248
  amount: approvalAmount,
245
249
  currency: params.currency,
@@ -1 +1 @@
1
- export const MCP_PACKAGE_VERSION = "0.1.48";
1
+ export const MCP_PACKAGE_VERSION = "0.1.49";