@ampersend_ai/ampersend-sdk 0.0.16 → 0.0.21
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/dist/ampersend/approval.d.ts +8 -8
- package/dist/ampersend/approval.d.ts.map +1 -1
- package/dist/ampersend/approval.js +10 -15
- package/dist/ampersend/approval.js.map +1 -1
- package/dist/ampersend/client.d.ts +4 -9
- package/dist/ampersend/client.d.ts.map +1 -1
- package/dist/ampersend/client.js +25 -21
- package/dist/ampersend/client.js.map +1 -1
- package/dist/ampersend/treasurer.d.ts +14 -79
- package/dist/ampersend/treasurer.d.ts.map +1 -1
- package/dist/ampersend/treasurer.js +34 -102
- package/dist/ampersend/treasurer.js.map +1 -1
- package/dist/ampersend/types.d.ts +356 -338
- package/dist/ampersend/types.d.ts.map +1 -1
- package/dist/ampersend/types.js +120 -150
- package/dist/ampersend/types.js.map +1 -1
- package/dist/ampersend/zod-bridge.d.ts +15 -0
- package/dist/ampersend/zod-bridge.d.ts.map +1 -0
- package/dist/ampersend/zod-bridge.js +29 -0
- package/dist/ampersend/zod-bridge.js.map +1 -0
- package/dist/cli/commands/fetch.d.ts.map +1 -1
- package/dist/cli/commands/fetch.js.map +1 -1
- package/dist/cli/commands/setup.d.ts +4 -0
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +52 -7
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/client/client.d.ts +0 -3
- package/dist/mcp/client/client.d.ts.map +1 -1
- package/dist/mcp/client/client.js +10 -14
- package/dist/mcp/client/client.js.map +1 -1
- package/dist/mcp/client/factory.d.ts +0 -2
- package/dist/mcp/client/factory.d.ts.map +1 -1
- package/dist/mcp/client/factory.js +0 -3
- package/dist/mcp/client/factory.js.map +1 -1
- package/dist/mcp/client/middleware.d.ts +0 -3
- package/dist/mcp/client/middleware.d.ts.map +1 -1
- package/dist/mcp/client/middleware.js +9 -12
- package/dist/mcp/client/middleware.js.map +1 -1
- package/dist/mcp/client/protocol.d.ts +81 -85
- package/dist/mcp/client/protocol.d.ts.map +1 -1
- package/dist/mcp/client/protocol.js +17 -15
- package/dist/mcp/client/protocol.js.map +1 -1
- package/dist/mcp/client/types.d.ts +6 -19
- package/dist/mcp/client/types.d.ts.map +1 -1
- package/dist/mcp/proxy/cli.d.ts.map +1 -1
- package/dist/mcp/proxy/cli.js +0 -1
- package/dist/mcp/proxy/cli.js.map +1 -1
- package/dist/mcp/proxy/env.d.ts +0 -9
- package/dist/mcp/proxy/env.d.ts.map +1 -1
- package/dist/mcp/proxy/env.js +0 -2
- package/dist/mcp/proxy/env.js.map +1 -1
- package/dist/mcp/proxy/factory.d.ts +0 -2
- package/dist/mcp/proxy/factory.d.ts.map +1 -1
- package/dist/mcp/proxy/factory.js +0 -3
- package/dist/mcp/proxy/factory.js.map +1 -1
- package/dist/mcp/server/fastmcp/middleware.d.ts +9 -29
- package/dist/mcp/server/fastmcp/middleware.d.ts.map +1 -1
- package/dist/mcp/server/fastmcp/middleware.js +10 -42
- package/dist/mcp/server/fastmcp/middleware.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/x402/envelopes.d.ts +62 -0
- package/dist/x402/envelopes.d.ts.map +1 -0
- package/dist/x402/envelopes.js +73 -0
- package/dist/x402/envelopes.js.map +1 -0
- package/dist/x402/http/client.d.ts +37 -0
- package/dist/x402/http/client.d.ts.map +1 -0
- package/dist/x402/http/client.js +159 -0
- package/dist/x402/http/client.js.map +1 -0
- package/dist/x402/http/factory.d.ts +11 -25
- package/dist/x402/http/factory.d.ts.map +1 -1
- package/dist/x402/http/factory.js +11 -22
- package/dist/x402/http/factory.js.map +1 -1
- package/dist/x402/http/index.d.ts +4 -1
- package/dist/x402/http/index.d.ts.map +1 -1
- package/dist/x402/http/index.js +2 -1
- package/dist/x402/http/index.js.map +1 -1
- package/dist/x402/index.d.ts +4 -1
- package/dist/x402/index.d.ts.map +1 -1
- package/dist/x402/index.js +3 -2
- package/dist/x402/index.js.map +1 -1
- package/dist/x402/treasurer.d.ts +22 -47
- package/dist/x402/treasurer.d.ts.map +1 -1
- package/dist/x402/treasurers/naive.d.ts +4 -40
- package/dist/x402/treasurers/naive.d.ts.map +1 -1
- package/dist/x402/treasurers/naive.js +7 -44
- package/dist/x402/treasurers/naive.js.map +1 -1
- package/dist/x402/wallet.d.ts +7 -32
- package/dist/x402/wallet.d.ts.map +1 -1
- package/dist/x402/wallet.js +0 -3
- package/dist/x402/wallet.js.map +1 -1
- package/dist/x402/wallets/account/wallet.d.ts +9 -30
- package/dist/x402/wallets/account/wallet.d.ts.map +1 -1
- package/dist/x402/wallets/account/wallet.js +30 -37
- package/dist/x402/wallets/account/wallet.js.map +1 -1
- package/dist/x402/wallets/index.d.ts +0 -1
- package/dist/x402/wallets/index.d.ts.map +1 -1
- package/dist/x402/wallets/index.js +0 -1
- package/dist/x402/wallets/index.js.map +1 -1
- package/dist/x402/wallets/smart-account/chain.d.ts +4 -0
- package/dist/x402/wallets/smart-account/chain.d.ts.map +1 -0
- package/dist/x402/wallets/smart-account/chain.js +12 -0
- package/dist/x402/wallets/smart-account/chain.js.map +1 -0
- package/dist/x402/wallets/smart-account/cosigned.d.ts +7 -33
- package/dist/x402/wallets/smart-account/cosigned.d.ts.map +1 -1
- package/dist/x402/wallets/smart-account/cosigned.js +28 -51
- package/dist/x402/wallets/smart-account/cosigned.js.map +1 -1
- package/dist/x402/wallets/smart-account/exact.d.ts +6 -20
- package/dist/x402/wallets/smart-account/exact.d.ts.map +1 -1
- package/dist/x402/wallets/smart-account/exact.js +33 -43
- package/dist/x402/wallets/smart-account/exact.js.map +1 -1
- package/dist/x402/wallets/smart-account/wallet.d.ts +6 -39
- package/dist/x402/wallets/smart-account/wallet.d.ts.map +1 -1
- package/dist/x402/wallets/smart-account/wallet.js +9 -36
- package/dist/x402/wallets/smart-account/wallet.js.map +1 -1
- package/package.json +8 -6
- package/dist/x402/http/adapter.d.ts +0 -38
- package/dist/x402/http/adapter.d.ts.map +0 -1
- package/dist/x402/http/adapter.js +0 -199
- package/dist/x402/http/adapter.js.map +0 -1
- package/dist/x402/http/v2-adapter.d.ts +0 -56
- package/dist/x402/http/v2-adapter.d.ts.map +0 -1
- package/dist/x402/http/v2-adapter.js +0 -94
- package/dist/x402/http/v2-adapter.js.map +0 -1
|
@@ -1,170 +1,166 @@
|
|
|
1
1
|
import { type JSONRPCMessage, type JSONRPCRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type PaymentPayloadV1 as V1PaymentPayload } from "@x402/core/schemas";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import type { PaymentAuthorization } from "../../x402/envelopes.ts";
|
|
4
5
|
import type { X402Response } from "./types.ts";
|
|
5
6
|
export declare const McpX402PaymentResponseSchema: z.ZodObject<{
|
|
6
7
|
"x402/payment-response": z.ZodObject<{
|
|
7
8
|
success: z.ZodBoolean;
|
|
8
|
-
errorReason: z.ZodOptional<z.ZodEnum<["insufficient_funds", "invalid_exact_evm_payload_authorization_valid_after", "invalid_exact_evm_payload_authorization_valid_before", "invalid_exact_evm_payload_authorization_value", "invalid_exact_evm_payload_signature", "invalid_exact_evm_payload_recipient_mismatch", "invalid_exact_svm_payload_transaction", "invalid_exact_svm_payload_transaction_amount_mismatch", "invalid_exact_svm_payload_transaction_create_ata_instruction", "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee", "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset", "invalid_exact_svm_payload_transaction_instructions", "invalid_exact_svm_payload_transaction_instructions_length", "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction", "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction", "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high", "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked", "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked", "invalid_exact_svm_payload_transaction_not_a_transfer_instruction", "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata", "invalid_exact_svm_payload_transaction_receiver_ata_not_found", "invalid_exact_svm_payload_transaction_sender_ata_not_found", "invalid_exact_svm_payload_transaction_simulation_failed", "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata", "invalid_network", "invalid_payload", "invalid_payment_requirements", "invalid_scheme", "invalid_payment", "payment_expired", "unsupported_scheme", "invalid_x402_version", "invalid_transaction_state", "invalid_x402_version", "settle_exact_svm_block_height_exceeded", "settle_exact_svm_transaction_confirmation_timed_out", "unsupported_scheme", "unexpected_settle_error", "unexpected_verify_error"]>>;
|
|
9
|
-
payer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
10
9
|
transaction: z.ZodString;
|
|
11
|
-
network: z.
|
|
10
|
+
network: z.ZodString;
|
|
11
|
+
errorReason: z.ZodOptional<z.ZodString>;
|
|
12
|
+
payer: z.ZodOptional<z.ZodString>;
|
|
12
13
|
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
|
|
14
|
+
network: string;
|
|
14
15
|
success: boolean;
|
|
15
|
-
|
|
16
|
+
transaction: string;
|
|
17
|
+
errorReason?: string | undefined;
|
|
16
18
|
payer?: string | undefined;
|
|
17
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
18
19
|
}, {
|
|
19
|
-
|
|
20
|
+
network: string;
|
|
20
21
|
success: boolean;
|
|
21
|
-
|
|
22
|
+
transaction: string;
|
|
23
|
+
errorReason?: string | undefined;
|
|
22
24
|
payer?: string | undefined;
|
|
23
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
24
25
|
}>;
|
|
25
26
|
}, "strip", z.ZodTypeAny, {
|
|
26
27
|
"x402/payment-response": {
|
|
27
|
-
|
|
28
|
+
network: string;
|
|
28
29
|
success: boolean;
|
|
29
|
-
|
|
30
|
+
transaction: string;
|
|
31
|
+
errorReason?: string | undefined;
|
|
30
32
|
payer?: string | undefined;
|
|
31
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
32
33
|
};
|
|
33
34
|
}, {
|
|
34
35
|
"x402/payment-response": {
|
|
35
|
-
|
|
36
|
+
network: string;
|
|
36
37
|
success: boolean;
|
|
37
|
-
|
|
38
|
+
transaction: string;
|
|
39
|
+
errorReason?: string | undefined;
|
|
38
40
|
payer?: string | undefined;
|
|
39
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
40
41
|
};
|
|
41
42
|
}>;
|
|
42
43
|
export type McpX402PaymentResponse = z.infer<typeof McpX402PaymentResponseSchema>;
|
|
44
|
+
/** 402 body embedded in the JSON-RPC `error.data`, optionally with a settle response. */
|
|
43
45
|
export declare const McpX402PaymentRequiredSchema: z.ZodObject<{
|
|
44
|
-
x402Version: z.
|
|
45
|
-
error: z.ZodOptional<z.
|
|
46
|
-
accepts: z.
|
|
47
|
-
scheme: z.
|
|
48
|
-
network: z.
|
|
49
|
-
maxAmountRequired: z.
|
|
46
|
+
x402Version: z.ZodLiteral<1>;
|
|
47
|
+
error: z.ZodOptional<z.ZodString>;
|
|
48
|
+
accepts: z.ZodArray<z.ZodObject<{
|
|
49
|
+
scheme: z.ZodString;
|
|
50
|
+
network: z.ZodString;
|
|
51
|
+
maxAmountRequired: z.ZodString;
|
|
50
52
|
resource: z.ZodString;
|
|
51
53
|
description: z.ZodString;
|
|
52
|
-
mimeType: z.ZodString
|
|
53
|
-
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
54
|
-
payTo: z.
|
|
54
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
55
|
+
outputSchema: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
56
|
+
payTo: z.ZodString;
|
|
55
57
|
maxTimeoutSeconds: z.ZodNumber;
|
|
56
|
-
asset: z.
|
|
57
|
-
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
58
|
+
asset: z.ZodString;
|
|
59
|
+
extra: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
58
60
|
}, "strip", z.ZodTypeAny, {
|
|
59
|
-
scheme: "exact";
|
|
60
61
|
description: string;
|
|
61
|
-
|
|
62
|
+
scheme: string;
|
|
63
|
+
network: string;
|
|
62
64
|
maxAmountRequired: string;
|
|
63
65
|
resource: string;
|
|
64
|
-
mimeType: string;
|
|
65
66
|
payTo: string;
|
|
66
67
|
maxTimeoutSeconds: number;
|
|
67
68
|
asset: string;
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
mimeType?: string | undefined;
|
|
70
|
+
outputSchema?: Record<string, unknown> | null | undefined;
|
|
71
|
+
extra?: Record<string, unknown> | null | undefined;
|
|
70
72
|
}, {
|
|
71
|
-
scheme: "exact";
|
|
72
73
|
description: string;
|
|
73
|
-
|
|
74
|
+
scheme: string;
|
|
75
|
+
network: string;
|
|
74
76
|
maxAmountRequired: string;
|
|
75
77
|
resource: string;
|
|
76
|
-
mimeType: string;
|
|
77
78
|
payTo: string;
|
|
78
79
|
maxTimeoutSeconds: number;
|
|
79
80
|
asset: string;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
mimeType?: string | undefined;
|
|
82
|
+
outputSchema?: Record<string, unknown> | null | undefined;
|
|
83
|
+
extra?: Record<string, unknown> | null | undefined;
|
|
84
|
+
}>, "many">;
|
|
84
85
|
} & {
|
|
85
86
|
"x402/payment-response": z.ZodOptional<z.ZodObject<{
|
|
86
87
|
success: z.ZodBoolean;
|
|
87
|
-
errorReason: z.ZodOptional<z.ZodEnum<["insufficient_funds", "invalid_exact_evm_payload_authorization_valid_after", "invalid_exact_evm_payload_authorization_valid_before", "invalid_exact_evm_payload_authorization_value", "invalid_exact_evm_payload_signature", "invalid_exact_evm_payload_recipient_mismatch", "invalid_exact_svm_payload_transaction", "invalid_exact_svm_payload_transaction_amount_mismatch", "invalid_exact_svm_payload_transaction_create_ata_instruction", "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee", "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset", "invalid_exact_svm_payload_transaction_instructions", "invalid_exact_svm_payload_transaction_instructions_length", "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction", "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction", "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high", "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked", "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked", "invalid_exact_svm_payload_transaction_not_a_transfer_instruction", "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata", "invalid_exact_svm_payload_transaction_receiver_ata_not_found", "invalid_exact_svm_payload_transaction_sender_ata_not_found", "invalid_exact_svm_payload_transaction_simulation_failed", "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata", "invalid_network", "invalid_payload", "invalid_payment_requirements", "invalid_scheme", "invalid_payment", "payment_expired", "unsupported_scheme", "invalid_x402_version", "invalid_transaction_state", "invalid_x402_version", "settle_exact_svm_block_height_exceeded", "settle_exact_svm_transaction_confirmation_timed_out", "unsupported_scheme", "unexpected_settle_error", "unexpected_verify_error"]>>;
|
|
88
|
-
payer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
89
88
|
transaction: z.ZodString;
|
|
90
|
-
network: z.
|
|
89
|
+
network: z.ZodString;
|
|
90
|
+
errorReason: z.ZodOptional<z.ZodString>;
|
|
91
|
+
payer: z.ZodOptional<z.ZodString>;
|
|
91
92
|
}, "strip", z.ZodTypeAny, {
|
|
92
|
-
|
|
93
|
+
network: string;
|
|
93
94
|
success: boolean;
|
|
94
|
-
|
|
95
|
+
transaction: string;
|
|
96
|
+
errorReason?: string | undefined;
|
|
95
97
|
payer?: string | undefined;
|
|
96
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
97
98
|
}, {
|
|
98
|
-
|
|
99
|
+
network: string;
|
|
99
100
|
success: boolean;
|
|
100
|
-
|
|
101
|
+
transaction: string;
|
|
102
|
+
errorReason?: string | undefined;
|
|
101
103
|
payer?: string | undefined;
|
|
102
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
103
104
|
}>>;
|
|
104
105
|
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
x402Version:
|
|
106
|
-
|
|
107
|
-
"x402/payment-response"?: {
|
|
108
|
-
transaction: string;
|
|
109
|
-
success: boolean;
|
|
110
|
-
network: "base-sepolia" | "avalanche-fuji" | "base" | "sei" | "sei-testnet" | "polygon" | "polygon-amoy" | "peaq" | "avalanche" | "iotex" | "solana-devnet" | "solana";
|
|
111
|
-
payer?: string | undefined;
|
|
112
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
113
|
-
} | undefined;
|
|
114
|
-
accepts?: {
|
|
115
|
-
scheme: "exact";
|
|
106
|
+
x402Version: 1;
|
|
107
|
+
accepts: {
|
|
116
108
|
description: string;
|
|
117
|
-
|
|
109
|
+
scheme: string;
|
|
110
|
+
network: string;
|
|
118
111
|
maxAmountRequired: string;
|
|
119
112
|
resource: string;
|
|
120
|
-
mimeType: string;
|
|
121
113
|
payTo: string;
|
|
122
114
|
maxTimeoutSeconds: number;
|
|
123
115
|
asset: string;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
x402Version: number;
|
|
130
|
-
error?: "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
116
|
+
mimeType?: string | undefined;
|
|
117
|
+
outputSchema?: Record<string, unknown> | null | undefined;
|
|
118
|
+
extra?: Record<string, unknown> | null | undefined;
|
|
119
|
+
}[];
|
|
120
|
+
error?: string | undefined;
|
|
131
121
|
"x402/payment-response"?: {
|
|
132
|
-
|
|
122
|
+
network: string;
|
|
133
123
|
success: boolean;
|
|
134
|
-
|
|
124
|
+
transaction: string;
|
|
125
|
+
errorReason?: string | undefined;
|
|
135
126
|
payer?: string | undefined;
|
|
136
|
-
errorReason?: "invalid_exact_svm_payload_transaction" | "insufficient_funds" | "invalid_exact_evm_payload_authorization_valid_after" | "invalid_exact_evm_payload_authorization_valid_before" | "invalid_exact_evm_payload_authorization_value" | "invalid_exact_evm_payload_signature" | "invalid_exact_evm_payload_recipient_mismatch" | "invalid_exact_svm_payload_transaction_amount_mismatch" | "invalid_exact_svm_payload_transaction_create_ata_instruction" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" | "invalid_exact_svm_payload_transaction_instructions" | "invalid_exact_svm_payload_transaction_instructions_length" | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" | "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata" | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" | "invalid_exact_svm_payload_transaction_sender_ata_not_found" | "invalid_exact_svm_payload_transaction_simulation_failed" | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" | "invalid_network" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_payment" | "payment_expired" | "unsupported_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "settle_exact_svm_block_height_exceeded" | "settle_exact_svm_transaction_confirmation_timed_out" | "unexpected_settle_error" | "unexpected_verify_error" | undefined;
|
|
137
127
|
} | undefined;
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
}, {
|
|
129
|
+
x402Version: 1;
|
|
130
|
+
accepts: {
|
|
140
131
|
description: string;
|
|
141
|
-
|
|
132
|
+
scheme: string;
|
|
133
|
+
network: string;
|
|
142
134
|
maxAmountRequired: string;
|
|
143
135
|
resource: string;
|
|
144
|
-
mimeType: string;
|
|
145
136
|
payTo: string;
|
|
146
137
|
maxTimeoutSeconds: number;
|
|
147
138
|
asset: string;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
139
|
+
mimeType?: string | undefined;
|
|
140
|
+
outputSchema?: Record<string, unknown> | null | undefined;
|
|
141
|
+
extra?: Record<string, unknown> | null | undefined;
|
|
142
|
+
}[];
|
|
143
|
+
error?: string | undefined;
|
|
144
|
+
"x402/payment-response"?: {
|
|
145
|
+
network: string;
|
|
146
|
+
success: boolean;
|
|
147
|
+
transaction: string;
|
|
148
|
+
errorReason?: string | undefined;
|
|
149
|
+
payer?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
152
151
|
}>;
|
|
153
152
|
export type McpX402PaymentRequired = z.infer<typeof McpX402PaymentRequiredSchema>;
|
|
154
|
-
|
|
153
|
+
/** Embed a payment into a JSON-RPC request's `_meta`. MCP is v1-only; throws otherwise. */
|
|
154
|
+
export declare function buildMessageWithPayment(message: JSONRPCRequest, payment: PaymentAuthorization, paymentId: string): {
|
|
155
155
|
messageWithPayment: JSONRPCRequest;
|
|
156
156
|
};
|
|
157
157
|
export declare function paymentFromRequest(request: JSONRPCRequest): {
|
|
158
|
-
payment:
|
|
158
|
+
payment: V1PaymentPayload | null;
|
|
159
159
|
paymentId: string | null;
|
|
160
160
|
};
|
|
161
161
|
export declare function addMeta(request: JSONRPCRequest, k: string, v: unknown): JSONRPCRequest;
|
|
162
162
|
export declare function x402DataFromJSONRPCMessage(msg: JSONRPCMessage): McpX402PaymentResponse | McpX402PaymentRequired | null;
|
|
163
163
|
export declare function isMcpX402PaymentResponse(data: unknown): data is McpX402PaymentResponse;
|
|
164
164
|
export declare function isMcpX402PaymentRequired(data: unknown): data is McpX402PaymentRequired;
|
|
165
|
-
/**
|
|
166
|
-
* Type assertion for X402Response with runtime validation.
|
|
167
|
-
* Returns null if the data doesn't match the expected structure.
|
|
168
|
-
*/
|
|
169
165
|
export declare function asX402Response(obj: unknown): X402Response | null;
|
|
170
166
|
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/mcp/client/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/mcp/client/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAEL,KAAK,gBAAgB,IAAI,gBAAgB,EAE1C,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAW9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AG,YAAY,GAAG,IAAI,CAEhE"}
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { isJSONRPCError, isJSONRPCResponse, } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { PaymentRequiredV1Schema, } from "@x402/core/schemas";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
/** Local replica — `@x402/core` exports `SettleResponse` as a type only. */
|
|
5
|
+
const SettleResponseSchema = z.object({
|
|
6
|
+
success: z.boolean(),
|
|
7
|
+
transaction: z.string(),
|
|
8
|
+
network: z.string(),
|
|
9
|
+
errorReason: z.string().optional(),
|
|
10
|
+
payer: z.string().optional(),
|
|
11
|
+
});
|
|
4
12
|
export const McpX402PaymentResponseSchema = z.object({
|
|
5
13
|
"x402/payment-response": SettleResponseSchema,
|
|
6
14
|
});
|
|
7
|
-
|
|
15
|
+
/** 402 body embedded in the JSON-RPC `error.data`, optionally with a settle response. */
|
|
16
|
+
export const McpX402PaymentRequiredSchema = PaymentRequiredV1Schema.extend({
|
|
8
17
|
"x402/payment-response": SettleResponseSchema.optional(),
|
|
9
18
|
});
|
|
19
|
+
/** Embed a payment into a JSON-RPC request's `_meta`. MCP is v1-only; throws otherwise. */
|
|
10
20
|
export function buildMessageWithPayment(message, payment, paymentId) {
|
|
11
|
-
|
|
21
|
+
if (payment.protocol !== "x402-v1") {
|
|
22
|
+
throw new Error(`MCP meta requires an x402-v1 authorization; got ${payment.protocol}`);
|
|
23
|
+
}
|
|
24
|
+
const v1Payment = payment.data;
|
|
12
25
|
const base = message;
|
|
13
26
|
const baseParams = base.params || { _meta: {} };
|
|
14
27
|
const baseParamsMeta = baseParams._meta || {};
|
|
@@ -18,7 +31,7 @@ export function buildMessageWithPayment(message, payment, paymentId) {
|
|
|
18
31
|
...baseParams,
|
|
19
32
|
_meta: {
|
|
20
33
|
...baseParamsMeta,
|
|
21
|
-
"x402/payment":
|
|
34
|
+
"x402/payment": v1Payment,
|
|
22
35
|
"ampersend/paymentId": paymentId,
|
|
23
36
|
},
|
|
24
37
|
},
|
|
@@ -66,16 +79,9 @@ export function isMcpX402PaymentRequired(data) {
|
|
|
66
79
|
const result = McpX402PaymentRequiredSchema.safeParse(data);
|
|
67
80
|
return result.success;
|
|
68
81
|
}
|
|
69
|
-
// Type guards and validators
|
|
70
|
-
/**
|
|
71
|
-
* Type guard to check if a value is a valid PaymentRequirements array
|
|
72
|
-
*/
|
|
73
82
|
function isPaymentRequirementsArray(arr) {
|
|
74
83
|
return Array.isArray(arr) && arr.length > 0 && arr.every((req) => req && typeof req === "object" && "scheme" in req);
|
|
75
84
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Type guard to check if a value is a valid X402Response structure
|
|
78
|
-
*/
|
|
79
85
|
function isX402Response(obj) {
|
|
80
86
|
if (!obj || typeof obj !== "object")
|
|
81
87
|
return false;
|
|
@@ -84,10 +90,6 @@ function isX402Response(obj) {
|
|
|
84
90
|
const candidate = obj;
|
|
85
91
|
return typeof candidate.x402Version === "number" && isPaymentRequirementsArray(candidate.accepts);
|
|
86
92
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Type assertion for X402Response with runtime validation.
|
|
89
|
-
* Returns null if the data doesn't match the expected structure.
|
|
90
|
-
*/
|
|
91
93
|
export function asX402Response(obj) {
|
|
92
94
|
return isX402Response(obj) ? obj : null;
|
|
93
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/mcp/client/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,GAGlB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/mcp/client/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,GAGlB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,uBAAuB,GAGxB,MAAM,oBAAoB,CAAA;A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GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;AACzC,CAAC"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import type { ClientOptions as McpClientOptions } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PaymentPayloadV1, PaymentRequirementsV1 } from "@x402/core/schemas";
|
|
3
|
+
import type { SettleResponse } from "@x402/core/types";
|
|
3
4
|
import type { X402Treasurer } from "../../x402/treasurer.ts";
|
|
4
|
-
/**
|
|
5
|
-
* HTTP 402 response structure with payment requirements
|
|
6
|
-
* Matches the official MCP x402 specification PaymentRequirementsResponse
|
|
7
|
-
*/
|
|
5
|
+
/** Internal 402 shape embedded in JSON-RPC error data; wrapped into a `PaymentRequest` before the treasurer sees it. */
|
|
8
6
|
export interface X402Response {
|
|
9
7
|
readonly x402Version: number;
|
|
10
|
-
readonly accepts: ReadonlyArray<
|
|
8
|
+
readonly accepts: ReadonlyArray<PaymentRequirementsV1>;
|
|
11
9
|
readonly error?: string;
|
|
12
10
|
}
|
|
13
|
-
/**
|
|
14
|
-
* MCP-specific meta field types for x402 payments
|
|
15
|
-
* Used in request/response _meta fields according to official spec
|
|
16
|
-
*/
|
|
11
|
+
/** `_meta` fields the MCP x402 spec defines on requests/results. */
|
|
17
12
|
export interface X402MetaFields {
|
|
18
|
-
"x402/payment"?:
|
|
13
|
+
"x402/payment"?: PaymentPayloadV1;
|
|
19
14
|
"x402/payment-response"?: SettleResponse;
|
|
20
15
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Payment tracking events (for API compatibility)
|
|
23
|
-
*/
|
|
24
16
|
export type PaymentEvent = {
|
|
25
17
|
type: "sending";
|
|
26
18
|
} | {
|
|
@@ -32,13 +24,8 @@ export type PaymentEvent = {
|
|
|
32
24
|
type: "error";
|
|
33
25
|
reason: string;
|
|
34
26
|
};
|
|
35
|
-
/**
|
|
36
|
-
* Client options that wrap MCP options and add x402 payment handling
|
|
37
|
-
*/
|
|
38
27
|
export interface ClientOptions {
|
|
39
|
-
/** Standard MCP client options */
|
|
40
28
|
readonly mcpOptions: McpClientOptions;
|
|
41
|
-
/** X402Treasurer for handling payment decisions and status tracking */
|
|
42
29
|
readonly treasurer: X402Treasurer;
|
|
43
30
|
}
|
|
44
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mcp/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAClG,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mcp/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,wHAAwH;AACxH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAA;IACtD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,EAAE,gBAAgB,CAAA;IACjC,uBAAuB,CAAC,EAAE,cAAc,CAAA;CACzC;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAErC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAA;IACrC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAA;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/mcp/proxy/cli.ts"],"names":[],"mappings":";AAOA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9D,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAA;AAEnB;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,cAAc,GAAG,eAAe,CAM7G;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,cAAc,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/mcp/proxy/cli.ts"],"names":[],"mappings":";AAOA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9D,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAA;AAEnB;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,cAAc,GAAG,eAAe,CAM7G;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,cAAc,GAAG,YAAY,CAsB1E"}
|
package/dist/mcp/proxy/cli.js
CHANGED
|
@@ -41,7 +41,6 @@ export function createWalletConfig(envConfig) {
|
|
|
41
41
|
type: "smart-account",
|
|
42
42
|
smartAccountAddress: envConfig.BUYER_SMART_ACCOUNT_ADDRESS,
|
|
43
43
|
sessionKeyPrivateKey: envConfig.BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY,
|
|
44
|
-
chainId: envConfig.BUYER_SMART_ACCOUNT_CHAIN_ID ?? 84532,
|
|
45
44
|
validatorAddress: envConfig.BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS,
|
|
46
45
|
};
|
|
47
46
|
return smartAccountWalletConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/mcp/proxy/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,cAAc,EAAuB,MAAM,UAAU,CAAA;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAMN,MAAM,YAAY,CAAA;AAEnB;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA2B,EAAE,SAAyB;IAC1F,MAAM,IAAI,GAAG,OAAO,IAAI,SAAS,CAAC,IAAI,IAAI,IAAI,CAAA;IAC9C,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI;KACL,CAAA;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAyB;IAC1D,IAAI,CAAC,SAAS,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;IAC3E,CAAC;IAED,qBAAqB;IACrB,IAAI,SAAS,CAAC,2BAA2B,EAAE,CAAC;QAC1C,MAAM,wBAAwB,GAA6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,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAA;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/mcp/proxy/env.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
18
18
|
BUYER_SMART_ACCOUNT_ADDRESS: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
19
19
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
20
20
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>>;
|
|
21
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID: z.ZodOptional<z.ZodNumber>;
|
|
22
21
|
AMPERSEND_API_URL: z.ZodOptional<z.ZodString>;
|
|
23
22
|
}, "strip", z.ZodTypeAny, {
|
|
24
23
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS: string;
|
|
@@ -26,7 +25,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
26
25
|
BUYER_PRIVATE_KEY?: string | undefined;
|
|
27
26
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
28
27
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
29
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
30
28
|
AMPERSEND_API_URL?: string | undefined;
|
|
31
29
|
}, {
|
|
32
30
|
PORT?: number | undefined;
|
|
@@ -34,7 +32,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
34
32
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
35
33
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
36
34
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS?: string | undefined;
|
|
37
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
38
35
|
AMPERSEND_API_URL?: string | undefined;
|
|
39
36
|
}>, {
|
|
40
37
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS: string;
|
|
@@ -42,7 +39,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
42
39
|
BUYER_PRIVATE_KEY?: string | undefined;
|
|
43
40
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
44
41
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
45
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
46
42
|
AMPERSEND_API_URL?: string | undefined;
|
|
47
43
|
}, {
|
|
48
44
|
PORT?: number | undefined;
|
|
@@ -50,7 +46,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
50
46
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
51
47
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
52
48
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS?: string | undefined;
|
|
53
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
54
49
|
AMPERSEND_API_URL?: string | undefined;
|
|
55
50
|
}>, {
|
|
56
51
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS: string;
|
|
@@ -58,7 +53,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
58
53
|
BUYER_PRIVATE_KEY?: string | undefined;
|
|
59
54
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
60
55
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
61
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
62
56
|
AMPERSEND_API_URL?: string | undefined;
|
|
63
57
|
}, {
|
|
64
58
|
PORT?: number | undefined;
|
|
@@ -66,7 +60,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
66
60
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
67
61
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
68
62
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS?: string | undefined;
|
|
69
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
70
63
|
AMPERSEND_API_URL?: string | undefined;
|
|
71
64
|
}>, {
|
|
72
65
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS: string;
|
|
@@ -74,7 +67,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
74
67
|
BUYER_PRIVATE_KEY?: string | undefined;
|
|
75
68
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
76
69
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
77
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
78
70
|
AMPERSEND_API_URL?: string | undefined;
|
|
79
71
|
}, {
|
|
80
72
|
PORT?: number | undefined;
|
|
@@ -82,7 +74,6 @@ export declare function createEnvSchema(envPrefix?: string): z.ZodEffects<z.ZodE
|
|
|
82
74
|
BUYER_SMART_ACCOUNT_ADDRESS?: string | undefined;
|
|
83
75
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY?: string | undefined;
|
|
84
76
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS?: string | undefined;
|
|
85
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID?: number | undefined;
|
|
86
77
|
AMPERSEND_API_URL?: string | undefined;
|
|
87
78
|
}>;
|
|
88
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/mcp/proxy/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB;;;;;;GAMG;AAEH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,SAAK
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/mcp/proxy/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB;;;;;;GAMG;AAEH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,SAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoE7C;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAA;AAExE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,SAAS,SAAK,GAAG,cAAc,CAc7D"}
|
package/dist/mcp/proxy/env.js
CHANGED
|
@@ -42,7 +42,6 @@ export function createEnvSchema(envPrefix = "") {
|
|
|
42
42
|
})
|
|
43
43
|
.optional()
|
|
44
44
|
.default(OWNABLE_VALIDATOR),
|
|
45
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID: z.coerce.number().int().optional(),
|
|
46
45
|
AMPERSEND_API_URL: z.string().url().optional(),
|
|
47
46
|
})
|
|
48
47
|
.refine((data) => {
|
|
@@ -88,7 +87,6 @@ export function parseEnvConfig(envPrefix = "") {
|
|
|
88
87
|
BUYER_SMART_ACCOUNT_ADDRESS: process.env[`${envPrefix}BUYER_SMART_ACCOUNT_ADDRESS`],
|
|
89
88
|
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY: process.env[`${envPrefix}BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY`],
|
|
90
89
|
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS: process.env[`${envPrefix}BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS`],
|
|
91
|
-
BUYER_SMART_ACCOUNT_CHAIN_ID: process.env[`${envPrefix}BUYER_SMART_ACCOUNT_CHAIN_ID`],
|
|
92
90
|
AMPERSEND_API_URL: process.env[`${envPrefix}AMPERSEND_API_URL`],
|
|
93
91
|
};
|
|
94
92
|
// Validate with schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/mcp/proxy/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEpE;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,SAAS,GAAG,EAAE;IAC5C,OAAO,CAAC;SACL,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC1D,iBAAiB,EAAE,CAAC;aACjB,MAAM,EAAE;aACR,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACrC,OAAO,EAAE,GAAG,SAAS,sCAAsC;SAC5D,CAAC;aACD,QAAQ,EAAE;QACb,2BAA2B,EAAE,CAAC;aAC3B,MAAM,EAAE;aACR,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACrC,OAAO,EAAE,GAAG,SAAS,gDAAgD;SACtE,CAAC;aACD,QAAQ,E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;QAC9C,OAAO,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,2BAA2B,CAAA;IACnE,CAAC,EACD;QACE,OAAO,EACL,iDAAiD;YACjD,iBAAiB,SAAS,qBAAqB;YAC/C,2BAA2B,SAAS,+BAA+B;YACnE,GAAG,SAAS,wCAAwC,SAAS,oDAAoD;QACnH,IAAI,EAAE,CAAC,mBAAmB,CAAC;KAC5B,CACF,CAAA;AACL,CAAC;AAOD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAAS,GAAG,EAAE;IAC3C,4BAA4B;IAC5B,MAAM,OAAO,GAAuC;QAClD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,MAAM,CAAC;QACrC,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,mBAAmB,CAAC;QAC/D,2BAA2B,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,6BAA6B,CAAC;QACnF,mCAAmC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,qCAAqC,CAAC;QACnG,qCAAqC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,uCAAuC,CAAC;QACvG,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,mBAAmB,CAAC;KAChE,CAAA;IAED,uBAAuB;IACvB,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,CAAA;IACzC,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -18,8 +18,6 @@ export interface SimpleProxyOptions {
|
|
|
18
18
|
sessionKeyPrivateKey: Hex;
|
|
19
19
|
/** Ampersend API URL (defaults to production) */
|
|
20
20
|
apiUrl?: string;
|
|
21
|
-
/** Chain ID (defaults to Base Sepolia 84532) */
|
|
22
|
-
chainId?: number;
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
25
23
|
* Initialize an MCP proxy with minimal configuration.
|