@mysten-incubation/suipay-mcp 0.3.0-dev.7 → 0.3.0-dev.9

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.7` in MCP config for the `latest` dist-tag.
8
+ Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.9` 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.7
16
+ claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.9
17
17
  ```
18
18
 
19
19
  `@dev` installs the Railway-dev gateway/console defaults. A workspace
@@ -155,10 +155,10 @@ Default is Railway **suipay-dev**. `--local` / `target: "local"` is laptop-only.
155
155
 
156
156
  ```bash
157
157
  # Railway suipay-dev (default)
158
- npx @mysten-incubation/suipay-mcp@0.3.0-dev.7
158
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.9
159
159
 
160
160
  # Laptop stack
161
- npx @mysten-incubation/suipay-mcp@0.3.0-dev.7 --local
161
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.9 --local
162
162
  ```
163
163
 
164
164
  `SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
@@ -169,12 +169,32 @@ credential is bound yet. After a successful login, `credentials.json`
169
169
  Rebind with `suipay_login({ target: "dev" | "local" })` (same key, new consent
170
170
  if that stack has no live grant).
171
171
 
172
+ ### Isolate connection environments
173
+
174
+ `SUIPAY_MCP_PROFILE` selects a separate agent-held key file at
175
+ `~/.suipay/profiles/<sha256-of-trimmed-profile>/credentials.json`. Unset or
176
+ blank keeps the existing `~/.suipay/credentials.json`. The profile is a local
177
+ storage selector, not an authorization grant or gateway override: set
178
+ `SUIPAY_GATEWAY_URL` and `SUIPAY_CONSOLE_URL` as well. Use the same stable profile
179
+ for the same environment. Login, status, discovery, pay, and logout all use
180
+ that profile; logout removes only its file. Files stay mode `0600` inside a
181
+ `0700` profile directory. Existing files are never copied, rebound, or deleted
182
+ when selecting a profile. A new profile requires fresh owner authorization.
183
+
184
+ The console's Connect Agent prompt uses its public gateway URL as the profile.
185
+ Install an MCP package that supports profiles before using this prompt, and
186
+ verify the returned login gateway matches the configured environment before
187
+ continuing. An older package may ignore the variable and reuse legacy
188
+ credentials. Stop on a mismatch; do not pay or delete the existing key.
189
+
172
190
  ## Client environment
173
191
 
