@cryptoapis-io/mcp-x402-pay 0.1.0 → 0.1.1
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/README.md +18 -0
- package/dist/tools/x402-pay/schema.js +1 -1
- package/dist/tools/x402-pay/schema.js.map +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,24 @@ stdio only).
|
|
|
20
20
|
node dist/cli.js # stdio MCP server (no --api-key at startup; keys are per-tool-call)
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
## Prerequisite — an agent `walletId`
|
|
24
|
+
|
|
25
|
+
`x402_pay` pays from a CryptoAPIs **agent wallet** (`walletId`). Create one ONCE per blockchain+network
|
|
26
|
+
before paying — a single `POST` to the buyer API returns the id (non-custodial: you register only your
|
|
27
|
+
PUBLIC address):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
curl -X POST https://ai.cryptoapis.io/x402/buyer/wallets \
|
|
31
|
+
-H "x-api-key: $CRYPTOAPIS_API_KEY" -H "content-type: application/json" \
|
|
32
|
+
-d '{"blockchain":"base","network":"eip155:8453","address":"0xYourAddress"}'
|
|
33
|
+
# → { "walletId": "…" }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`network` MUST be the **CAIP-2 id** (`eip155:8453`, `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`, …), not a
|
|
37
|
+
bare name — and exactly one of `address` (any chain; **required for Solana/Kaspa**) or `xpub`
|
|
38
|
+
(xpub-capable chains). A malformed body returns a clear `400 malformed_request`. Set the returned id as
|
|
39
|
+
`X402_WALLET_ID` (or pass `walletId`).
|
|
40
|
+
|
|
23
41
|
## Tool: `x402_pay`
|
|
24
42
|
|
|
25
43
|
| Input | Required | Description |
|
|
@@ -16,7 +16,7 @@ export const X402PaySchema = z.object({
|
|
|
16
16
|
body: z.string().optional().describe("Request body (string; set content-type via headers if needed)"),
|
|
17
17
|
headers: z.record(z.string(), z.string()).optional().describe("Extra request headers"),
|
|
18
18
|
apiKey: z.string().optional().describe("Your CryptoAPIs API key with the X402_BUYER feature (used only to call the buyer /authorize). Falls back to the CRYPTOAPIS_API_KEY env var — set it once and omit this."),
|
|
19
|
-
walletId: z.string().optional().describe("The CryptoAPIs agent wallet id to pay from. Falls back to the X402_WALLET_ID env var."),
|
|
19
|
+
walletId: z.string().optional().describe("The CryptoAPIs agent wallet id to pay from. Falls back to the X402_WALLET_ID env var. Create one first (once per blockchain+network): POST https://ai.cryptoapis.io/x402/buyer/wallets with {blockchain, network (CAIP-2 id like eip155:8453 or solana:<genesisHash> — NOT a bare name), address (your public address; required for Solana/Kaspa)} → returns walletId."),
|
|
20
20
|
// Per-family signing keys — pass only the one(s) for the chain(s) you pay on.
|
|
21
21
|
// All SIGN LOCALLY and are never sent anywhere; each falls back to its env var
|
|
22
22
|
// (PREFERRED — keeps the key out of tool-call logs).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/tools/x402-pay/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;IAChF,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC1G,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;IACrG,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAA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DAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sKAAsK,CAAC;IAClN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kHAAkH,CAAC;IAC3J,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6HAA6H,CAAC;IACxK,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kIAAkI,CAAC;IAC3K,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qGAAqG,CAAC;IAC/I,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oGAAoG,CAAC;IAE7I,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mEAAmE,CAAC;IAC7H,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mFAAmF,CAAC;IACvI,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oFAAoF,CAAC;CAClI,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptoapis-io/mcp-x402-pay",
|
|
3
3
|
"mcpName": "io.github.CryptoAPIs-io/mcp-x402-pay",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "MCP server that pays x402-gated HTTP endpoints — one x402_pay tool that fetches, and on a 402 authorizes via the CryptoAPIs buyer service, signs LOCALLY, and retries.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/CryptoAPIs-io/cryptoapis-mcp-x402-pay",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.1.
|
|
9
|
+
"version": "0.1.1",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@cryptoapis-io/mcp-x402-pay",
|
|
14
|
-
"version": "0.1.
|
|
14
|
+
"version": "0.1.1",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|