@escro/mcp 0.1.1 → 0.1.3

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/package.json CHANGED
@@ -1,13 +1,31 @@
1
1
  {
2
2
  "name": "@escro/mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Model Context Protocol server exposing the escro.ai API as MCP tools",
5
5
  "mcpName": "ai.escro/escro",
6
6
  "license": "MIT",
7
+ "homepage": "https://escro.ai",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/escro-ai/escro.ai",
11
+ "directory": "packages/mcp"
12
+ },
13
+ "keywords": [
14
+ "mcp",
15
+ "model-context-protocol",
16
+ "escro",
17
+ "escrow",
18
+ "solana",
19
+ "usdc",
20
+ "ai-agents"
21
+ ],
7
22
  "type": "module",
8
23
  "publishConfig": {
9
24
  "access": "public"
10
25
  },
26
+ "engines": {
27
+ "node": ">=22"
28
+ },
11
29
  "bin": {
12
30
  "escro-mcp": "./dist/index.cjs"
13
31
  },
@@ -32,26 +50,36 @@
32
50
  "types"
33
51
  ],
34
52
  "dependencies": {
35
- "@modelcontextprotocol/sdk": "^1.0.0",
53
+ "@modelcontextprotocol/sdk": "^1.32.2",
54
+ "@solana/kit": "8.6.0",
36
55
  "@solana/web3.js": "^1.98.0",
56
+ "@x402/core": "2.29.0",
57
+ "@x402/svm": "2.29.0",
37
58
  "bs58": "^5.0.0",
38
59
  "zod": "^3.23.0"
39
60
  },
61
+ "peerDependencies": {
62
+ "@escro/sdk": "^0.5.0"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "@escro/sdk": {
66
+ "optional": true
67
+ }
68
+ },
40
69
  "devDependencies": {
41
- "@vitest/coverage-v8": "^4.0.0",
42
- "tsup": "^8.0.0",
43
- "vitest": "^4.0.0",
44
- "@escro/sdk": "0.2.0",
45
- "@escro/shared": "0.1.0"
70
+ "@escro/sdk": "0.5.0",
71
+ "@escro/shared": "0.1.0",
72
+ "tsup": "^9.0.0",
73
+ "vitest": "^4.0.0"
46
74
  },
47
75
  "scripts": {
48
76
  "build": "tsup",
49
- "typecheck": "tsc --noEmit && tsc -p tsconfig.type-contract.json",
77
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.type-contract.json && tsc -p examples/tsconfig.json",
50
78
  "test": "vitest run",
51
- "lint": "eslint src",
52
- "lint:fix": "eslint src --fix",
53
- "format": "prettier --write src type-contract.ts",
54
- "format:check": "prettier --check src type-contract.ts",
79
+ "lint": "eslint src type-contract.ts examples/examples.test.ts examples/*/confirm.ts",
80
+ "lint:fix": "eslint src type-contract.ts examples/examples.test.ts examples/*/confirm.ts --fix",
81
+ "format": "prettier --write src type-contract.ts examples",
82
+ "format:check": "prettier --check src type-contract.ts examples",
55
83
  "clean": "rm -rf dist *.tsbuildinfo"
56
84
  }
57
85
  }
package/types/env.d.ts CHANGED
@@ -1,12 +1,23 @@
1
1
  import type { Keypair } from "@solana/web3.js";
2
- import type { SolanaCluster } from "@escro/shared";
3
2
 
4
3
  export interface McpEnv {
5
4
  apiUrl: string;
6
5
  rpcUrl: string;
7
- /** Solana cluster (devnet/mainnet) the SDK targets for program ID + USDC mint. */
8
- cluster: SolanaCluster;
6
+ /** Solana cluster the SDK targets for program ID + USDC mint. */
7
+ cluster: "devnet" | "mainnet";
9
8
  /** Wallet keypair, or null when running in read-only mode. */
10
9
  wallet: Keypair | null;
10
+ /**
11
+ * `ESCRO_SPEND_CAP_USDC` in micro-USDC: the most the wallet may hold in open escrows,
12
+ * deposits (amount plus fee) counted. Unset, a mainnet create_escrow is refused.
13
+ */
14
+ spendCapMicroUsdc?: number;
15
+ /**
16
+ * Registers verify_escrow_onchain, which reads the chain through `rpcUrl`. Set by `loadEnv` (the
17
+ * stdio server); the API's hosted server leaves it unset, so its RPC serves no anonymous reads.
18
+ */
19
+ chainRead?: boolean;
20
+ /** `ESCRO_PAY_402_ALLOW_PRIVATE_HOSTS=1`: pay_402 may reach loopback, link-local and private hosts. */
21
+ pay402AllowPrivateHosts?: boolean;
11
22
  }
12
23
  export function loadEnv(): McpEnv;
package/types/server.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import type { McpEnv } from "./env.js";
3
3
 
4
+ /** Keep in step with package.json / server.json. */
5
+ export declare const SERVER_VERSION: "0.1.3";
6
+
4
7
  export function buildServer(env: McpEnv): McpServer;
