@oobe-protocol-labs/sap-mcp-server 0.3.0 → 0.7.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/.env.example +3 -0
- package/CHANGELOG.md +222 -2
- package/README.md +63 -0
- package/USER_DOCS/00_START_HERE.md +23 -1
- package/USER_DOCS/01_HOSTED_REMOTE_MCP.md +4 -1
- package/USER_DOCS/03_PAYMENTS_X402_PAYSH.md +63 -7
- package/USER_DOCS/04_CLIENT_CONFIGS.md +134 -6
- package/USER_DOCS/06_DESKTOP_GUI_WIZARD.md +262 -0
- package/dist/adapters/mcp/sdk-compat.d.ts.map +1 -1
- package/dist/adapters/mcp/sdk-compat.js +32 -18
- package/dist/adapters/mcp/sdk-compat.js.map +1 -1
- package/dist/config/mcp-client-injection.d.ts +64 -2
- package/dist/config/mcp-client-injection.d.ts.map +1 -1
- package/dist/config/mcp-client-injection.js +668 -11
- package/dist/config/mcp-client-injection.js.map +1 -1
- package/dist/config/wizard.d.ts.map +1 -1
- package/dist/config/wizard.js +89 -5
- package/dist/config/wizard.js.map +1 -1
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/payments/facilitator-rpc-fallback.d.ts +43 -0
- package/dist/payments/facilitator-rpc-fallback.d.ts.map +1 -0
- package/dist/payments/facilitator-rpc-fallback.js +228 -0
- package/dist/payments/facilitator-rpc-fallback.js.map +1 -0
- package/dist/payments/json-rpc.d.ts.map +1 -1
- package/dist/payments/json-rpc.js +2 -1
- package/dist/payments/json-rpc.js.map +1 -1
- package/dist/payments/monetization-gate.d.ts +43 -2
- package/dist/payments/monetization-gate.d.ts.map +1 -1
- package/dist/payments/monetization-gate.js +618 -9
- package/dist/payments/monetization-gate.js.map +1 -1
- package/dist/payments/oobe-facilitator-server.d.ts +6 -0
- package/dist/payments/oobe-facilitator-server.d.ts.map +1 -1
- package/dist/payments/oobe-facilitator-server.js +79 -4
- package/dist/payments/oobe-facilitator-server.js.map +1 -1
- package/dist/payments/pricing.d.ts.map +1 -1
- package/dist/payments/pricing.js +1 -0
- package/dist/payments/pricing.js.map +1 -1
- package/dist/payments/usage-ledger.d.ts +10 -0
- package/dist/payments/usage-ledger.d.ts.map +1 -1
- package/dist/payments/usage-ledger.js +51 -0
- package/dist/payments/usage-ledger.js.map +1 -1
- package/dist/payments/x402-paid-call.d.ts +53 -0
- package/dist/payments/x402-paid-call.d.ts.map +1 -0
- package/dist/payments/x402-paid-call.js +370 -0
- package/dist/payments/x402-paid-call.js.map +1 -0
- package/dist/prompts/context/sap-agent-context.prompt.js +9 -3
- package/dist/prompts/context/sap-agent-context.prompt.js.map +1 -1
- package/dist/prompts/developer/debug-sap-error.prompt.js +1 -1
- package/dist/prompts/developer/debug-sap-error.prompt.js.map +1 -1
- package/dist/prompts/developer/generate-sap-integration.prompt.js +6 -2
- package/dist/prompts/developer/generate-sap-integration.prompt.js.map +1 -1
- package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js +1 -1
- package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js.map +1 -1
- package/dist/prompts/execution-proof/verify-execution-proof.prompt.js +1 -1
- package/dist/prompts/execution-proof/verify-execution-proof.prompt.js.map +1 -1
- package/dist/prompts/payments/create-paid-api.prompt.js +1 -1
- package/dist/prompts/payments/create-paid-api.prompt.js.map +1 -1
- package/dist/prompts/payments/explain-x402-settlement.prompt.js +1 -1
- package/dist/prompts/payments/explain-x402-settlement.prompt.js.map +1 -1
- package/dist/prompts/register-prompts.js +2 -2
- package/dist/prompts/register-prompts.js.map +1 -1
- package/dist/prompts/registry/analyze-sap-agent.prompt.js +1 -1
- package/dist/prompts/registry/analyze-sap-agent.prompt.js.map +1 -1
- package/dist/prompts/registry/register-sap-agent.prompt.js +2 -2
- package/dist/prompts/registry/register-sap-agent.prompt.js.map +1 -1
- package/dist/remote/server.d.ts +132 -1
- package/dist/remote/server.d.ts.map +1 -1
- package/dist/remote/server.js +930 -49
- package/dist/remote/server.js.map +1 -1
- package/dist/resources/current/sap-current-config.resource.d.ts.map +1 -1
- package/dist/resources/current/sap-current-config.resource.js +11 -1
- package/dist/resources/current/sap-current-config.resource.js.map +1 -1
- package/dist/resources/execution-proof/sap-execution-record.resource.js +1 -1
- package/dist/resources/execution-proof/sap-execution-record.resource.js.map +1 -1
- package/dist/resources/memory/sap-memory.resource.js +1 -1
- package/dist/resources/memory/sap-memory.resource.js.map +1 -1
- package/dist/resources/profile/sap-active-profile.resource.js +1 -1
- package/dist/resources/profile/sap-active-profile.resource.js.map +1 -1
- package/dist/resources/register-resources.js +2 -2
- package/dist/resources/register-resources.js.map +1 -1
- package/dist/resources/registry/sap-agent.resource.js +1 -1
- package/dist/resources/registry/sap-agent.resource.js.map +1 -1
- package/dist/resources/registry/sap-global-registry.resource.js +1 -1
- package/dist/resources/registry/sap-global-registry.resource.js.map +1 -1
- package/dist/resources/reputation/sap-reputation.resource.js +1 -1
- package/dist/resources/reputation/sap-reputation.resource.js.map +1 -1
- package/dist/resources/stats/sap-network-stats.resource.js +1 -1
- package/dist/resources/stats/sap-network-stats.resource.js.map +1 -1
- package/dist/resources/tool-schema/sap-tool-schema.resource.js +1 -1
- package/dist/resources/tool-schema/sap-tool-schema.resource.js.map +1 -1
- package/dist/sap/sap-client-manager.js +5 -5
- package/dist/sap/sap-client-manager.js.map +1 -1
- package/dist/security/tool-permissions.d.ts.map +1 -1
- package/dist/security/tool-permissions.js +1 -0
- package/dist/security/tool-permissions.js.map +1 -1
- package/dist/server/create-server.js +5 -5
- package/dist/server/create-server.js.map +1 -1
- package/dist/server/register-capabilities.js +4 -4
- package/dist/server/register-capabilities.js.map +1 -1
- package/dist/signer/signer-resolver.js +1 -1
- package/dist/signer/signer-resolver.js.map +1 -1
- package/dist/tools/client-sdk-tools.js +7 -7
- package/dist/tools/client-sdk-tools.js.map +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/magicblock-tools.d.ts +28 -0
- package/dist/tools/magicblock-tools.d.ts.map +1 -0
- package/dist/tools/magicblock-tools.js +578 -0
- package/dist/tools/magicblock-tools.js.map +1 -0
- package/dist/tools/profile-tools.d.ts.map +1 -1
- package/dist/tools/profile-tools.js +20 -0
- package/dist/tools/profile-tools.js.map +1 -1
- package/dist/tools/register-tools.d.ts.map +1 -1
- package/dist/tools/register-tools.js +11 -2
- package/dist/tools/register-tools.js.map +1 -1
- package/dist/tools/sap-sdk-tools.js +2 -2
- package/dist/tools/sap-sdk-tools.js.map +1 -1
- package/dist/tools/sap-sns-tools.js +2 -2
- package/dist/tools/sap-sns-tools.js.map +1 -1
- package/dist/tools/skills-tools.d.ts +1 -1
- package/dist/tools/skills-tools.d.ts.map +1 -1
- package/dist/tools/skills-tools.js +10 -1
- package/dist/tools/skills-tools.js.map +1 -1
- package/dist/tools/tool-aliases.d.ts +10 -0
- package/dist/tools/tool-aliases.d.ts.map +1 -0
- package/dist/tools/tool-aliases.js +23 -0
- package/dist/tools/tool-aliases.js.map +1 -0
- package/dist/tools/x402-paid-call-tool.d.ts +12 -0
- package/dist/tools/x402-paid-call-tool.d.ts.map +1 -0
- package/dist/tools/x402-paid-call-tool.js +118 -0
- package/dist/tools/x402-paid-call-tool.js.map +1 -0
- package/dist/wizard-core/desktop-flow.d.ts +82 -0
- package/dist/wizard-core/desktop-flow.d.ts.map +1 -0
- package/dist/wizard-core/desktop-flow.js +181 -0
- package/dist/wizard-core/desktop-flow.js.map +1 -0
- package/docs/00_README.md +3 -0
- package/docs/03_CONFIGURATION_AND_WIZARD.md +31 -5
- package/docs/06_PAYMENTS_X402_AND_PAYSH.md +70 -7
- package/docs/07_ENDPOINTS_AND_CLIENTS.md +28 -1
- package/docs/10_OPERATIONS_RELEASE_AND_PM2.md +7 -6
- package/docs/13_BOUNTY_PROGRAM_PROPOSAL.md +469 -0
- package/docs/14_DESKTOP_WIZARD_RELEASE.md +264 -0
- package/docs/README.md +104 -0
- package/docs/_sidebar.md +31 -0
- package/docs/magicblock-tools.md +166 -0
- package/docs/x402-protocol-spec.md +984 -0
- package/package.json +23 -2
- package/server.json +71 -0
- package/skills/sap-defi/SKILL.md +8 -0
- package/skills/sap-mcp/SKILL.md +30 -0
- package/skills/sap-payments-x402/SKILL.md +36 -4
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name FacilitatorRpcFallback
|
|
3
|
+
* @description Resilient RPC endpoint failover with round-robin and timeouts
|
|
4
|
+
* for x402 SVM facilitator operations.
|
|
5
|
+
*
|
|
6
|
+
* Strategy:
|
|
7
|
+
* 1. Round-robin — each call starts from the next endpoint in the rotation
|
|
8
|
+
* 2. Timeout — each attempt gets a configurable deadline (default 8s)
|
|
9
|
+
* 3. Failover — on transient errors or timeout, immediately tries the next endpoint
|
|
10
|
+
* 4. Multiple public mainnet RPCs are included as defaults to avoid rate limits
|
|
11
|
+
*/
|
|
12
|
+
import { logger, redactSensitiveString } from '../core/logger.js';
|
|
13
|
+
/** Per-attempt timeout in milliseconds. If an RPC doesn't respond in this window, we move to the next. */
|
|
14
|
+
const RPC_ATTEMPT_TIMEOUT_MS = 8_000;
|
|
15
|
+
/** Round-robin counter — shared across all operations so calls distribute across endpoints. */
|
|
16
|
+
let roundRobinIndex = 0;
|
|
17
|
+
/**
|
|
18
|
+
* @name createResilientFacilitatorSigner
|
|
19
|
+
* @description Wraps one or more facilitator signers with round-robin load balancing,
|
|
20
|
+
* per-attempt timeouts, and failover for transient RPC failures.
|
|
21
|
+
*/
|
|
22
|
+
export function createResilientFacilitatorSigner(endpoints) {
|
|
23
|
+
if (endpoints.length === 0) {
|
|
24
|
+
throw new Error('At least one facilitator RPC endpoint is required');
|
|
25
|
+
}
|
|
26
|
+
const primary = endpoints[0];
|
|
27
|
+
if (!primary) {
|
|
28
|
+
throw new Error('At least one facilitator RPC endpoint is required');
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
getAddresses: () => primary.signer.getAddresses(),
|
|
32
|
+
signTransaction: (transaction, feePayer, network) => primary.signer.signTransaction(transaction, feePayer, network),
|
|
33
|
+
simulateTransaction: (transaction, network) => runWithRoundRobin(endpoints, 'simulateTransaction', network, endpoint => endpoint.signer.simulateTransaction(transaction, network)),
|
|
34
|
+
sendTransaction: (transaction, network) => runWithRoundRobin(endpoints, 'sendTransaction', network, endpoint => endpoint.signer.sendTransaction(transaction, network)),
|
|
35
|
+
confirmTransaction: (signature, network) => runWithRoundRobin(endpoints, 'confirmTransaction', network, endpoint => endpoint.signer.confirmTransaction(signature, network)),
|
|
36
|
+
simulateTransactionWithInnerInstructions: async (transaction, feePayer, network) => runWithRoundRobin(endpoints, 'simulateTransactionWithInnerInstructions', network, endpoint => {
|
|
37
|
+
if (!endpoint.signer.simulateTransactionWithInnerInstructions) {
|
|
38
|
+
throw new Error('simulateTransactionWithInnerInstructions is not available on facilitator signer');
|
|
39
|
+
}
|
|
40
|
+
return endpoint.signer.simulateTransactionWithInnerInstructions(transaction, feePayer, network);
|
|
41
|
+
}),
|
|
42
|
+
getConfirmedTransactionInnerInstructions: async (signature, network) => runWithRoundRobin(endpoints, 'getConfirmedTransactionInnerInstructions', network, endpoint => {
|
|
43
|
+
if (!endpoint.signer.getConfirmedTransactionInnerInstructions) {
|
|
44
|
+
return Promise.resolve(null);
|
|
45
|
+
}
|
|
46
|
+
return endpoint.signer.getConfirmedTransactionInnerInstructions(signature, network);
|
|
47
|
+
}),
|
|
48
|
+
getTokenAccountBalance: async (tokenAccountAddress, network) => runWithRoundRobin(endpoints, 'getTokenAccountBalance', network, endpoint => {
|
|
49
|
+
if (!endpoint.signer.getTokenAccountBalance) {
|
|
50
|
+
return Promise.resolve(null);
|
|
51
|
+
}
|
|
52
|
+
return endpoint.signer.getTokenAccountBalance(tokenAccountAddress, network);
|
|
53
|
+
}),
|
|
54
|
+
fetchAddressLookupTables: async (lookupTableAddresses, network) => runWithRoundRobin(endpoints, 'fetchAddressLookupTables', network, endpoint => {
|
|
55
|
+
if (!endpoint.signer.fetchAddressLookupTables) {
|
|
56
|
+
throw new Error('fetchAddressLookupTables is not available on facilitator signer');
|
|
57
|
+
}
|
|
58
|
+
return endpoint.signer.fetchAddressLookupTables(lookupTableAddresses, network);
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @name parseRpcFallbackUrls
|
|
64
|
+
* @description Parses comma-separated RPC fallback URLs from environment variables or config files.
|
|
65
|
+
*/
|
|
66
|
+
export function parseRpcFallbackUrls(value) {
|
|
67
|
+
if (!value) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
return uniqueRpcUrls(value.split(',').map(item => item.trim()).filter(Boolean));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @name uniqueRpcUrls
|
|
74
|
+
* @description Deduplicates RPC URLs while preserving priority order.
|
|
75
|
+
*/
|
|
76
|
+
export function uniqueRpcUrls(urls) {
|
|
77
|
+
const seen = new Set();
|
|
78
|
+
const unique = [];
|
|
79
|
+
for (const url of urls) {
|
|
80
|
+
if (seen.has(url)) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
seen.add(url);
|
|
84
|
+
unique.push(url);
|
|
85
|
+
}
|
|
86
|
+
return unique;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @name isTransientRpcError
|
|
90
|
+
* @description Returns true when an error is likely caused by endpoint health, lag, throttling, or transport.
|
|
91
|
+
*/
|
|
92
|
+
export function isTransientRpcError(error) {
|
|
93
|
+
const message = getErrorMessage(error).toLowerCase();
|
|
94
|
+
if (!message) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (message.startsWith('simulation failed:')
|
|
98
|
+
&& !containsAny(message, [
|
|
99
|
+
'blockhash not found',
|
|
100
|
+
'minimum context slot',
|
|
101
|
+
'node is behind',
|
|
102
|
+
'behind by',
|
|
103
|
+
'fetch failed',
|
|
104
|
+
'slot was skipped',
|
|
105
|
+
'slot skipped',
|
|
106
|
+
])) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return containsAny(message, [
|
|
110
|
+
'fetch failed',
|
|
111
|
+
'network request failed',
|
|
112
|
+
'networkerror',
|
|
113
|
+
'socket hang up',
|
|
114
|
+
'connection closed',
|
|
115
|
+
'connection reset',
|
|
116
|
+
'connection refused',
|
|
117
|
+
'econnreset',
|
|
118
|
+
'econnrefused',
|
|
119
|
+
'etimedout',
|
|
120
|
+
'timeout',
|
|
121
|
+
'eai_again',
|
|
122
|
+
'too many requests',
|
|
123
|
+
'rate limit',
|
|
124
|
+
'forbidden',
|
|
125
|
+
'unauthorized',
|
|
126
|
+
'401',
|
|
127
|
+
'403',
|
|
128
|
+
'429',
|
|
129
|
+
'502',
|
|
130
|
+
'503',
|
|
131
|
+
'504',
|
|
132
|
+
'bad gateway',
|
|
133
|
+
'service unavailable',
|
|
134
|
+
'gateway timeout',
|
|
135
|
+
'node is behind',
|
|
136
|
+
'behind by',
|
|
137
|
+
'minimum context slot',
|
|
138
|
+
'slot was skipped',
|
|
139
|
+
'slot skipped',
|
|
140
|
+
'blockhash not found',
|
|
141
|
+
'failed to get latest blockhash',
|
|
142
|
+
'failed to get recent blockhash',
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
145
|
+
async function runWithRoundRobin(endpoints, operation, network, execute) {
|
|
146
|
+
if (endpoints.length === 0) {
|
|
147
|
+
throw new Error('No facilitator RPC endpoints configured');
|
|
148
|
+
}
|
|
149
|
+
// Advance the round-robin counter — each call starts from the next endpoint.
|
|
150
|
+
const startIndex = roundRobinIndex % endpoints.length;
|
|
151
|
+
roundRobinIndex = (roundRobinIndex + 1) % endpoints.length;
|
|
152
|
+
let lastError;
|
|
153
|
+
for (let attempt = 0; attempt < endpoints.length; attempt++) {
|
|
154
|
+
const index = (startIndex + attempt) % endpoints.length;
|
|
155
|
+
const endpoint = endpoints[index];
|
|
156
|
+
if (!endpoint)
|
|
157
|
+
continue;
|
|
158
|
+
try {
|
|
159
|
+
// Race the execution against a timeout — if the RPC is slow, we move on immediately.
|
|
160
|
+
const result = await withTimeout(execute(endpoint), RPC_ATTEMPT_TIMEOUT_MS, endpoint.label, operation);
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
lastError = error;
|
|
165
|
+
const hasNext = attempt < endpoints.length - 1;
|
|
166
|
+
const isTimeout = error instanceof RpcTimeoutError;
|
|
167
|
+
const isTransient = isTimeout || isTransientRpcError(error);
|
|
168
|
+
if (!hasNext || !isTransient) {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
logger.warn('x402 facilitator RPC endpoint failed; trying next (round-robin)', {
|
|
172
|
+
operation,
|
|
173
|
+
network,
|
|
174
|
+
endpoint: endpoint.rpcUrl ? redactSensitiveString(endpoint.rpcUrl) : endpoint.label,
|
|
175
|
+
reason: isTimeout ? 'timeout' : 'transient error',
|
|
176
|
+
error: isTimeout ? `Timed out after ${RPC_ATTEMPT_TIMEOUT_MS}ms` : getErrorMessage(error),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
throw lastError instanceof Error ? lastError : new Error(getErrorMessage(lastError));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Race a promise against a timeout. If the timeout fires, throw `RpcTimeoutError`.
|
|
184
|
+
*/
|
|
185
|
+
function withTimeout(promise, ms, label, operation) {
|
|
186
|
+
return new Promise((resolve, reject) => {
|
|
187
|
+
const timer = setTimeout(() => {
|
|
188
|
+
reject(new RpcTimeoutError(label, operation, ms));
|
|
189
|
+
}, ms);
|
|
190
|
+
promise
|
|
191
|
+
.then((result) => {
|
|
192
|
+
clearTimeout(timer);
|
|
193
|
+
resolve(result);
|
|
194
|
+
})
|
|
195
|
+
.catch((error) => {
|
|
196
|
+
clearTimeout(timer);
|
|
197
|
+
reject(error);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Custom error for RPC timeouts — treated as transient by the failover loop.
|
|
203
|
+
*/
|
|
204
|
+
class RpcTimeoutError extends Error {
|
|
205
|
+
label;
|
|
206
|
+
operation;
|
|
207
|
+
timeoutMs;
|
|
208
|
+
constructor(label, operation, timeoutMs) {
|
|
209
|
+
super(`RPC timeout: ${label} did not respond to ${operation} within ${timeoutMs}ms`);
|
|
210
|
+
this.name = 'RpcTimeoutError';
|
|
211
|
+
this.label = label;
|
|
212
|
+
this.operation = operation;
|
|
213
|
+
this.timeoutMs = timeoutMs;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function getErrorMessage(error) {
|
|
217
|
+
if (error instanceof Error) {
|
|
218
|
+
return error.message;
|
|
219
|
+
}
|
|
220
|
+
if (typeof error === 'string') {
|
|
221
|
+
return error;
|
|
222
|
+
}
|
|
223
|
+
return String(error);
|
|
224
|
+
}
|
|
225
|
+
function containsAny(message, needles) {
|
|
226
|
+
return needles.some(needle => message.includes(needle));
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=facilitator-rpc-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facilitator-rpc-fallback.js","sourceRoot":"","sources":["../../src/payments/facilitator-rpc-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAqBlE,0GAA0G;AAC1G,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC,+FAA+F;AAC/F,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAAC,SAA4C;IAC3F,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,OA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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-rpc.d.ts","sourceRoot":"","sources":["../../src/payments/json-rpc.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"json-rpc.d.ts","sourceRoot":"","sources":["../../src/payments/json-rpc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,CA0ChE"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @name JsonRpcPaymentIntrospection
|
|
3
3
|
* @description Small JSON-RPC helpers used by the remote monetization gate without coupling payment logic to MCP tools.
|
|
4
4
|
*/
|
|
5
|
+
import { canonicalizeToolName } from '../tools/tool-aliases.js';
|
|
5
6
|
/**
|
|
6
7
|
* @name isRecord
|
|
7
8
|
* @description Checks whether a value can be treated as a plain object for protocol introspection.
|
|
@@ -39,7 +40,7 @@ export function parseJsonRpcBody(body) {
|
|
|
39
40
|
}
|
|
40
41
|
toolCalls.push({
|
|
41
42
|
id: request.id,
|
|
42
|
-
toolName,
|
|
43
|
+
toolName: canonicalizeToolName(toolName),
|
|
43
44
|
arguments: request.params.arguments,
|
|
44
45
|
});
|
|
45
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-rpc.js","sourceRoot":"","sources":["../../src/payments/json-rpc.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"json-rpc.js","sourceRoot":"","sources":["../../src/payments/json-rpc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAwChE;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,MAAM,SAAS,GAAkB,EAAE,CAAC;IAEpC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACnE,SAAS;QACX,CAAC;QAED,MAAM,OAAO,GAAmB;YAC9B,OAAO,EAAE,UAAU,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YACzD,EAAE,EAAE,OAAO,UAAU,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,UAAU,CAAC,EAAE,KAAK,QAAQ,IAAI,UAAU,CAAC,EAAE,KAAK,IAAI;gBAClG,CAAC,CAAC,UAAU,CAAC,EAAE;gBACf,CAAC,CAAC,SAAS;YACb,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEvB,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACjE,SAAS;QACX,CAAC;QAED,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;QACrC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1D,SAAS;QACX,CAAC;QAED,SAAS,CAAC,IAAI,CAAC;YACb,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,CAAC;YACxC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS;SACpC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,QAAQ;QACR,SAAS;QACT,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;QAChD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -10,6 +10,33 @@ import type { PaymentDecision } from './pricing.js';
|
|
|
10
10
|
* @description Handler invoked after the payment gate has authorized or bypassed a request.
|
|
11
11
|
*/
|
|
12
12
|
export type McpRequestHandler = (request: http.IncomingMessage, response: http.ServerResponse, parsedBody?: unknown) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* @name McpPaidRequestValidationContext
|
|
15
|
+
* @description Context provided to hosted transports before a paid request reaches the x402 facilitator.
|
|
16
|
+
*/
|
|
17
|
+
export interface McpPaidRequestValidationContext {
|
|
18
|
+
request: http.IncomingMessage;
|
|
19
|
+
parsedBody: unknown;
|
|
20
|
+
decision: Extract<PaymentDecision, {
|
|
21
|
+
required: true;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @name McpPaidRequestValidationFailure
|
|
26
|
+
* @description JSON-RPC error returned when a paid request cannot safely enter the payment flow.
|
|
27
|
+
*/
|
|
28
|
+
export interface McpPaidRequestValidationFailure {
|
|
29
|
+
code: number;
|
|
30
|
+
message: string;
|
|
31
|
+
data?: unknown;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @name McpMonetizationGateOptions
|
|
35
|
+
* @description Optional hooks used by HTTP transports to fail closed before facilitator verification.
|
|
36
|
+
*/
|
|
37
|
+
export interface McpMonetizationGateOptions {
|
|
38
|
+
validatePaidRequest?: (context: McpPaidRequestValidationContext) => McpPaidRequestValidationFailure | undefined;
|
|
39
|
+
}
|
|
13
40
|
/**
|
|
14
41
|
* @name McpMonetizationGate
|
|
15
42
|
* @description Applies x402 payment verification and settlement before forwarding requests to the MCP transport.
|
|
@@ -29,8 +56,22 @@ export declare class McpMonetizationGate {
|
|
|
29
56
|
* @name handle
|
|
30
57
|
* @description Authorizes a request via x402 when required, then forwards it to MCP and settles on success.
|
|
31
58
|
*/
|
|
32
|
-
handle(request: http.IncomingMessage, response: http.ServerResponse, next: McpRequestHandler): Promise<void>;
|
|
59
|
+
handle(request: http.IncomingMessage, response: http.ServerResponse, next: McpRequestHandler, options?: McpMonetizationGateOptions): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* @name handleSignedPayment
|
|
62
|
+
* @description Verifies a client-supplied x402 payment payload against the original accepted requirements.
|
|
63
|
+
*/
|
|
64
|
+
private handleSignedPayment;
|
|
65
|
+
private callFacilitator;
|
|
33
66
|
private buildRequestContext;
|
|
67
|
+
/**
|
|
68
|
+
* @name returnX402Challenge
|
|
69
|
+
* @description Returns a standard HTTP 402 payment challenge for non-MCP clients
|
|
70
|
+
* (x402scan discovery, curl, health checks). Decodes the PaymentRequired object
|
|
71
|
+
* from the PAYMENT-REQUIRED header and returns it as the response body so x402
|
|
72
|
+
* scanners can validate the challenge format.
|
|
73
|
+
*/
|
|
74
|
+
private returnX402Challenge;
|
|
34
75
|
private forwardAndSettle;
|
|
35
76
|
private settleAndReplay;
|
|
36
77
|
}
|
|
@@ -46,7 +87,7 @@ export declare function resolvePaymentNetwork(config: SapMcpConfig): string;
|
|
|
46
87
|
export declare function normalizePaymentNetwork(network: string): string;
|
|
47
88
|
/**
|
|
48
89
|
* @name buildPaidVirtualPath
|
|
49
|
-
* @description Builds the paid x402 virtual resource path, bound to the
|
|
90
|
+
* @description Builds the paid x402 virtual resource path, bound to the canonical MCP method-and-params hash.
|
|
50
91
|
*/
|
|
51
92
|
export declare function buildPaidVirtualPath(decision: Extract<PaymentDecision, {
|
|
52
93
|
required: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monetization-gate.d.ts","sourceRoot":"","sources":["../../src/payments/monetization-gate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"monetization-gate.d.ts","sourceRoot":"","sources":["../../src/payments/monetization-gate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAiB7B,OAAO,KAAK,EAAE,YAAY,EAA4B,MAAM,kBAAkB,CAAC;AAI/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAKpD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,IAAI,CA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