@mysten-incubation/suipay-mcp 0.3.0-dev.33 → 0.3.0-dev.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -10
- package/dist/bin/suipay.js +2 -2
- package/dist/{chunk-TCPF3ONF.js → chunk-CHTRG5KH.js} +1 -1
- package/dist/{chunk-5S4MJN2A.js → chunk-OBRKF6BI.js} +121 -34
- package/dist/{http-DRQ838c6.d.ts → http-fypqfnVw.d.ts} +33 -1
- 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 `@mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
8
|
+
Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.35` in MCP config for the `latest` dist-tag.
|
|
9
9
|
`npx -y @mysten-incubation/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,10 +13,10 @@ for new agents.
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
16
|
+
claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.35
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
`@dev` installs the
|
|
19
|
+
`@dev` installs the staging gateway/console defaults. A workspace
|
|
20
20
|
checkout still defaults to localhost. `SUIPAY_GATEWAY_URL` and
|
|
21
21
|
`SUIPAY_CONSOLE_URL` always override.
|
|
22
22
|
|
|
@@ -34,7 +34,7 @@ First connection is a spend-account grant plus an agent-held delegate key.
|
|
|
34
34
|
2. Persist that delegate key locally at `~/.suipay/credentials.json`
|
|
35
35
|
(mode `0600`). The process that holds this key is the only process
|
|
36
36
|
that can settle.
|
|
37
|
-
3. Point MCP at a gateway. Default is
|
|
37
|
+
3. Point MCP at a gateway. Default is GKE **staging**. Start the binary with `--local`
|
|
38
38
|
for the laptop stack. Env/CLI fill the process default until a
|
|
39
39
|
credential is bound; after login, stored `gatewayUrl` wins. Use a separate
|
|
40
40
|
`SUIPAY_MCP_PROFILE` for another gateway; a tool argument cannot rebind a key.
|
|
@@ -152,19 +152,19 @@ tool error with a `request.*` code and `nextAction: "fix_request"`.
|
|
|
152
152
|
|
|
153
153
|
## Targets
|
|
154
154
|
|
|
155
|
-
Default is
|
|
155
|
+
Default is GKE **staging**. Start with `--local` for the laptop stack.
|
|
156
156
|
|
|
157
157
|
| Target | Console | Gateway | How |
|
|
158
158
|
| --- | --- | --- | --- |
|
|
159
|
-
| `dev` (default) | `https://suipay-
|
|
159
|
+
| `dev` (default) | `https://suipay-staging.mystenlabs.com` | `https://suipay-gateway-staging.mystenlabs.com` | no flag, or `--dev` |
|
|
160
160
|
| `local` | `http://localhost:3000` | `http://127.0.0.1:4340` | `--local` / `-local` |
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
|
-
#
|
|
164
|
-
npx @mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
163
|
+
# Staging (default)
|
|
164
|
+
npx @mysten-incubation/suipay-mcp@0.3.0-dev.35
|
|
165
165
|
|
|
166
166
|
# Laptop stack
|
|
167
|
-
npx @mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
167
|
+
npx @mysten-incubation/suipay-mcp@0.3.0-dev.35 --local
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
`SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
|
|
@@ -176,6 +176,10 @@ gateway that differs from the stored binding, with or without `target`.
|
|
|
176
176
|
A `suipay_login({ target })` argument must also match the process gateway.
|
|
177
177
|
To connect another environment, restart with its target and a separate
|
|
178
178
|
`SUIPAY_MCP_PROFILE`; the existing key binding stays unchanged.
|
|
179
|
+
A credentials file already bound to `https://gateway-dev-ba84.up.railway.app`
|
|
180
|
+
keeps that origin after an upgrade. Pay and `suipay_login` stay on it and
|
|
181
|
+
refuse the staging process. Use a new `SUIPAY_MCP_PROFILE` and log in there.
|
|
182
|
+
Do not log out to migrate: logout deletes the local key.
|
|
179
183
|
|
|
180
184
|
### Isolate connection environments
|
|
181
185
|
|
|
@@ -198,7 +202,7 @@ credentials. Stop on a mismatch; do not pay or delete the existing key.
|
|
|
198
202
|
## Client environment
|
|
199
203
|
|
|
200
204
|
```bash
|
|
201
|
-
# Optional. Unset =
|
|
205
|
+
# Optional. Unset = staging. --local uses localhost:3000 / 127.0.0.1:4340.
|
|
202
206
|
SUIPAY_GATEWAY_URL=https://gateway.example
|
|
203
207
|
SUIPAY_CONSOLE_URL=https://console.example
|
|
204
208
|
# Optional. Unset/blank retains the legacy credentials file.
|
package/dist/bin/suipay.js
CHANGED
|
@@ -246,6 +246,18 @@ var ACCOUNT_CODES = {
|
|
|
246
246
|
nextAction: "fix_request",
|
|
247
247
|
user: { title: "Agent address not valid", message: "Enter a valid agent address and try again." }
|
|
248
248
|
},
|
|
249
|
+
"account.deposit_cap_exceeded": {
|
|
250
|
+
surfaces: ["gateway", "sdk", "browser"],
|
|
251
|
+
status: 403,
|
|
252
|
+
title: "Deposit would exceed the vault beta cap",
|
|
253
|
+
paymentState: "not_charged",
|
|
254
|
+
retry: "never",
|
|
255
|
+
nextAction: "fix_request",
|
|
256
|
+
user: {
|
|
257
|
+
title: "Over the beta vault limit",
|
|
258
|
+
message: "This deposit would put your vault over the Mainnet Beta cap. Deposit less, or withdraw first."
|
|
259
|
+
}
|
|
260
|
+
},
|
|
249
261
|
"account.finalize_mismatch": {
|
|
250
262
|
surfaces: ["gateway"],
|
|
251
263
|
status: 409,
|
|
@@ -2325,6 +2337,16 @@ var SERVICE_CODES = {
|
|
|
2325
2337
|
nextAction: "retry_later",
|
|
2326
2338
|
user: { title: "Temporarily unavailable", message: "This isn't available right now. Try again in a moment." }
|
|
2327
2339
|
},
|
|
2340
|
+
"service.halted": {
|
|
2341
|
+
surfaces: ["gateway", "seller", "console_server", "mcp_hosted", "browser"],
|
|
2342
|
+
status: 503,
|
|
2343
|
+
title: "Services halted temporarily",
|
|
2344
|
+
paymentState: "not_charged",
|
|
2345
|
+
retry: "after_delay",
|
|
2346
|
+
retryAfterSeconds: 5,
|
|
2347
|
+
nextAction: "retry_later",
|
|
2348
|
+
user: { title: "Services halted temporarily", message: "Try again in a moment." }
|
|
2349
|
+
},
|
|
2328
2350
|
"service.not_ready": {
|
|
2329
2351
|
surfaces: ["gateway", "seller", "console_server"],
|
|
2330
2352
|
status: 503,
|
|
@@ -3023,6 +3045,15 @@ function parseErrorPayload(input) {
|
|
|
3023
3045
|
}
|
|
3024
3046
|
return null;
|
|
3025
3047
|
}
|
|
3048
|
+
var DEFINITE_PRE_BROADCAST_REFUSALS = /* @__PURE__ */ new Set([
|
|
3049
|
+
"auth.spend_not_whitelisted"
|
|
3050
|
+
]);
|
|
3051
|
+
function isValidatedProblemRefusal(parsed, allowedCodes) {
|
|
3052
|
+
return parsed !== null && parsed.source === "problem" && parsed.paymentState === "not_charged" && isErrorCode(parsed.code) && allowedCodes.has(parsed.code) && definitionOf(parsed.code).status === parsed.status;
|
|
3053
|
+
}
|
|
3054
|
+
function isDefinitePreBroadcastRefusal(parsed) {
|
|
3055
|
+
return isValidatedProblemRefusal(parsed, DEFINITE_PRE_BROADCAST_REFUSALS);
|
|
3056
|
+
}
|
|
3026
3057
|
function readX402Failure(headers) {
|
|
3027
3058
|
for (const name of X402_RESPONSE_HEADERS) {
|
|
3028
3059
|
const raw = readHeader(headers, name);
|
|
@@ -4305,22 +4336,38 @@ function createSpendAccountChain(options) {
|
|
|
4305
4336
|
const tx = new Transaction2();
|
|
4306
4337
|
tx.setSender(input.owner);
|
|
4307
4338
|
const funding = await fundingCoin(tx, input.owner, input.coinType, BigInt(input.funding));
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4339
|
+
if (input.exclusionDirectoryId) {
|
|
4340
|
+
tx.moveCall({
|
|
4341
|
+
target: target("create_account_limited"),
|
|
4342
|
+
typeArguments: [input.coinType],
|
|
4343
|
+
arguments: [tx.object(input.exclusionDirectoryId), funding]
|
|
4344
|
+
});
|
|
4345
|
+
} else {
|
|
4346
|
+
tx.moveCall({
|
|
4347
|
+
target: target("create_account"),
|
|
4348
|
+
typeArguments: [input.coinType],
|
|
4349
|
+
arguments: [funding]
|
|
4350
|
+
});
|
|
4351
|
+
}
|
|
4313
4352
|
return kindBytes(tx);
|
|
4314
4353
|
},
|
|
4315
4354
|
async buildTopUpKind(input) {
|
|
4316
4355
|
const tx = new Transaction2();
|
|
4317
4356
|
tx.setSender(input.owner);
|
|
4318
4357
|
const funding = await fundingCoin(tx, input.owner, input.coinType, BigInt(input.amount));
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4358
|
+
if (input.exclusionDirectoryId) {
|
|
4359
|
+
tx.moveCall({
|
|
4360
|
+
target: target("fund_account_limited"),
|
|
4361
|
+
typeArguments: [input.coinType],
|
|
4362
|
+
arguments: [tx.object(input.exclusionDirectoryId), tx.object(input.poolObjectId), funding]
|
|
4363
|
+
});
|
|
4364
|
+
} else {
|
|
4365
|
+
tx.moveCall({
|
|
4366
|
+
target: target("fund_account"),
|
|
4367
|
+
typeArguments: [input.coinType],
|
|
4368
|
+
arguments: [tx.object(input.poolObjectId), funding]
|
|
4369
|
+
});
|
|
4370
|
+
}
|
|
4324
4371
|
return kindBytes(tx);
|
|
4325
4372
|
},
|
|
4326
4373
|
async buildWithdrawKind(input) {
|
|
@@ -8461,6 +8508,12 @@ async function readPublicSessionState(getObjectJson, grantObjectId) {
|
|
|
8461
8508
|
revoked: asBool(g.revoked)
|
|
8462
8509
|
};
|
|
8463
8510
|
}
|
|
8511
|
+
function isRevokedBootstrap(data) {
|
|
8512
|
+
if (!data || typeof data !== "object")
|
|
8513
|
+
return false;
|
|
8514
|
+
const dto = data;
|
|
8515
|
+
return Array.isArray(dto.grants) && dto.grants.length === 0 && dto.grantStatus === "revoked";
|
|
8516
|
+
}
|
|
8464
8517
|
async function bootstrapPayerSessions(options) {
|
|
8465
8518
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
8466
8519
|
const basePath = options.basePath ?? "/v1/delegate";
|
|
@@ -8782,14 +8835,13 @@ function gatewayFailure(answer, local, extras) {
|
|
|
8782
8835
|
txDigest: error.txDigest ?? extras.txDigest
|
|
8783
8836
|
});
|
|
8784
8837
|
}
|
|
8785
|
-
var
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
async function spendWhitelistRefusal(response, paymentId) {
|
|
8838
|
+
var PRE_SIGN_SPONSOR_CREATE_REFUSALS = /* @__PURE__ */ new Set([
|
|
8839
|
+
...DEFINITE_PRE_BROADCAST_REFUSALS,
|
|
8840
|
+
"limit.rate_limited"
|
|
8841
|
+
]);
|
|
8842
|
+
async function sponsorProblemRefusal(response, paymentId, admit) {
|
|
8791
8843
|
const parsed = parseErrorPayload(await readGatewayAnswer(response));
|
|
8792
|
-
if (parsed
|
|
8844
|
+
if (!admit(parsed)) {
|
|
8793
8845
|
return null;
|
|
8794
8846
|
}
|
|
8795
8847
|
const detail = parsed.detail?.trim();
|
|
@@ -9959,7 +10011,7 @@ async function payDelegatedSpendAccount(args) {
|
|
|
9959
10011
|
})
|
|
9960
10012
|
});
|
|
9961
10013
|
if (!createRes.ok) {
|
|
9962
|
-
const refused = await
|
|
10014
|
+
const refused = await sponsorProblemRefusal(createRes, paymentId, (parsed) => isValidatedProblemRefusal(parsed, PRE_SIGN_SPONSOR_CREATE_REFUSALS));
|
|
9963
10015
|
if (refused) {
|
|
9964
10016
|
await releaseReservation(ledger, ownedPaymentId, log);
|
|
9965
10017
|
return refused;
|
|
@@ -10056,7 +10108,7 @@ async function payDelegatedSpendAccount(args) {
|
|
|
10056
10108
|
})
|
|
10057
10109
|
});
|
|
10058
10110
|
if (!execRes.ok) {
|
|
10059
|
-
const refused = await
|
|
10111
|
+
const refused = await sponsorProblemRefusal(execRes, paymentId, isDefinitePreBroadcastRefusal);
|
|
10060
10112
|
if (refused) {
|
|
10061
10113
|
await releaseReservation(ledger, ownedPaymentId, log);
|
|
10062
10114
|
return refused;
|
|
@@ -10815,10 +10867,10 @@ import { normalizeSuiAddress as normalizeSuiAddress8 } from "@mysten/sui/utils";
|
|
|
10815
10867
|
import { existsSync, readFileSync } from "fs";
|
|
10816
10868
|
import { dirname, join } from "path";
|
|
10817
10869
|
import { fileURLToPath } from "url";
|
|
10818
|
-
var MCP_LOCAL_GATEWAY_URL = "https://gateway-
|
|
10819
|
-
var MCP_LOCAL_CONSOLE_URL = "https://suipay-
|
|
10820
|
-
var MCP_DEV_GATEWAY_URL = "https://gateway-
|
|
10821
|
-
var MCP_DEV_CONSOLE_URL = "https://suipay-
|
|
10870
|
+
var MCP_LOCAL_GATEWAY_URL = "https://suipay-gateway-staging.mystenlabs.com";
|
|
10871
|
+
var MCP_LOCAL_CONSOLE_URL = "https://suipay-staging.mystenlabs.com";
|
|
10872
|
+
var MCP_DEV_GATEWAY_URL = "https://suipay-gateway-staging.mystenlabs.com";
|
|
10873
|
+
var MCP_DEV_CONSOLE_URL = "https://suipay-staging.mystenlabs.com";
|
|
10822
10874
|
var MCP_PROD_GATEWAY_URL = "https://gateway.suipay.dev";
|
|
10823
10875
|
var MCP_PROD_CONSOLE_URL = "https://www.sui.io/agentpayments";
|
|
10824
10876
|
var MCP_CHANNEL_DEFAULTS = {
|
|
@@ -10882,11 +10934,11 @@ function mcpCredentialsPath() {
|
|
|
10882
10934
|
}
|
|
10883
10935
|
var MCP_TARGET_PRESETS = {
|
|
10884
10936
|
dev: {
|
|
10885
|
-
consoleUrl:
|
|
10886
|
-
gatewayUrl:
|
|
10937
|
+
consoleUrl: MCP_DEV_CONSOLE_URL,
|
|
10938
|
+
gatewayUrl: MCP_DEV_GATEWAY_URL
|
|
10887
10939
|
},
|
|
10888
10940
|
local: {
|
|
10889
|
-
consoleUrl: "https://suipay-
|
|
10941
|
+
consoleUrl: "https://suipay-staging.mystenlabs.com",
|
|
10890
10942
|
gatewayUrl: "http://127.0.0.1:4340"
|
|
10891
10943
|
}
|
|
10892
10944
|
};
|
|
@@ -12659,6 +12711,15 @@ async function resolvePayerSession(options) {
|
|
|
12659
12711
|
});
|
|
12660
12712
|
if (whole.ok)
|
|
12661
12713
|
return { ok: true, value: { ...whole.value, deployment } };
|
|
12714
|
+
if (whole.error.reason === MANIFEST_ERROR_CODES.NO_GRANTS) {
|
|
12715
|
+
if (isRevokedBootstrap(bootstrap.data)) {
|
|
12716
|
+
return {
|
|
12717
|
+
ok: false,
|
|
12718
|
+
error: manifestError(MANIFEST_ERROR_CODES.NO_GRANTS, "this delegate key has been revoked", "account.grant_revoked")
|
|
12719
|
+
};
|
|
12720
|
+
}
|
|
12721
|
+
return whole;
|
|
12722
|
+
}
|
|
12662
12723
|
const data = bootstrap.data;
|
|
12663
12724
|
const rawGrants = Array.isArray(data.grants) ? data.grants : [];
|
|
12664
12725
|
const usable = [];
|
|
@@ -12691,7 +12752,9 @@ async function resolvePayerSession(options) {
|
|
|
12691
12752
|
if (usable.length === 0) {
|
|
12692
12753
|
const scoped = blocked.find((b) => b.error.reason === MANIFEST_ERROR_CODES.MISSING_POLICY_BINDING);
|
|
12693
12754
|
const pick2 = scoped ?? blocked[0];
|
|
12694
|
-
|
|
12755
|
+
if (pick2)
|
|
12756
|
+
return { ok: false, error: explainBlockedGrant(pick2.raw, pick2.error) };
|
|
12757
|
+
return whole;
|
|
12695
12758
|
}
|
|
12696
12759
|
const resolved = manifestToSession({
|
|
12697
12760
|
manifest: { ...data, grants: usable },
|
|
@@ -12772,10 +12835,16 @@ async function verifyGrantOnChain(input) {
|
|
|
12772
12835
|
return notVerified(`grant ${input.grantObjectId} draws on a different pool than the one resolved`);
|
|
12773
12836
|
}
|
|
12774
12837
|
if (state.revoked === true) {
|
|
12775
|
-
return
|
|
12838
|
+
return {
|
|
12839
|
+
ok: false,
|
|
12840
|
+
error: manifestError(MANIFEST_ERROR_CODES.GRANT_NOT_VERIFIED, `grant ${input.grantObjectId} is revoked on chain`, "account.grant_revoked")
|
|
12841
|
+
};
|
|
12776
12842
|
}
|
|
12777
12843
|
if (state.paused === true) {
|
|
12778
|
-
return
|
|
12844
|
+
return {
|
|
12845
|
+
ok: false,
|
|
12846
|
+
error: manifestError(MANIFEST_ERROR_CODES.GRANT_NOT_VERIFIED, `grant ${input.grantObjectId} is paused on chain`, "account.grant_paused")
|
|
12847
|
+
};
|
|
12779
12848
|
}
|
|
12780
12849
|
return { ok: true, value: null };
|
|
12781
12850
|
}
|
|
@@ -13634,7 +13703,7 @@ async function prepareSpendAccountPayment(args) {
|
|
|
13634
13703
|
authority: session.snapshot,
|
|
13635
13704
|
assertLive: session.assertLive
|
|
13636
13705
|
};
|
|
13637
|
-
const directorySwitch = cfg.exclusionDirectoryObjectId ? cfg.exclusionDirectoryObjectId : deps.resolveExclusionRegistry ? null : await publishedExclusionDirectoryId(cfg.gatewayUrl);
|
|
13706
|
+
const directorySwitch = cfg.exclusionDirectoryObjectId ? cfg.exclusionDirectoryObjectId : deps.resolveExclusionRegistry ? null : await publishedExclusionDirectoryId(cfg.gatewayUrl, deps.fetchImpl);
|
|
13638
13707
|
const resolveExclusionRegistry2 = deps.resolveExclusionRegistry ?? (directorySwitch ? (() => {
|
|
13639
13708
|
const reader = createGrpcExclusionRegistryReader(rpcClient(cfg));
|
|
13640
13709
|
return async ({ directoryId, packageId, recipient, challengeId, amount, coinType }) => resolveExclusionRegistry({
|
|
@@ -15731,7 +15800,13 @@ function createServer2(cfg, auth, trace, options = {}) {
|
|
|
15731
15800
|
}
|
|
15732
15801
|
switch (name) {
|
|
15733
15802
|
case "access_context":
|
|
15734
|
-
return await accessContext(
|
|
15803
|
+
return await accessContext(
|
|
15804
|
+
{
|
|
15805
|
+
auth,
|
|
15806
|
+
...options.fetchImpl ? { fetchImpl: options.fetchImpl } : {}
|
|
15807
|
+
},
|
|
15808
|
+
cfg
|
|
15809
|
+
);
|
|
15735
15810
|
case "pay": {
|
|
15736
15811
|
const agentHeld = auth?.spendAccountPay ? resolveAgentHeld(cfg, auth.spendAccountPay) : null;
|
|
15737
15812
|
const fileArgs = {
|
|
@@ -15760,6 +15835,7 @@ function createServer2(cfg, auth, trace, options = {}) {
|
|
|
15760
15835
|
transport,
|
|
15761
15836
|
...trace ? { trace } : {},
|
|
15762
15837
|
...agentHeld ? { agentHeld } : {},
|
|
15838
|
+
...options.fetchImpl ? { fetchImpl: options.fetchImpl } : {},
|
|
15763
15839
|
...options.resolveExclusionRegistry ? { resolveExclusionRegistry: options.resolveExclusionRegistry } : {}
|
|
15764
15840
|
}
|
|
15765
15841
|
);
|
|
@@ -15769,7 +15845,12 @@ function createServer2(cfg, auth, trace, options = {}) {
|
|
|
15769
15845
|
{
|
|
15770
15846
|
query: typeof args.query === "string" ? args.query : void 0
|
|
15771
15847
|
},
|
|
15772
|
-
cfg
|
|
15848
|
+
cfg,
|
|
15849
|
+
{
|
|
15850
|
+
auth,
|
|
15851
|
+
transport,
|
|
15852
|
+
...options.fetchImpl ? { fetchImpl: options.fetchImpl } : {}
|
|
15853
|
+
}
|
|
15773
15854
|
);
|
|
15774
15855
|
case "receipts":
|
|
15775
15856
|
return await receipts(
|
|
@@ -15777,7 +15858,10 @@ function createServer2(cfg, auth, trace, options = {}) {
|
|
|
15777
15858
|
challengeId: typeof args.challengeId === "string" ? args.challengeId : void 0
|
|
15778
15859
|
},
|
|
15779
15860
|
cfg,
|
|
15780
|
-
{
|
|
15861
|
+
{
|
|
15862
|
+
auth,
|
|
15863
|
+
...options.fetchImpl ? { fetchImpl: options.fetchImpl } : {}
|
|
15864
|
+
}
|
|
15781
15865
|
);
|
|
15782
15866
|
case "suipay_login": {
|
|
15783
15867
|
if (auth) {
|
|
@@ -15816,7 +15900,10 @@ function createServer2(cfg, auth, trace, options = {}) {
|
|
|
15816
15900
|
"suipay_login_status is for local stdio only; hosted /mcp never holds a spendable key"
|
|
15817
15901
|
);
|
|
15818
15902
|
}
|
|
15819
|
-
return await suipayLoginStatus(args, cfg, {
|
|
15903
|
+
return await suipayLoginStatus(args, cfg, {
|
|
15904
|
+
auth,
|
|
15905
|
+
...options.fetchImpl ? { fetchImpl: options.fetchImpl } : {}
|
|
15906
|
+
});
|
|
15820
15907
|
case "suipay_logout":
|
|
15821
15908
|
if (auth) {
|
|
15822
15909
|
return mcpFailure(
|
|
@@ -519,7 +519,7 @@ interface McpAuthContext {
|
|
|
519
519
|
|
|
520
520
|
type McpTarget = 'dev' | 'local';
|
|
521
521
|
/**
|
|
522
|
-
* Public
|
|
522
|
+
* Public staging origins. `local` is the laptop stack from
|
|
523
523
|
* `pnpm demo:testnet`. Explicit `SUIPAY_GATEWAY_URL` / `SUIPAY_CONSOLE_URL`
|
|
524
524
|
* still win over the preset.
|
|
525
525
|
*/
|
|
@@ -1257,6 +1257,19 @@ declare const ERRORS: {
|
|
|
1257
1257
|
readonly message: "This isn't available right now. Try again in a moment.";
|
|
1258
1258
|
};
|
|
1259
1259
|
};
|
|
1260
|
+
readonly 'service.halted': {
|
|
1261
|
+
readonly surfaces: readonly ["gateway", "seller", "console_server", "mcp_hosted", "browser"];
|
|
1262
|
+
readonly status: 503;
|
|
1263
|
+
readonly title: "Services halted temporarily";
|
|
1264
|
+
readonly paymentState: "not_charged";
|
|
1265
|
+
readonly retry: "after_delay";
|
|
1266
|
+
readonly retryAfterSeconds: 5;
|
|
1267
|
+
readonly nextAction: "retry_later";
|
|
1268
|
+
readonly user: {
|
|
1269
|
+
readonly title: "Services halted temporarily";
|
|
1270
|
+
readonly message: "Try again in a moment.";
|
|
1271
|
+
};
|
|
1272
|
+
};
|
|
1260
1273
|
readonly 'service.not_ready': {
|
|
1261
1274
|
readonly surfaces: readonly ["gateway", "seller", "console_server"];
|
|
1262
1275
|
readonly status: 503;
|
|
@@ -2501,6 +2514,18 @@ declare const ERRORS: {
|
|
|
2501
2514
|
readonly message: "Enter a valid agent address and try again.";
|
|
2502
2515
|
};
|
|
2503
2516
|
};
|
|
2517
|
+
readonly 'account.deposit_cap_exceeded': {
|
|
2518
|
+
readonly surfaces: readonly ["gateway", "sdk", "browser"];
|
|
2519
|
+
readonly status: 403;
|
|
2520
|
+
readonly title: "Deposit would exceed the vault beta cap";
|
|
2521
|
+
readonly paymentState: "not_charged";
|
|
2522
|
+
readonly retry: "never";
|
|
2523
|
+
readonly nextAction: "fix_request";
|
|
2524
|
+
readonly user: {
|
|
2525
|
+
readonly title: "Over the beta vault limit";
|
|
2526
|
+
readonly message: "This deposit would put your vault over the Mainnet Beta cap. Deposit less, or withdraw first.";
|
|
2527
|
+
};
|
|
2528
|
+
};
|
|
2504
2529
|
readonly 'account.finalize_mismatch': {
|
|
2505
2530
|
readonly surfaces: readonly ["gateway"];
|
|
2506
2531
|
readonly status: 409;
|
|
@@ -5045,6 +5070,13 @@ interface McpServerOptions {
|
|
|
5045
5070
|
* Stdio is the default so existing tests stay local.
|
|
5046
5071
|
*/
|
|
5047
5072
|
transport?: 'stdio' | 'http';
|
|
5073
|
+
/**
|
|
5074
|
+
* Optional fetch implementation for HTTP calls made by tools (`discover`,
|
|
5075
|
+
* `pay`, `access_context`, `receipts`). Hosted `/mcp` supplies an in-process
|
|
5076
|
+
* dispatcher for the gateway's own public origin so internal hops never
|
|
5077
|
+
* hairpin out through the public load balancer.
|
|
5078
|
+
*/
|
|
5079
|
+
fetchImpl?: typeof fetch;
|
|
5048
5080
|
}
|
|
5049
5081
|
declare function createServer(cfg: McpConfig, auth?: McpAuthContext, trace?: McpTraceHooks, options?: McpServerOptions): Server;
|
|
5050
5082
|
|
package/dist/http.d.ts
CHANGED
package/dist/http.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
|
-
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, O as OfferPublicKeySource, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, k as Offer, M as McpConfig, l as McpAuthContext, m as McpTraceHooks, n as SpendAccountPayDeps, o as createReader } from './http-
|
|
3
|
-
export { A as AgentHeldResolver, p as AgentHeldSettlement, q as MCP_TARGET_PRESETS, r as McpEnvelope, s as McpEnvelopeEntry, t as McpServerOptions, u as McpTarget, v as McpTraceContext, w as McpTraceRuntime, x as PACKAGE_NAME, y as PreparedPayment, z as SpendAccountPrepareResult, B as SpendAccountPrepareSession, T as TOOLS, E as buildSpendAccountPayKind, F as canonicalMcpRequestId, H as createServer, I as handleSuipayMcpHttpRequest, J as inspectMcpEnvelope, K as loadMcpConfig, L as parseMcpTargetFlag, Q as prepareSpendAccountPayment, R as resetAgentHeldProcessLedger, U as resolveAgentHeldSettlement, V as resolveGrantTarget, W as resolveMcpTarget, Y as sameMcpGateway, Z as traceMcpHttpRequest, _ as verifySpendAccountPayReconstructs } from './http-
|
|
2
|
+
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, O as OfferPublicKeySource, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, k as Offer, M as McpConfig, l as McpAuthContext, m as McpTraceHooks, n as SpendAccountPayDeps, o as createReader } from './http-fypqfnVw.js';
|
|
3
|
+
export { A as AgentHeldResolver, p as AgentHeldSettlement, q as MCP_TARGET_PRESETS, r as McpEnvelope, s as McpEnvelopeEntry, t as McpServerOptions, u as McpTarget, v as McpTraceContext, w as McpTraceRuntime, x as PACKAGE_NAME, y as PreparedPayment, z as SpendAccountPrepareResult, B as SpendAccountPrepareSession, T as TOOLS, E as buildSpendAccountPayKind, F as canonicalMcpRequestId, H as createServer, I as handleSuipayMcpHttpRequest, J as inspectMcpEnvelope, K as loadMcpConfig, L as parseMcpTargetFlag, Q as prepareSpendAccountPayment, R as resetAgentHeldProcessLedger, U as resolveAgentHeldSettlement, V as resolveGrantTarget, W as resolveMcpTarget, Y as sameMcpGateway, Z as traceMcpHttpRequest, _ as verifySpendAccountPayReconstructs } from './http-fypqfnVw.js';
|
|
4
4
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
5
5
|
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/server/index.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-CHTRG5KH.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-OBRKF6BI.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": "@mysten-incubation/suipay-mcp",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.35",
|
|
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
|
"repository": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"tsup": "^8.0.0",
|
|
43
43
|
"typescript": "^6.0.3",
|
|
44
44
|
"vitest": "^4.1.10",
|
|
45
|
-
"@cmdoss/suipay-
|
|
46
|
-
"@cmdoss/suipay-
|
|
45
|
+
"@cmdoss/suipay-sdk": "0.1.0",
|
|
46
|
+
"@cmdoss/suipay-core": "0.1.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsup",
|