mcp-server-agentpay 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/index.js +60 -3
  2. package/package.json +8 -2
package/index.js CHANGED
@@ -189,11 +189,11 @@ server.tool(
189
189
  }
190
190
  );
191
191
 
192
- // ── Tool: fund_wallet ───────────────────────────────────────────────
192
+ // ── Tool: fund_wallet_stripe ─────────────────────────────────────────
193
193
 
194
194
  server.tool(
195
- "fund_wallet",
196
- "Get a Stripe checkout URL to add credits to your wallet. Returns a link that a human can open to complete payment. Credits are added instantly after payment.",
195
+ "fund_wallet_stripe",
196
+ "Get a Stripe checkout URL to add credits. Requires a human to open the link and pay. Use fund_wallet_x402 for fully autonomous crypto payments instead.",
197
197
  {
198
198
  package: z.enum(["micro", "small", "medium", "large", "whale"]).describe("Credit package: micro ($10/10cr), small ($45/50cr), medium ($80/100cr), large ($350/500cr), whale ($600/1000cr)"),
199
199
  },
@@ -208,6 +208,63 @@ server.tool(
208
208
  }
209
209
  );
210
210
 
211
+ // ── Tool: fund_wallet_x402 ──────────────────────────────────────────
212
+
213
+ server.tool(
214
+ "fund_wallet_x402",
215
+ "Get x402 crypto funding info for your wallet. Returns the endpoint URL, network, and setup instructions. To actually pay, your HTTP client needs @x402/fetch which automatically handles the 402 payment flow with USDC. This is the fully autonomous funding method — no human needed.",
216
+ {
217
+ package: z.enum(["micro", "small", "medium", "large", "whale"]).describe("Credit package: micro ($10/10cr), small ($45/50cr), medium ($80/100cr), large ($350/500cr), whale ($600/1000cr)"),
218
+ },
219
+ async ({ package: pkg }) => {
220
+ if (!GATEWAY_KEY) return noKeyError();
221
+ try {
222
+ const info = await request("GET", "/gateway/fund/x402");
223
+ const option = info.options?.find(o => o.package === pkg);
224
+ if (!option) {
225
+ return { content: [{ type: "text", text: `Package "${pkg}" not found. Available: ${info.options?.map(o => o.package).join(", ")}` }] };
226
+ }
227
+ return {
228
+ content: [{
229
+ type: "text",
230
+ text: `x402 Crypto Funding for ${pkg} package (${option.credits} credits, ${option.price} USDC):\n\n` +
231
+ `Endpoint: POST ${BASE_URL}${option.endpoint}\n` +
232
+ `Network: ${option.network}\n` +
233
+ `PayTo: ${option.payTo}\n\n` +
234
+ `To pay autonomously, make an HTTP request to the endpoint above.\n` +
235
+ `If using @x402/fetch, the 402 payment flow is handled automatically:\n\n` +
236
+ ` const fetchWithPayment = wrapFetchWithPayment(fetch, x402Client);\n` +
237
+ ` const res = await fetchWithPayment("${BASE_URL}/gateway/fund/x402/${pkg}", {\n` +
238
+ ` method: "POST",\n` +
239
+ ` headers: { "X-Gateway-Key": "your_key" }\n` +
240
+ ` });\n\n` +
241
+ `The agent's EVM wallet needs USDC on ${option.network}.\n` +
242
+ `Setup: npm install @x402/fetch @x402/evm\n` +
243
+ `Env: EVM_PRIVATE_KEY=0x... (agent wallet with USDC)`,
244
+ }],
245
+ };
246
+ } catch (e) {
247
+ return { content: [{ type: "text", text: `Error: ${e.message}` }] };
248
+ }
249
+ }
250
+ );
251
+
252
+ // ── Tool: x402_info ─────────────────────────────────────────────────
253
+
254
+ server.tool(
255
+ "x402_info",
256
+ "Get information about x402 crypto payment support — which networks, tokens, and funding options are available for autonomous wallet funding.",
257
+ {},
258
+ async () => {
259
+ try {
260
+ const info = await request("GET", "/gateway/fund/x402");
261
+ return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }] };
262
+ } catch (e) {
263
+ return { content: [{ type: "text", text: `x402 not enabled on this gateway. Error: ${e.message}` }] };
264
+ }
265
+ }
266
+ );
267
+
211
268
  // ── Start ───────────────────────────────────────────────────────────
212
269
 
213
270
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "mcp-server-agentpay",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
+ "mcpName": "io.github.joepangallo/agent-pay",
4
5
  "description": "MCP server for AgentPay — the payment gateway for autonomous AI agents. Lets agents discover, provision, and pay for MCP tool APIs with a single gateway key.",
5
6
  "bin": {
6
7
  "mcp-server-agentpay": "index.js"
@@ -29,7 +30,12 @@
29
30
  "openai",
30
31
  "agent-economy",
31
32
  "machine-to-machine",
32
- "api-credits"
33
+ "api-credits",
34
+ "x402",
35
+ "crypto-payment",
36
+ "usdc",
37
+ "autonomous-funding",
38
+ "web3"
33
39
  ],
34
40
  "license": "MIT",
35
41
  "author": "MetalTorque",