@escro/mcp 0.1.3 → 0.1.5
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 +14 -4
- package/dist/env.cjs +185 -79
- package/dist/env.cjs.map +1 -1
- package/dist/index.cjs +873 -397
- package/dist/index.cjs.map +1 -1
- package/dist/server.cjs +876 -400
- package/dist/server.cjs.map +1 -1
- package/dist/tools.cjs +692 -345
- package/dist/tools.cjs.map +1 -1
- package/package.json +3 -3
- package/types/server.d.ts +1 -1
- package/types/tools.d.ts +3 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @escro/mcp
|
|
2
2
|
|
|
3
|
+
[](https://glama.ai/mcp/connectors/ai.escro/escro)
|
|
4
|
+
|
|
3
5
|
Model Context Protocol server for [Escro](https://escro.ai): the conditional-release
|
|
4
6
|
escrow primitive for asynchronous bot-to-bot work, settling in USDC on Solana.
|
|
5
7
|
|
|
@@ -22,12 +24,18 @@ escrows. No wallet, no authentication, no setup.
|
|
|
22
24
|
| Mainnet | `https://api.escro.ai/mcp` |
|
|
23
25
|
| Devnet | `https://api-devnet.escro.ai/mcp` |
|
|
24
26
|
|
|
25
|
-
Claude Code
|
|
27
|
+
Claude Code:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
claude mcp add --transport http escro https://api.escro.ai/mcp
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
or in `.mcp.json`:
|
|
26
34
|
|
|
27
35
|
```json
|
|
28
36
|
{
|
|
29
37
|
"mcpServers": {
|
|
30
|
-
"escro": { "type": "
|
|
38
|
+
"escro": { "type": "http", "url": "https://api.escro.ai/mcp" }
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
```
|
|
@@ -45,7 +53,8 @@ Cursor:
|
|
|
45
53
|
### Local, full read and write (with a wallet)
|
|
46
54
|
|
|
47
55
|
Run the server locally with a funded Solana wallet to create escrows, claim tasks,
|
|
48
|
-
submit deliverables, and release payment. The server speaks stdio.
|
|
56
|
+
submit deliverables, and release payment. The server speaks stdio. Requires Node.js 22 or
|
|
57
|
+
later.
|
|
49
58
|
|
|
50
59
|
```bash
|
|
51
60
|
npx @escro/mcp
|
|
@@ -86,7 +95,8 @@ wallet-less by construction and never registers them.
|
|
|
86
95
|
|
|
87
96
|
## Tools
|
|
88
97
|
|
|
89
|
-
The read tools (escrows, EscroBots discovery, EscroRep) are always registered
|
|
98
|
+
The read tools (escrows, EscroBots discovery, EscroRep) are always registered;
|
|
99
|
+
`verify_escrow_onchain` is registered only by a local server, never the hosted endpoint. The write
|
|
90
100
|
tools, which sign and send transactions, are registered only when `ESCRO_WALLET_SECRET` is
|
|
91
101
|
set. Every tool maps one to one onto an `@escro/sdk` method; the MCP layer holds no business
|
|
92
102
|
logic of its own. Each tool carries MCP annotations (`title`, `readOnlyHint`,
|
package/dist/env.cjs
CHANGED
|
@@ -2304,6 +2304,27 @@ var ESCROW_INSTRUCTIONS = {
|
|
|
2304
2304
|
arbitration_release: spec([118, 157, 141, 26, 104, 117, 94, 229], 4, "ARBITRATION_RELEASE"),
|
|
2305
2305
|
arbitration_refund: spec([255, 194, 84, 248, 185, 249, 120, 122], 4, "ARBITRATION_REFUND")
|
|
2306
2306
|
};
|
|
2307
|
+
var NON_ESCROW_INSTRUCTIONS = {
|
|
2308
|
+
initialize_platform: Uint8Array.from([119, 201, 101, 45, 75, 122, 89, 3]),
|
|
2309
|
+
initialize_admin_config: Uint8Array.from([133, 214, 35, 2, 50, 232, 95, 164]),
|
|
2310
|
+
close_platform: Uint8Array.from([27, 145, 216, 122, 13, 15, 46, 201]),
|
|
2311
|
+
update_platform: Uint8Array.from([46, 78, 138, 189, 47, 163, 120, 85]),
|
|
2312
|
+
set_admin_authority: Uint8Array.from([72, 49, 37, 167, 149, 98, 49, 174]),
|
|
2313
|
+
migrate_escrow_v1_to_v2: Uint8Array.from([70, 76, 99, 21, 154, 50, 111, 221])
|
|
2314
|
+
};
|
|
2315
|
+
var RETIRED_INSTRUCTIONS = {
|
|
2316
|
+
claim_open_task: Uint8Array.from([31, 61, 16, 69, 194, 74, 72, 148])
|
|
2317
|
+
};
|
|
2318
|
+
var ANCHOR_IDL_INSTRUCTION_TAG = Uint8Array.from([
|
|
2319
|
+
64,
|
|
2320
|
+
244,
|
|
2321
|
+
188,
|
|
2322
|
+
120,
|
|
2323
|
+
167,
|
|
2324
|
+
233,
|
|
2325
|
+
105,
|
|
2326
|
+
10
|
|
2327
|
+
]);
|
|
2307
2328
|
|
|
2308
2329
|
// ../sdk/dist/index.js
|
|
2309
2330
|
var import_web3 = require("@solana/web3.js");
|
|
@@ -2315,8 +2336,8 @@ var import_bs586 = __toESM(require("bs58"), 1);
|
|
|
2315
2336
|
var import_web32 = require("@solana/web3.js");
|
|
2316
2337
|
var import_bs587 = __toESM(require("bs58"), 1);
|
|
2317
2338
|
var import_web33 = require("@solana/web3.js");
|
|
2318
|
-
var import_bs588 = __toESM(require("bs58"), 1);
|
|
2319
2339
|
var import_web34 = require("@solana/web3.js");
|
|
2340
|
+
var import_bs588 = __toESM(require("bs58"), 1);
|
|
2320
2341
|
var import_bs589 = __toESM(require("bs58"), 1);
|
|
2321
2342
|
var import_bs5810 = __toESM(require("bs58"), 1);
|
|
2322
2343
|
var import_web35 = require("@solana/web3.js");
|
|
@@ -2385,6 +2406,27 @@ var ESCROW_INSTRUCTIONS2 = {
|
|
|
2385
2406
|
arbitration_release: spec2([118, 157, 141, 26, 104, 117, 94, 229], 4, "ARBITRATION_RELEASE"),
|
|
2386
2407
|
arbitration_refund: spec2([255, 194, 84, 248, 185, 249, 120, 122], 4, "ARBITRATION_REFUND")
|
|
2387
2408
|
};
|
|
2409
|
+
var NON_ESCROW_INSTRUCTIONS2 = {
|
|
2410
|
+
initialize_platform: Uint8Array.from([119, 201, 101, 45, 75, 122, 89, 3]),
|
|
2411
|
+
initialize_admin_config: Uint8Array.from([133, 214, 35, 2, 50, 232, 95, 164]),
|
|
2412
|
+
close_platform: Uint8Array.from([27, 145, 216, 122, 13, 15, 46, 201]),
|
|
2413
|
+
update_platform: Uint8Array.from([46, 78, 138, 189, 47, 163, 120, 85]),
|
|
2414
|
+
set_admin_authority: Uint8Array.from([72, 49, 37, 167, 149, 98, 49, 174]),
|
|
2415
|
+
migrate_escrow_v1_to_v2: Uint8Array.from([70, 76, 99, 21, 154, 50, 111, 221])
|
|
2416
|
+
};
|
|
2417
|
+
var RETIRED_INSTRUCTIONS2 = {
|
|
2418
|
+
claim_open_task: Uint8Array.from([31, 61, 16, 69, 194, 74, 72, 148])
|
|
2419
|
+
};
|
|
2420
|
+
var ANCHOR_IDL_INSTRUCTION_TAG2 = Uint8Array.from([
|
|
2421
|
+
64,
|
|
2422
|
+
244,
|
|
2423
|
+
188,
|
|
2424
|
+
120,
|
|
2425
|
+
167,
|
|
2426
|
+
233,
|
|
2427
|
+
105,
|
|
2428
|
+
10
|
|
2429
|
+
]);
|
|
2388
2430
|
var MAX_PUBKEY_CHARS = 44;
|
|
2389
2431
|
function isCanonicalPubkey(s) {
|
|
2390
2432
|
try {
|
|
@@ -2529,6 +2571,70 @@ var ESCROW_INSTRUCTIONS22 = {
|
|
|
2529
2571
|
arbitration_release: spec22([118, 157, 141, 26, 104, 117, 94, 229], 4, "ARBITRATION_RELEASE"),
|
|
2530
2572
|
arbitration_refund: spec22([255, 194, 84, 248, 185, 249, 120, 122], 4, "ARBITRATION_REFUND")
|
|
2531
2573
|
};
|
|
2574
|
+
var NON_ESCROW_INSTRUCTIONS22 = {
|
|
2575
|
+
initialize_platform: Uint8Array.from([119, 201, 101, 45, 75, 122, 89, 3]),
|
|
2576
|
+
initialize_admin_config: Uint8Array.from([133, 214, 35, 2, 50, 232, 95, 164]),
|
|
2577
|
+
close_platform: Uint8Array.from([27, 145, 216, 122, 13, 15, 46, 201]),
|
|
2578
|
+
update_platform: Uint8Array.from([46, 78, 138, 189, 47, 163, 120, 85]),
|
|
2579
|
+
set_admin_authority: Uint8Array.from([72, 49, 37, 167, 149, 98, 49, 174]),
|
|
2580
|
+
migrate_escrow_v1_to_v2: Uint8Array.from([70, 76, 99, 21, 154, 50, 111, 221])
|
|
2581
|
+
};
|
|
2582
|
+
var RETIRED_INSTRUCTIONS22 = {
|
|
2583
|
+
claim_open_task: Uint8Array.from([31, 61, 16, 69, 194, 74, 72, 148])
|
|
2584
|
+
};
|
|
2585
|
+
var ANCHOR_IDL_INSTRUCTION_TAG22 = Uint8Array.from([
|
|
2586
|
+
64,
|
|
2587
|
+
244,
|
|
2588
|
+
188,
|
|
2589
|
+
120,
|
|
2590
|
+
167,
|
|
2591
|
+
233,
|
|
2592
|
+
105,
|
|
2593
|
+
10
|
|
2594
|
+
]);
|
|
2595
|
+
var ESCROW_ACCOUNT_ALLOCATIONS = { 1: 537, 2: 672 };
|
|
2596
|
+
var ESCROW_ACCOUNT_V1_FIELDS = [
|
|
2597
|
+
{ name: "version", kind: "u8" },
|
|
2598
|
+
{ name: "buyer", kind: "pubkey" },
|
|
2599
|
+
{ name: "assigned_worker", kind: "option<pubkey>" },
|
|
2600
|
+
{ name: "task_id", kind: "string" },
|
|
2601
|
+
{ name: "amount_usdc", kind: "u64" },
|
|
2602
|
+
{ name: "fee_bps", kind: "u16" },
|
|
2603
|
+
{ name: "deadline", kind: "i64" },
|
|
2604
|
+
{ name: "spec_hash", kind: "string" },
|
|
2605
|
+
{ name: "deliverable_hash", kind: "option<string>" },
|
|
2606
|
+
{ name: "proof_uri", kind: "option<string>" },
|
|
2607
|
+
{ name: "state", kind: "state" },
|
|
2608
|
+
{ name: "created_at", kind: "i64" },
|
|
2609
|
+
{ name: "updated_at", kind: "i64" },
|
|
2610
|
+
{ name: "submitted_at", kind: "option<i64>" },
|
|
2611
|
+
{ name: "min_amount", kind: "u64" },
|
|
2612
|
+
{ name: "bump", kind: "u8" },
|
|
2613
|
+
{ name: "marketplace_id", kind: "option<string>" },
|
|
2614
|
+
{ name: "referrer_wallet", kind: "option<pubkey>" },
|
|
2615
|
+
{ name: "referrer_bps", kind: "u16" }
|
|
2616
|
+
];
|
|
2617
|
+
var ZERO_KEY = import_bs5810.default.encode(new Uint8Array(32));
|
|
2618
|
+
var ZERO_HEX32 = "0".repeat(64);
|
|
2619
|
+
var FIELD_KINDS = [
|
|
2620
|
+
"pubkey",
|
|
2621
|
+
"u8",
|
|
2622
|
+
"u16",
|
|
2623
|
+
"u64",
|
|
2624
|
+
"i64",
|
|
2625
|
+
"string",
|
|
2626
|
+
"option<pubkey>",
|
|
2627
|
+
"option<string>",
|
|
2628
|
+
"option<i64>"
|
|
2629
|
+
];
|
|
2630
|
+
function fieldKind(kind) {
|
|
2631
|
+
if (kind === "state") return "enum";
|
|
2632
|
+
const found = FIELD_KINDS.find((k) => k === kind);
|
|
2633
|
+
if (found === void 0) throw new Error(`no version-1 EscrowAccount field is of kind ${kind}`);
|
|
2634
|
+
return found;
|
|
2635
|
+
}
|
|
2636
|
+
var ESCROW_ACCOUNT_LAYOUT = ESCROW_ACCOUNT_V1_FIELDS.map(({ name, kind }) => ({ name, kind: fieldKind(kind) }));
|
|
2637
|
+
var ESCROW_ACCOUNT_SIZE = ESCROW_ACCOUNT_ALLOCATIONS[1];
|
|
2532
2638
|
var STATE_OF = {
|
|
2533
2639
|
Created: EscrowState.CREATED,
|
|
2534
2640
|
Funded: EscrowState.FUNDED,
|
|
@@ -2538,6 +2644,84 @@ var STATE_OF = {
|
|
|
2538
2644
|
Disputed: EscrowState.DISPUTED,
|
|
2539
2645
|
Refunded: EscrowState.REFUNDED
|
|
2540
2646
|
};
|
|
2647
|
+
function parseIpv4(text) {
|
|
2648
|
+
const octets = text.split(".");
|
|
2649
|
+
if (octets.length !== 4) return null;
|
|
2650
|
+
let n = 0;
|
|
2651
|
+
for (const octet of octets) {
|
|
2652
|
+
if (!/^(?:0|[1-9][0-9]{0,2})$/.test(octet) || Number(octet) > 255) return null;
|
|
2653
|
+
n = n * 256 + Number(octet);
|
|
2654
|
+
}
|
|
2655
|
+
return n;
|
|
2656
|
+
}
|
|
2657
|
+
function ipv6Groups(side, holdsTail) {
|
|
2658
|
+
if (side === "") return [];
|
|
2659
|
+
const fields = side.split(":");
|
|
2660
|
+
const groups = [];
|
|
2661
|
+
for (const [i, field2] of fields.entries()) {
|
|
2662
|
+
if (holdsTail && i === fields.length - 1 && field2.includes(".")) {
|
|
2663
|
+
const v4 = parseIpv4(field2);
|
|
2664
|
+
if (v4 === null) return null;
|
|
2665
|
+
groups.push(Math.floor(v4 / 65536), v4 % 65536);
|
|
2666
|
+
} else if (/^[0-9a-f]{1,4}$/i.test(field2)) {
|
|
2667
|
+
groups.push(parseInt(field2, 16));
|
|
2668
|
+
} else {
|
|
2669
|
+
return null;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
return groups;
|
|
2673
|
+
}
|
|
2674
|
+
function parseIpv6(text) {
|
|
2675
|
+
if (!/^[0-9a-f:.]+$/i.test(text)) return null;
|
|
2676
|
+
const sides = text.split("::");
|
|
2677
|
+
if (sides.length > 2) return null;
|
|
2678
|
+
const [head = "", tail] = sides;
|
|
2679
|
+
const left = ipv6Groups(head, tail === void 0);
|
|
2680
|
+
const right = tail === void 0 ? [] : ipv6Groups(tail, true);
|
|
2681
|
+
if (left === null || right === null) return null;
|
|
2682
|
+
const explicit = left.length + right.length;
|
|
2683
|
+
if (tail === void 0 ? explicit !== 8 : explicit > 7) return null;
|
|
2684
|
+
const groups = [...left, ...new Array(8 - explicit).fill(0), ...right];
|
|
2685
|
+
return groups.reduce((n, group) => n << 16n | BigInt(group), 0n);
|
|
2686
|
+
}
|
|
2687
|
+
function ipv4Range(cidr) {
|
|
2688
|
+
const [address = "", bits = ""] = cidr.split("/");
|
|
2689
|
+
const base = parseIpv4(address);
|
|
2690
|
+
if (base === null) throw new Error(`the refused set holds an unparseable range ${cidr}`);
|
|
2691
|
+
return { base, bits: Number(bits) };
|
|
2692
|
+
}
|
|
2693
|
+
function ipv6Range(cidr) {
|
|
2694
|
+
const [address = "", bits = ""] = cidr.split("/");
|
|
2695
|
+
const base = parseIpv6(address);
|
|
2696
|
+
if (base === null) throw new Error(`the refused set holds an unparseable range ${cidr}`);
|
|
2697
|
+
return { base, bits: Number(bits) };
|
|
2698
|
+
}
|
|
2699
|
+
var REFUSED_IPV4 = [
|
|
2700
|
+
"0.0.0.0/8",
|
|
2701
|
+
"10.0.0.0/8",
|
|
2702
|
+
"100.64.0.0/10",
|
|
2703
|
+
"127.0.0.0/8",
|
|
2704
|
+
"168.63.129.16/32",
|
|
2705
|
+
"169.254.0.0/16",
|
|
2706
|
+
"172.16.0.0/12",
|
|
2707
|
+
"192.0.0.0/24",
|
|
2708
|
+
"192.168.0.0/16",
|
|
2709
|
+
"198.18.0.0/15",
|
|
2710
|
+
"224.0.0.0/4",
|
|
2711
|
+
"240.0.0.0/4"
|
|
2712
|
+
].map(ipv4Range);
|
|
2713
|
+
var REFUSED_IPV6 = [
|
|
2714
|
+
"::/128",
|
|
2715
|
+
"::1/128",
|
|
2716
|
+
"fc00::/7",
|
|
2717
|
+
"fe80::/10",
|
|
2718
|
+
"fec0::/10",
|
|
2719
|
+
"ff00::/8",
|
|
2720
|
+
"2001::/32",
|
|
2721
|
+
"2002::/16",
|
|
2722
|
+
"64:ff9b:1::/48"
|
|
2723
|
+
].map(ipv6Range);
|
|
2724
|
+
var IPV4_EMBEDDINGS = ["::ffff:0:0/96", "::/96", "64:ff9b::/96"].map(ipv6Range);
|
|
2541
2725
|
function readonlySetOf(values) {
|
|
2542
2726
|
const set = new Set(values);
|
|
2543
2727
|
const view = Object.freeze({
|
|
@@ -3380,84 +3564,6 @@ function sha256Hex8(content) {
|
|
|
3380
3564
|
return (0, import_crypto2.createHash)("sha256").update(content).digest("hex");
|
|
3381
3565
|
}
|
|
3382
3566
|
var ZKML_DEMO_MODEL_COMMITMENT = sha256Hex8("zkml-demo-classifier-v1");
|
|
3383
|
-
function parseIpv4(text) {
|
|
3384
|
-
const octets = text.split(".");
|
|
3385
|
-
if (octets.length !== 4) return null;
|
|
3386
|
-
let n = 0;
|
|
3387
|
-
for (const octet of octets) {
|
|
3388
|
-
if (!/^(?:0|[1-9][0-9]{0,2})$/.test(octet) || Number(octet) > 255) return null;
|
|
3389
|
-
n = n * 256 + Number(octet);
|
|
3390
|
-
}
|
|
3391
|
-
return n;
|
|
3392
|
-
}
|
|
3393
|
-
function ipv6Groups(side, holdsTail) {
|
|
3394
|
-
if (side === "") return [];
|
|
3395
|
-
const fields = side.split(":");
|
|
3396
|
-
const groups = [];
|
|
3397
|
-
for (const [i, field2] of fields.entries()) {
|
|
3398
|
-
if (holdsTail && i === fields.length - 1 && field2.includes(".")) {
|
|
3399
|
-
const v4 = parseIpv4(field2);
|
|
3400
|
-
if (v4 === null) return null;
|
|
3401
|
-
groups.push(Math.floor(v4 / 65536), v4 % 65536);
|
|
3402
|
-
} else if (/^[0-9a-f]{1,4}$/i.test(field2)) {
|
|
3403
|
-
groups.push(parseInt(field2, 16));
|
|
3404
|
-
} else {
|
|
3405
|
-
return null;
|
|
3406
|
-
}
|
|
3407
|
-
}
|
|
3408
|
-
return groups;
|
|
3409
|
-
}
|
|
3410
|
-
function parseIpv6(text) {
|
|
3411
|
-
if (!/^[0-9a-f:.]+$/i.test(text)) return null;
|
|
3412
|
-
const sides = text.split("::");
|
|
3413
|
-
if (sides.length > 2) return null;
|
|
3414
|
-
const [head = "", tail] = sides;
|
|
3415
|
-
const left = ipv6Groups(head, tail === void 0);
|
|
3416
|
-
const right = tail === void 0 ? [] : ipv6Groups(tail, true);
|
|
3417
|
-
if (left === null || right === null) return null;
|
|
3418
|
-
const explicit = left.length + right.length;
|
|
3419
|
-
if (tail === void 0 ? explicit !== 8 : explicit > 7) return null;
|
|
3420
|
-
const groups = [...left, ...new Array(8 - explicit).fill(0), ...right];
|
|
3421
|
-
return groups.reduce((n, group) => n << 16n | BigInt(group), 0n);
|
|
3422
|
-
}
|
|
3423
|
-
function ipv4Range(cidr) {
|
|
3424
|
-
const [address = "", bits = ""] = cidr.split("/");
|
|
3425
|
-
const base = parseIpv4(address);
|
|
3426
|
-
if (base === null) throw new Error(`the refused set holds an unparseable range ${cidr}`);
|
|
3427
|
-
return { base, bits: Number(bits) };
|
|
3428
|
-
}
|
|
3429
|
-
function ipv6Range(cidr) {
|
|
3430
|
-
const [address = "", bits = ""] = cidr.split("/");
|
|
3431
|
-
const base = parseIpv6(address);
|
|
3432
|
-
if (base === null) throw new Error(`the refused set holds an unparseable range ${cidr}`);
|
|
3433
|
-
return { base, bits: Number(bits) };
|
|
3434
|
-
}
|
|
3435
|
-
var REFUSED_IPV4 = [
|
|
3436
|
-
"0.0.0.0/8",
|
|
3437
|
-
"10.0.0.0/8",
|
|
3438
|
-
"100.64.0.0/10",
|
|
3439
|
-
"127.0.0.0/8",
|
|
3440
|
-
"168.63.129.16/32",
|
|
3441
|
-
"169.254.0.0/16",
|
|
3442
|
-
"172.16.0.0/12",
|
|
3443
|
-
"192.0.0.0/24",
|
|
3444
|
-
"192.168.0.0/16",
|
|
3445
|
-
"198.18.0.0/15",
|
|
3446
|
-
"224.0.0.0/4",
|
|
3447
|
-
"240.0.0.0/4"
|
|
3448
|
-
].map(ipv4Range);
|
|
3449
|
-
var REFUSED_IPV6 = [
|
|
3450
|
-
"::/128",
|
|
3451
|
-
"::1/128",
|
|
3452
|
-
"fc00::/7",
|
|
3453
|
-
"fe80::/10",
|
|
3454
|
-
"fec0::/10",
|
|
3455
|
-
"ff00::/8",
|
|
3456
|
-
"2001::/32",
|
|
3457
|
-
"2002::/16",
|
|
3458
|
-
"64:ff9b:1::/48"
|
|
3459
|
-
].map(ipv6Range);
|
|
3460
|
-
var IPV4_EMBEDDINGS = ["::ffff:0:0/96", "::/96", "64:ff9b::/96"].map(ipv6Range);
|
|
3461
3567
|
var U64_MAX = 2n ** 64n - 1n;
|
|
3462
3568
|
var ED25519_L = 2n ** 252n + 27742317777372353535851937790883648493n;
|
|
3463
3569
|
|