package/types/tools.d.ts CHANGED
@@ -1,14 +1,97 @@
1
1
  import type { z } from "zod";
2
- import type { ApiClient, Escro } from "@escro/sdk";
2
+ import type { ApiClient, Escro, EscrowState } from "@escro/sdk";
3
3
 
4
4
  export declare const listEscrowsSchema: Record<string, z.ZodType>;
5
5
  export declare const getEscrowSchema: Record<string, z.ZodType>;
6
+ export declare const listBotsSchema: Record<string, z.ZodType>;
7
+ export declare const getReputationSchema: Record<string, z.ZodType>;
8
+ export declare const verifyEscrowOnchainSchema: Record<string, z.ZodType>;
6
9
  export declare const createEscrowSchema: Record<string, z.ZodType>;
7
10
  export declare const claimTaskSchema: Record<string, z.ZodType>;
8
11
  export declare const submitDeliverableSchema: Record<string, z.ZodType>;
9
12
  export declare const releasePaymentSchema: Record<string, z.ZodType>;
10
13
  export declare const cancelEscrowSchema: Record<string, z.ZodType>;
11
14
  export declare const raiseDisputeSchema: Record<string, z.ZodType>;
15
+ export declare const pay402Schema: Record<string, z.ZodType>;
12
16
 
13
- export function makeReadHandlers(api: ApiClient): Record<string, (...args: any[]) => Promise<any>>;
14
- export function makeWriteHandlers(escro: Escro): Record<string, (...args: any[]) => Promise<any>>;
17
+ /** A tool result: one text block holding the JSON-encoded value (bigints as strings). */
18
+ export interface ToolResult {
19
+ content: { type: "text"; text: string }[];
20
+ }
21
+
22
+ export interface ReadHandlers {
23
+ list_escrows: (args: {
24
+ state?: EscrowState | undefined;
25
+ assignedTo?: string | undefined;
26
+ limit?: number | undefined;
27
+ offset?: number | undefined;
28
+ mine?: boolean | undefined;
29
+ }) => Promise<ToolResult>;
30
+ get_escrow: (args: { address: string }) => Promise<ToolResult>;
31
+ list_bots: (args: {
32
+ capability?: string | undefined;
33
+ role?: "worker" | "buyer" | "both" | undefined;
34
+ limit?: number | undefined;
35
+ offset?: number | undefined;
36
+ }) => Promise<ToolResult>;
37
+ get_reputation: (args: { wallet: string }) => Promise<ToolResult>;
38
+ }
39
+
40
+ export interface WriteHandlers {
41
+ create_escrow: (args: {
42
+ taskSpec: unknown;
43
+ amountUsdc: number;
44
+ deadlineUnix: number;
45
+ assignedWorker: string;
46
+ }) => Promise<ToolResult>;
47
+ claim_task: (args: { address: string }) => Promise<ToolResult>;
48
+ submit_deliverable: (args: {
49
+ address: string;
50
+ contentHash: string;
51
+ proofUri?: string | undefined;
52
+ }) => Promise<ToolResult>;
53
+ release_payment: (args: { address: string }) => Promise<ToolResult>;
54
+ cancel_escrow: (args: { address: string }) => Promise<ToolResult>;
55
+ raise_dispute: (args: {
56
+ address: string;
57
+ reason: string;
58
+ evidence?: string | undefined;
59
+ }) => Promise<ToolResult>;
60
+ pay_402: (args: {
61
+ url: string;
62
+ to: string;
63
+ amountMicroUsdc: number;
64
+ method?: "GET" | "POST" | undefined;
65
+ contentType?: string | undefined;
66
+ body?: string | undefined;
67
+ maxDeadlineSeconds?: number | undefined;
68
+ }) => Promise<ToolResult>;
69
+ }
70
+
71
+ export interface ChainReadHandlers {
72
+ verify_escrow_onchain: (args: {
73
+ address?: string | undefined;
74
+ buyer?: string | undefined;
75
+ taskId?: string | undefined;
76
+ }) => Promise<ToolResult>;
77
+ }
78
+
79
+ export interface ReadHandlerOptions {
80
+ /** The server wallet's base-58 address; absent, list_escrows refuses `mine`. */
81
+ wallet?: string;
82
+ }
83
+ export function makeReadHandlers(api: ApiClient, options?: ReadHandlerOptions): ReadHandlers;
84
+ export function makeChainReadHandlers(env: {
85
+ cluster: "devnet" | "mainnet";
86
+ rpcUrl: string;
87
+ }): ChainReadHandlers;
88
+ export interface WriteHandlerOptions {
89
+ /**
90
+ * The cluster the Escro targets; absent, pay_402 applies mainnet's https rule, and its policy
91
+ * admits only mainnet entries, so a devnet 402 is refused with nothing funded.
92
+ */
93
+ cluster?: "devnet" | "mainnet";
94
+ /** Admit loopback, link-local and private hosts in pay_402; absent, refused. */
95
+ allowPrivateHosts?: boolean;
96
+ }
97
+ export function makeWriteHandlers(escro: Escro, options?: WriteHandlerOptions): WriteHandlers;