@cmdoss/suipay-mcp 0.3.0-dev.3 → 0.3.0-dev.4
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 +4 -4
- package/dist/bin/suipay.js +2 -2
- package/dist/{chunk-5HVUGWWW.js → chunk-JJOV775N.js} +1 -1
- package/dist/{chunk-GXSMC2YQ.js → chunk-KRFK3IXQ.js} +28 -3
- package/dist/{http-CXSCuxMx.d.ts → http-sIwCQq0D.d.ts} +2 -2
- package/dist/http.d.ts +1 -1
- package/dist/http.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ buyer-funded spend account. The buyer owns the account. The agent holds the
|
|
|
5
5
|
delegate key and can spend only under the on-chain grant (recipient bind,
|
|
6
6
|
per-payment cap, budget).
|
|
7
7
|
|
|
8
|
-
Pin `@cmdoss/suipay-mcp@0.3.0-dev.
|
|
8
|
+
Pin `@cmdoss/suipay-mcp@0.3.0-dev.4` in MCP config for the `latest` dist-tag.
|
|
9
9
|
`npx -y @cmdoss/suipay-mcp@dev` tracks the `dev` prerelease line.
|
|
10
10
|
`1.0.1` remains on the registry as a historical release; do not install it
|
|
11
11
|
for new agents.
|
|
@@ -13,7 +13,7 @@ for new agents.
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
claude mcp add --scope user suipay -- npx -y @cmdoss/suipay-mcp@0.3.0-dev.
|
|
16
|
+
claude mcp add --scope user suipay -- npx -y @cmdoss/suipay-mcp@0.3.0-dev.4
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`@dev` installs the Railway-dev gateway/console defaults. A workspace
|
|
@@ -153,10 +153,10 @@ Default is Railway **suipay-dev**. `--local` / `target: "local"` is laptop-only.
|
|
|
153
153
|
|
|
154
154
|
```bash
|
|
155
155
|
# Railway suipay-dev (default)
|
|
156
|
-
npx @cmdoss/suipay-mcp@0.3.0-dev.
|
|
156
|
+
npx @cmdoss/suipay-mcp@0.3.0-dev.4
|
|
157
157
|
|
|
158
158
|
# Laptop stack
|
|
159
|
-
npx @cmdoss/suipay-mcp@0.3.0-dev.
|
|
159
|
+
npx @cmdoss/suipay-mcp@0.3.0-dev.4 --local
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
`SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
|
package/dist/bin/suipay.js
CHANGED
|
@@ -2127,8 +2127,8 @@ var AUTH_CODES = {
|
|
|
2127
2127
|
retry: "never",
|
|
2128
2128
|
nextAction: "contact_support",
|
|
2129
2129
|
user: {
|
|
2130
|
-
title: "
|
|
2131
|
-
message: "Your wallet isn't
|
|
2130
|
+
title: "Access is invite-only",
|
|
2131
|
+
message: "Access is invite-only. Your wallet isn't invited to spend yet."
|
|
2132
2132
|
}
|
|
2133
2133
|
},
|
|
2134
2134
|
"auth.token_invalid": {
|
|
@@ -7019,6 +7019,19 @@ function gatewayFailure(answer, local, extras) {
|
|
|
7019
7019
|
txDigest: error.txDigest ?? extras.txDigest
|
|
7020
7020
|
});
|
|
7021
7021
|
}
|
|
7022
|
+
var SPEND_NOT_WHITELISTED = "auth.spend_not_whitelisted";
|
|
7023
|
+
async function spendWhitelistRefusal(response, paymentId) {
|
|
7024
|
+
const parsed = parseErrorPayload(await readGatewayAnswer(response));
|
|
7025
|
+
if (parsed?.source !== "problem" || parsed.code !== SPEND_NOT_WHITELISTED || parsed.paymentState !== "not_charged" || parsed.status !== 403) {
|
|
7026
|
+
return null;
|
|
7027
|
+
}
|
|
7028
|
+
const detail = parsed.detail?.trim();
|
|
7029
|
+
return receivedResultError(parsed.code, "not_charged", {
|
|
7030
|
+
...detail ? { detail } : {},
|
|
7031
|
+
paymentId,
|
|
7032
|
+
challengeId: paymentId
|
|
7033
|
+
});
|
|
7034
|
+
}
|
|
7022
7035
|
function logInternal(log, entry, error) {
|
|
7023
7036
|
try {
|
|
7024
7037
|
const port = log ?? defaultLog;
|
|
@@ -8099,6 +8112,11 @@ async function payDelegatedSpendAccount(args) {
|
|
|
8099
8112
|
})
|
|
8100
8113
|
});
|
|
8101
8114
|
if (!createRes.ok) {
|
|
8115
|
+
const refused = await spendWhitelistRefusal(createRes, paymentId);
|
|
8116
|
+
if (refused) {
|
|
8117
|
+
await releaseReservation(ledger, ownedPaymentId, log);
|
|
8118
|
+
return refused;
|
|
8119
|
+
}
|
|
8102
8120
|
return abortBeforeSign("SPONSOR_UNAVAILABLE", PUBLIC_DETAIL.SPONSOR_UNAVAILABLE);
|
|
8103
8121
|
}
|
|
8104
8122
|
const sponsored = await createRes.json();
|
|
@@ -8180,6 +8198,11 @@ async function payDelegatedSpendAccount(args) {
|
|
|
8180
8198
|
})
|
|
8181
8199
|
});
|
|
8182
8200
|
if (!execRes.ok) {
|
|
8201
|
+
const refused = await spendWhitelistRefusal(execRes, paymentId);
|
|
8202
|
+
if (refused) {
|
|
8203
|
+
await releaseReservation(ledger, ownedPaymentId, log);
|
|
8204
|
+
return refused;
|
|
8205
|
+
}
|
|
8183
8206
|
return completeAttempt(ledger, ownedPaymentId, ambiguous("EXECUTE_AMBIGUOUS", PUBLIC_DETAIL.EXECUTE_AMBIGUOUS, {
|
|
8184
8207
|
paymentId,
|
|
8185
8208
|
// The sponsor-minted digest is the only handle on a possible
|
|
@@ -11801,8 +11824,10 @@ function toolFailure(fields, options = {}) {
|
|
|
11801
11824
|
};
|
|
11802
11825
|
const json = JSON.stringify(structured, null, 2);
|
|
11803
11826
|
const lead = fields.paymentState === "charged" ? CHARGED_LINE : fields.paymentState === "unknown" ? UNKNOWN_LINE : null;
|
|
11827
|
+
const invite = fields.code === "auth.spend_not_whitelisted" && fields.detail?.trim() && isErrorCode(fields.code) ? definitionOf(fields.code).user?.message : void 0;
|
|
11828
|
+
const head = [lead, invite].filter((line) => Boolean(line));
|
|
11804
11829
|
return {
|
|
11805
|
-
content: [{ type: "text", text:
|
|
11830
|
+
content: [{ type: "text", text: head.length > 0 ? `${head.join("\n")}
|
|
11806
11831
|
${json}` : json }],
|
|
11807
11832
|
structuredContent: structured,
|
|
11808
11833
|
isError: true
|
|
@@ -3030,8 +3030,8 @@ declare const ERRORS: {
|
|
|
3030
3030
|
readonly retry: "never";
|
|
3031
3031
|
readonly nextAction: "contact_support";
|
|
3032
3032
|
readonly user: {
|
|
3033
|
-
readonly title: "
|
|
3034
|
-
readonly message: "Your wallet isn't
|
|
3033
|
+
readonly title: "Access is invite-only";
|
|
3034
|
+
readonly message: "Access is invite-only. Your wallet isn't invited to spend yet.";
|
|
3035
3035
|
};
|
|
3036
3036
|
};
|
|
3037
3037
|
readonly 'auth.token_invalid': {
|
package/dist/http.d.ts
CHANGED
package/dist/http.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SpendAccountSigningRequest, P as PaidHttpRequest, D as DelegatedKeySigner, G as GetObjectJson, a as DelegatedPayerSession, b as DelegatedPayerConfig, c as DelegatedPayerDeps, d as SpendIntent, e as DelegatedPayResult, f as DelegationScope, C as CodeFor, N as NextAction, g as GrantPolicyBinding, h as PaymentAttemptLedger, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, O as Offer, M as McpConfig, k as McpAuthContext, l as McpTraceHooks, m as SpendAccountPayDeps, n as createReader } from './http-
|
|
2
|
-
export { A as AgentHeldResolver, o as AgentHeldSettlement, p as MCP_TARGET_PRESETS, q as McpEnvelope, r as McpEnvelopeEntry, s as McpServerOptions, t as McpTarget, u as McpTraceContext, v as McpTraceRuntime, w as PACKAGE_NAME, x as PreparedPayment, y as SpendAccountPrepareResult, z as SpendAccountPrepareSession, T as TOOLS, B as buildSpendAccountPayKind, E as canonicalMcpRequestId, F as createServer, H as handleSuipayMcpHttpRequest, I as inspectMcpEnvelope, J as loadMcpConfig, K as parseMcpTargetFlag, L as prepareSpendAccountPayment, Q as resetAgentHeldProcessLedger, R as resolveAgentHeldSettlement, U as resolveGrantTarget, V as resolveMcpTarget, W as sameMcpGateway, Y as traceMcpHttpRequest, Z as verifySpendAccountPayReconstructs } from './http-
|
|
1
|
+
import { S as SpendAccountSigningRequest, P as PaidHttpRequest, D as DelegatedKeySigner, G as GetObjectJson, a as DelegatedPayerSession, b as DelegatedPayerConfig, c as DelegatedPayerDeps, d as SpendIntent, e as DelegatedPayResult, f as DelegationScope, C as CodeFor, N as NextAction, g as GrantPolicyBinding, h as PaymentAttemptLedger, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, O as Offer, M as McpConfig, k as McpAuthContext, l as McpTraceHooks, m as SpendAccountPayDeps, n as createReader } from './http-sIwCQq0D.js';
|
|
2
|
+
export { A as AgentHeldResolver, o as AgentHeldSettlement, p as MCP_TARGET_PRESETS, q as McpEnvelope, r as McpEnvelopeEntry, s as McpServerOptions, t as McpTarget, u as McpTraceContext, v as McpTraceRuntime, w as PACKAGE_NAME, x as PreparedPayment, y as SpendAccountPrepareResult, z as SpendAccountPrepareSession, T as TOOLS, B as buildSpendAccountPayKind, E as canonicalMcpRequestId, F as createServer, H as handleSuipayMcpHttpRequest, I as inspectMcpEnvelope, J as loadMcpConfig, K as parseMcpTargetFlag, L as prepareSpendAccountPayment, Q as resetAgentHeldProcessLedger, R as resolveAgentHeldSettlement, U as resolveGrantTarget, V as resolveMcpTarget, W as sameMcpGateway, Y as traceMcpHttpRequest, Z as verifySpendAccountPayReconstructs } from './http-sIwCQq0D.js';
|
|
3
3
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
4
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
5
5
|
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadBootProfile,
|
|
3
3
|
main
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JJOV775N.js";
|
|
5
5
|
import {
|
|
6
6
|
MCP_TARGET_PRESETS,
|
|
7
7
|
PACKAGE_NAME,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
settlePreparedMcpPayment,
|
|
27
27
|
traceMcpHttpRequest,
|
|
28
28
|
verifySpendAccountPayReconstructs
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-KRFK3IXQ.js";
|
|
30
30
|
export {
|
|
31
31
|
MCP_TARGET_PRESETS,
|
|
32
32
|
PACKAGE_NAME,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmdoss/suipay-mcp",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SuiPay MCP — pay MPP-gated APIs from a spend-account grant with an agent-held delegate key.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"tsup": "^8.0.0",
|
|
38
38
|
"typescript": "^6.0.3",
|
|
39
39
|
"vitest": "^4.1.10",
|
|
40
|
-
"@cmdoss/suipay-
|
|
41
|
-
"@cmdoss/suipay-
|
|
40
|
+
"@cmdoss/suipay-sdk": "0.1.0",
|
|
41
|
+
"@cmdoss/suipay-core": "0.1.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup",
|