174
192
  ```bash
175
193
  # Optional. Unset = Railway suipay-dev. --local uses localhost:3000 / 127.0.0.1:4340.
176
194
  SUIPAY_GATEWAY_URL=https://gateway.example
177
195
  SUIPAY_CONSOLE_URL=https://console.example
196
+ # Optional. Unset/blank retains the legacy credentials file.
197
+ SUIPAY_MCP_PROFILE=https://gateway.example
178
198
  SUIPAY_RPC_URL=https://your-testnet-rpc.example
179
199
  SUIPAY_NETWORK=testnet
180
200
  SUIPAY_MCP_TARGET=dev
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../chunk-X23ENZQ6.js";
4
+ } from "../chunk-QXBN3DSX.js";
5
5
  import {
6
6
  logError
7
- } from "../chunk-VKRYN5FA.js";
7
+ } from "../chunk-3CONDPUL.js";
8
8
 
9
9
  // src/bin/suipay.ts
10
10
  main().catch((err) => {
@@ -9988,6 +9988,7 @@ import { bytesToHex as bytesToHex4 } from "@noble/hashes/utils.js";
9988
9988
 
9989
9989
  // src/config.ts
9990
9990
  import { homedir } from "os";
9991
+ import { createHash as createHash4 } from "crypto";
9991
9992
  import { join as join2 } from "path";
9992
9993
  import { SuiGrpcClient as SuiGrpcClient2 } from "@mysten/sui/grpc";
9993
9994
  import { normalizeSuiAddress as normalizeSuiAddress7 } from "@mysten/sui/utils";
@@ -10054,6 +10055,11 @@ function configError(detail) {
10054
10055
  }
10055
10056
  function mcpCredentialsPath() {
10056
10057
  const home = process.env.HOME ?? process.env.USERPROFILE ?? homedir();
10058
+ const profile2 = process.env.SUIPAY_MCP_PROFILE?.trim();
10059
+ if (profile2) {
10060
+ const id = createHash4("sha256").update(profile2).digest("hex");
10061
+ return join2(home, ".suipay", "profiles", id, "credentials.json");
10062
+ }
10057
10063
  return join2(home, ".suipay", "credentials.json");
10058
10064
  }
10059
10065
  var MCP_TARGET_PRESETS = {
@@ -13182,6 +13188,13 @@ function receiptChallengeId(receipt) {
13182
13188
  return typeof id === "string" && id.length > 0 ? id : void 0;
13183
13189
  }
13184
13190
  var MCP_SAVE_ERROR = "delivery file was not written; do not call pay again";
13191
+ var MCP_EMPTY_DELIVERY = "the seller returned an empty delivery body; no file was written; do not call pay again";
13192
+ function deliverySaveError(cause, result) {
13193
+ const code = cause?.code;
13194
+ const reason = typeof code === "string" && /^E[A-Z0-9_]+$/.test(code) ? code : "file-system operation failed";
13195
+ const recovery = result.paid === true && result.txDigest ? `the body was not saved locally and cannot be re-fetched here; transaction digest ${result.txDigest} identifies the settlement for support` : "no confirmed transaction digest is available";
13196
+ return `${MCP_SAVE_ERROR}; cause: ${reason}; ${recovery}`;
13197
+ }
13185
13198
  function paidResult(result) {
13186
13199
  if (!isBinaryBody(result.body)) return text(result);
13187
13200
  const body = result.body;
@@ -13191,6 +13204,7 @@ function paidResult(result) {
13191
13204
  byteLength: body.byteLength
13192
13205
  };
13193
13206
  let savedTo;
13207
+ let saveError = MCP_EMPTY_DELIVERY;
13194
13208
  try {
13195
13209
  savedTo = saveDeliveredBody({
13196
13210
  bytes: body.bytes,
@@ -13198,8 +13212,8 @@ function paidResult(result) {
13198
13212
  digest: result.txDigest,
13199
13213
  challengeId: receiptChallengeId(result.receipt)
13200
13214
  });
13201
- } catch {
13202
- savedTo = void 0;
13215
+ } catch (cause) {
13216
+ saveError = deliverySaveError(cause, result);
13203
13217
  }
13204
13218
  const payload = savedTo ? {
13205
13219
  savedTo,
@@ -13208,7 +13222,7 @@ function paidResult(result) {
13208
13222
  body: shape
13209
13223
  } : {
13210
13224
  savedTo: null,
13211
- saveError: MCP_SAVE_ERROR,
13225
+ saveError,
13212
13226
  saveErrorCode: "client.delivery_file_not_saved",
13213
13227
  ...result,
13214
13228
  body: shape
@@ -5,7 +5,7 @@ import {
5
5
  loadMcpConfig,
6
6
  loadPaymentProfile,
7
7
  logError
8
- } from "./chunk-VKRYN5FA.js";
8
+ } from "./chunk-3CONDPUL.js";
9
9
 
10
10
  // src/index.ts
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/dist/http.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  handleSuipayMcpHttpRequest
3
- } from "./chunk-VKRYN5FA.js";
3
+ } from "./chunk-3CONDPUL.js";
4
4
  export {
5
5
  handleSuipayMcpHttpRequest
6
6
  };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadBootProfile,
3
3
  main
4
- } from "./chunk-X23ENZQ6.js";
4
+ } from "./chunk-QXBN3DSX.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-VKRYN5FA.js";
29
+ } from "./chunk-3CONDPUL.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.7",
3
+ "version": "0.3.0-dev.9",
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": {