@mysten-incubation/suipay-mcp 0.3.0-dev.27 → 0.3.0-dev.29
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
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.29` 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,7 +13,7 @@ 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.29
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`@dev` installs the Railway-dev gateway/console defaults. A workspace
|
|
@@ -161,10 +161,10 @@ Default is Railway **suipay-dev**. Start with `--local` for the laptop stack.
|
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
163
|
# Railway suipay-dev (default)
|
|
164
|
-
npx @mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
164
|
+
npx @mysten-incubation/suipay-mcp@0.3.0-dev.29
|
|
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.29 --local
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
`SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
|
package/dist/bin/suipay.js
CHANGED
|
@@ -2598,8 +2598,7 @@ var VALUE_PATTERNS = [
|
|
|
2598
2598
|
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,
|
|
2599
2599
|
// Sui bech32 private keys.
|
|
2600
2600
|
/suiprivkey1[0-9a-z]{20,}/gi,
|
|
2601
|
-
// JSON Web Tokens
|
|
2602
|
-
/\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}/g,
|
|
2601
|
+
// JSON Web Tokens are matched by `redactJwts`, not a regex here.
|
|
2603
2602
|
// Bearer and Payment authorization values.
|
|
2604
2603
|
/\b(Bearer|Payment|Basic)\s+[A-Za-z0-9\-._~+/=,:]{8,}(?:\s*,\s*[a-z]+="[^"]*")*/g,
|
|
2605
2604
|
// `sk-…`-style vendor keys.
|
|
@@ -2609,6 +2608,44 @@ var VALUE_PATTERNS = [
|
|
|
2609
2608
|
// Google API keys.
|
|
2610
2609
|
/\bAIza[0-9A-Za-z_-]{30,}/g
|
|
2611
2610
|
];
|
|
2611
|
+
var JWT_POSITION = 2;
|
|
2612
|
+
var WORD_CHAR = /[A-Za-z0-9_]/;
|
|
2613
|
+
var JWT_CHAR = /[A-Za-z0-9_-]/;
|
|
2614
|
+
function redactJwts(text2) {
|
|
2615
|
+
if (!text2.includes("eyJ"))
|
|
2616
|
+
return text2;
|
|
2617
|
+
const stop = new Int32Array(text2.length + 1);
|
|
2618
|
+
stop[text2.length] = text2.length;
|
|
2619
|
+
for (let p = text2.length - 1; p >= 0; p -= 1) {
|
|
2620
|
+
stop[p] = JWT_CHAR.test(text2[p]) ? stop[p + 1] : p;
|
|
2621
|
+
}
|
|
2622
|
+
const segment = (from) => from <= text2.length ? stop[from] : -1;
|
|
2623
|
+
let out = "";
|
|
2624
|
+
let last = 0;
|
|
2625
|
+
let i = text2.indexOf("eyJ");
|
|
2626
|
+
while (i !== -1) {
|
|
2627
|
+
let end = -1;
|
|
2628
|
+
if (i === 0 || !WORD_CHAR.test(text2[i - 1])) {
|
|
2629
|
+
const first = segment(i + 3);
|
|
2630
|
+
if (first - (i + 3) >= 5 && text2[first] === ".") {
|
|
2631
|
+
const second = segment(first + 1);
|
|
2632
|
+
if (second - (first + 1) >= 5 && text2[second] === ".") {
|
|
2633
|
+
const third = segment(second + 1);
|
|
2634
|
+
if (third - (second + 1) >= 5)
|
|
2635
|
+
end = third;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
if (end === -1) {
|
|
2640
|
+
i = text2.indexOf("eyJ", i + 1);
|
|
2641
|
+
continue;
|
|
2642
|
+
}
|
|
2643
|
+
out += text2.slice(last, i) + REDACTED;
|
|
2644
|
+
last = end;
|
|
2645
|
+
i = text2.indexOf("eyJ", end);
|
|
2646
|
+
}
|
|
2647
|
+
return out + text2.slice(last);
|
|
2648
|
+
}
|
|
2612
2649
|
var JSON_SECRET_KEY_COLON = new RegExp(String.raw`(\\?)(["'])([\w.-]{0,64}${SECRET_KEY_SOURCE}[\w.-]{0,64}|key)(\\\2|\2)(\s*:\s*)`, "gi");
|
|
2613
2650
|
var KEY_VALUE_PATTERN = new RegExp(String.raw`((?:(?<![\w.-])[\w.-]{0,64}${SECRET_KEY_SOURCE}[\w.-]{0,64}|(?<![\w.-])key)\s*[:=]\s*)("(?:\\.|[^"\\])*"?|'(?:\\.|[^'\\])*'?|(?![[{])[^\s"',;&}]+)`, "gi");
|
|
2614
2651
|
var INSPECT_SECRET_KEY = new RegExp(String.raw`(?:(?<![\w.-])[\w.-]{0,64}${SECRET_KEY_SOURCE}[\w.-]{0,64}|(?<![\w.-])key)\s*[:=]\s*`, "gi");
|
|
@@ -2646,8 +2683,11 @@ function redactSecrets(text2) {
|
|
|
2646
2683
|
const head = dropSplitToken(text2.slice(0, REDACT_MAX_LENGTH));
|
|
2647
2684
|
out = `${head} \u2026[truncated ${text2.length - head.length} chars]`;
|
|
2648
2685
|
}
|
|
2649
|
-
for (const pattern of VALUE_PATTERNS)
|
|
2686
|
+
for (const [index, pattern] of VALUE_PATTERNS.entries()) {
|
|
2687
|
+
if (index === JWT_POSITION)
|
|
2688
|
+
out = redactJwts(out);
|
|
2650
2689
|
out = out.replace(pattern, REDACTED);
|
|
2690
|
+
}
|
|
2651
2691
|
out = out.replace(URL_PATTERN, (_match, scheme, userinfo, host, path, query) => `${scheme}://${userinfo ? `${REDACTED}@` : ""}${host}${path}${query ? `?${REDACTED}` : ""}`);
|
|
2652
2692
|
out = out.replace(RELATIVE_URL_QUERY, (_m, prefix, path) => `${prefix}${path}?${REDACTED}`);
|
|
2653
2693
|
out = redactJsonSecretValues(out);
|
|
@@ -3262,9 +3302,11 @@ var CONTEXT_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
|
3262
3302
|
"ownerDailyMist",
|
|
3263
3303
|
"ownerHourlyMist",
|
|
3264
3304
|
"ownerIdentityDailyMist",
|
|
3305
|
+
"ownerIdentityHourlyMist",
|
|
3265
3306
|
"delegateDailyMist",
|
|
3266
3307
|
"delegateHourlyMist",
|
|
3267
3308
|
"delegateIdentityDailyMist",
|
|
3309
|
+
"delegateIdentityHourlyMist",
|
|
3268
3310
|
"consecutiveFailures",
|
|
3269
3311
|
"failuresInARow",
|
|
3270
3312
|
"epochReadFailures",
|
|
@@ -3796,14 +3838,18 @@ function normalizeHexAddress(address) {
|
|
|
3796
3838
|
}
|
|
3797
3839
|
return `0x${hex.padStart(64, "0")}`;
|
|
3798
3840
|
}
|
|
3841
|
+
var SLASH = 47;
|
|
3799
3842
|
function normalizePath(path) {
|
|
3800
3843
|
const p = path.trim();
|
|
3801
3844
|
if (!p.startsWith("/")) {
|
|
3802
3845
|
throw new Error("Path must be an absolute path starting with /.");
|
|
3803
3846
|
}
|
|
3804
|
-
if (p.length
|
|
3805
|
-
return p
|
|
3806
|
-
|
|
3847
|
+
if (p.length <= 1)
|
|
3848
|
+
return p;
|
|
3849
|
+
let end = p.length;
|
|
3850
|
+
while (end > 0 && p.charCodeAt(end - 1) === SLASH)
|
|
3851
|
+
end -= 1;
|
|
3852
|
+
return end === p.length ? p : p.slice(0, end);
|
|
3807
3853
|
}
|
|
3808
3854
|
function normalizeMethod(method) {
|
|
3809
3855
|
const m = method.trim().toUpperCase();
|
|
@@ -6938,8 +6984,35 @@ function assertPaidMethod(method) {
|
|
|
6938
6984
|
return upper;
|
|
6939
6985
|
throw new PaidRequestError("method", `paid request method must be GET or POST, got ${method}`);
|
|
6940
6986
|
}
|
|
6987
|
+
var MAX_RAW_CONTENT_TYPE_LENGTH = 1024;
|
|
6988
|
+
var WHITESPACE = /\s/;
|
|
6989
|
+
function collapseAround(value, mark, replacement) {
|
|
6990
|
+
let out = "";
|
|
6991
|
+
let pending = "";
|
|
6992
|
+
let afterMark = false;
|
|
6993
|
+
for (const ch of value) {
|
|
6994
|
+
if (WHITESPACE.test(ch)) {
|
|
6995
|
+
if (!afterMark)
|
|
6996
|
+
pending += ch;
|
|
6997
|
+
continue;
|
|
6998
|
+
}
|
|
6999
|
+
if (ch === mark) {
|
|
7000
|
+
out += replacement;
|
|
7001
|
+
pending = "";
|
|
7002
|
+
afterMark = true;
|
|
7003
|
+
continue;
|
|
7004
|
+
}
|
|
7005
|
+
out += pending + ch;
|
|
7006
|
+
pending = "";
|
|
7007
|
+
afterMark = false;
|
|
7008
|
+
}
|
|
7009
|
+
return afterMark ? out : out + pending;
|
|
7010
|
+
}
|
|
6941
7011
|
function normalizeContentType(value) {
|
|
6942
|
-
|
|
7012
|
+
if (value.length > MAX_RAW_CONTENT_TYPE_LENGTH) {
|
|
7013
|
+
throw new PaidRequestError("invalid", `paid request content type is ${value.length} characters; max is ${MAX_RAW_CONTENT_TYPE_LENGTH}`);
|
|
7014
|
+
}
|
|
7015
|
+
const normalized = collapseAround(collapseAround(value.trim().toLowerCase(), ";", "; "), "=", "=");
|
|
6943
7016
|
if (!isOfferContentType(normalized)) {
|
|
6944
7017
|
throw new PaidRequestError("invalid", `paid request content type is malformed: ${value}`);
|
|
6945
7018
|
}
|
|
@@ -13792,11 +13865,16 @@ function catalogRowTargetHash(row) {
|
|
|
13792
13865
|
return null;
|
|
13793
13866
|
}
|
|
13794
13867
|
}
|
|
13868
|
+
function withoutTrailingSlashes(value) {
|
|
13869
|
+
let end = value.length;
|
|
13870
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
13871
|
+
return value.slice(0, end);
|
|
13872
|
+
}
|
|
13795
13873
|
function catalogRowResourceUrl(row, gatewayUrl) {
|
|
13796
13874
|
const listed = asString(row.resourceUrl);
|
|
13797
|
-
if (/^https?:\/\//i.test(listed)) return listed
|
|
13875
|
+
if (/^https?:\/\//i.test(listed)) return withoutTrailingSlashes(listed);
|
|
13798
13876
|
const path = asString(row.path);
|
|
13799
|
-
const base = gatewayUrl
|
|
13877
|
+
const base = withoutTrailingSlashes(gatewayUrl);
|
|
13800
13878
|
if (!path) return base;
|
|
13801
13879
|
return `${base}${path.startsWith("/") ? path : `/${path}`}`;
|
|
13802
13880
|
}
|
|
@@ -15002,30 +15080,67 @@ function budgetFromBalance(balance, grant) {
|
|
|
15002
15080
|
};
|
|
15003
15081
|
}
|
|
15004
15082
|
async function fetchPublicCatalog(gatewayUrl, fetchImpl, deps) {
|
|
15005
|
-
const
|
|
15006
|
-
let
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
|
|
15011
|
-
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15083
|
+
const services = [];
|
|
15084
|
+
let cursor = null;
|
|
15085
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15086
|
+
const maxPages = 20;
|
|
15087
|
+
for (let page = 0; page < maxPages; page++) {
|
|
15088
|
+
const catalogUrl = new URL("/v1/services", gatewayUrl);
|
|
15089
|
+
if (cursor) catalogUrl.searchParams.set("cursor", cursor);
|
|
15090
|
+
let response;
|
|
15091
|
+
try {
|
|
15092
|
+
response = await (fetchImpl ?? fetch)(catalogUrl, {
|
|
15093
|
+
signal: AbortSignal.timeout(1e4)
|
|
15094
|
+
});
|
|
15095
|
+
} catch (err) {
|
|
15096
|
+
return {
|
|
15097
|
+
ok: false,
|
|
15098
|
+
result: toolFailure(
|
|
15099
|
+
fieldsFor(
|
|
15100
|
+
surfaceOf(deps) === "mcp_hosted" ? "service.unavailable" : "client.gateway_unreachable",
|
|
15101
|
+
"not_charged",
|
|
15102
|
+
"the gateway catalog could not be reached"
|
|
15103
|
+
),
|
|
15104
|
+
{ cause: err }
|
|
15105
|
+
)
|
|
15106
|
+
};
|
|
15107
|
+
}
|
|
15108
|
+
if (!response.ok) {
|
|
15109
|
+
return {
|
|
15110
|
+
ok: false,
|
|
15111
|
+
result: unavailable(deps, `the gateway catalog answered HTTP ${response.status}`)
|
|
15112
|
+
};
|
|
15113
|
+
}
|
|
15114
|
+
let body;
|
|
15115
|
+
try {
|
|
15116
|
+
body = await response.json();
|
|
15117
|
+
} catch (err) {
|
|
15118
|
+
return {
|
|
15119
|
+
ok: false,
|
|
15120
|
+
result: unavailable(deps, "the gateway catalog response is malformed")
|
|
15121
|
+
};
|
|
15122
|
+
}
|
|
15123
|
+
const rows = body && typeof body === "object" && Array.isArray(body.services) ? body.services : null;
|
|
15124
|
+
if (!rows) {
|
|
15125
|
+
if (services.length === 0) return { ok: true, catalog: body };
|
|
15126
|
+
return {
|
|
15127
|
+
ok: false,
|
|
15128
|
+
result: unavailable(deps, "the gateway catalog response is malformed")
|
|
15129
|
+
};
|
|
15130
|
+
}
|
|
15131
|
+
services.push(...rows);
|
|
15132
|
+
const next = body && typeof body === "object" ? body.nextCursor : void 0;
|
|
15133
|
+
if (typeof next !== "string" || next === "") break;
|
|
15134
|
+
if (seen.has(next) || page + 1 >= maxPages) {
|
|
15135
|
+
return {
|
|
15136
|
+
ok: false,
|
|
15137
|
+
result: unavailable(deps, "the gateway catalog was truncated")
|
|
15138
|
+
};
|
|
15139
|
+
}
|
|
15140
|
+
seen.add(next);
|
|
15141
|
+
cursor = next;
|
|
15027
15142
|
}
|
|
15028
|
-
return { ok: true, catalog:
|
|
15143
|
+
return { ok: true, catalog: { count: services.length, services } };
|
|
15029
15144
|
}
|
|
15030
15145
|
async function publicCatalog(gatewayUrl, query, fetchImpl, deps) {
|
|
15031
15146
|
const loaded = await fetchPublicCatalog(gatewayUrl, fetchImpl, deps);
|
package/dist/http.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadBootProfile,
|
|
3
3
|
main
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-U4VGOG67.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-XQW6WNT3.js";
|
|
30
30
|
export {
|
|
31
31
|
MCP_TARGET_PRESETS,
|
|
32
32
|
PACKAGE_NAME,
|
package/package.json
CHANGED