@mysten-incubation/suipay-mcp 0.3.0-dev.3 → 0.3.0-dev.30

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.3` in MCP config for the `latest` dist-tag.
8
+ Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.30` 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.3
16
+ claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.30
17
17
  ```
18
18
 
19
19
  `@dev` installs the Railway-dev gateway/console defaults. A workspace
@@ -34,11 +34,10 @@ 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 Railway **suipay-dev**. Pass
38
- `suipay_login({ target: "local" })` or start the binary with `--local`
37
+ 3. Point MCP at a gateway. Default is Railway **suipay-dev**. Start the binary with `--local`
39
38
  for the laptop stack. Env/CLI fill the process default until a
40
- credential is bound; after login, stored `gatewayUrl` wins. Rebind
41
- with `suipay_login({ target })`.
39
+ credential is bound; after login, stored `gatewayUrl` wins. Use a separate
40
+ `SUIPAY_MCP_PROFILE` for another gateway; a tool argument cannot rebind a key.
42
41
  4. Call `pay` with `maxAmount`. On stdio the grant cap is not a default.
43
42
  An open grant returns the payee and does not sign until a later call
44
43
  names that recipient. When this process holds the grant's key and the
@@ -50,7 +49,8 @@ a browser URL, a SuiPay backend, logs, or a callback payload. Only the
50
49
  public address leaves the local process. `suipay_login` mints or reuses
51
50
  the local version-2 key at `~/.suipay/credentials.json` (mode `0600`) and
52
51
  returns `{SUIPAY_CONSOLE_URL}/connect/agent?port=&delegateAddress=&connectState=&gateway=`
53
- immediately. The owner signs in the browser; the loopback callback persists
52
+ immediately. Open that complete link in your browser (the MCP process does not
53
+ launch a browser or write a temporary launch page). The owner signs in the browser; the loopback callback persists
54
54
  key + gateway URL. Subsequent sessions reuse the file unless the grant is
55
55
  missing, expired, or revoked.
56
56
 
@@ -62,7 +62,7 @@ missing, expired, or revoked.
62
62
  | `pay` | On stdio, `maxAmount` is required. An open grant returns the gateway payee and does not sign until `recipient` names it. Otherwise prepare `spend_account` settlement and settle when this process holds the grant key. POST `json` is the paid body. Optional stdio `file` + `fileField` fill one JSON key from a local file as canonical base64 (Walrus `contentBase64`); requires `SUIPAY_MCP_FILE_ROOT`; hosted `/mcp` refuses `file` |
63
63
  | `receipts` | List settlement receipts, optionally by challenge ID |
64
64
  | `access_context` | Report current session / delegate / policy state (no secret material) |
65
- | `suipay_login` | Mint or reuse the local delegate key and return a clickable console URL (does not wait for the wallet). Default target is Railway suipay-dev; pass `target: "local"` for the laptop stack |
65
+ | `suipay_login` | Mint or reuse the local delegate key and return a clickable console URL (does not wait for the wallet). Uses the process-configured target; start with `--local` for the laptop stack |
66
66
  | `suipay_logout` | Remove local credentials |
67
67
 
68
68
  All tools remain visible before a grant is bound. `pay` and `receipts`
@@ -87,7 +87,13 @@ maxAmount: 50000
87
87
  To store local bytes (Walrus), do not paste base64. Name the file and field.
88
88
  Set `SUIPAY_MCP_FILE_ROOT` to an absolute directory; `file` must resolve inside
89
89
  it (unset disables attach). Paths under `~/.suipay` are refused even if that
90
- directory falls inside the root.
90
+ directory falls inside the root. Files with multiple hard links are also refused
91
+ (`request.file_forbidden`), because an allowed path can share a private file's
92
+ bytes. Use a regular file with a single hard link for attachments.
93
+
94
+ This checks current links, not where the bytes came from. A pre-existing hard
95
+ link can pass after the private original is deleted or atomically replaced,
96
+ leaving one link. Do not place hard links to private files in the attachment root.
91
97
 
92
98
  ```
93
99
  Pay this SuiPay resource with the suipay MCP `pay` tool. Do not write SDK code.
@@ -146,28 +152,48 @@ tool error with a `request.*` code and `nextAction: "fix_request"`.
146
152
 
147
153
  ## Targets
148
154
 
149
- Default is Railway **suipay-dev**. `--local` / `target: "local"` is laptop-only.
155
+ Default is Railway **suipay-dev**. Start with `--local` for the laptop stack.
150
156
 
151
157
  | Target | Console | Gateway | How |
152
158
  | --- | --- | --- | --- |
153
159
  | `dev` (default) | `https://suipay-dev.up.railway.app` | `https://gateway-dev-ba84.up.railway.app` | no flag, or `--dev` |
154
- | `local` | `http://localhost:3000` | `http://127.0.0.1:4340` | `--local` / `-local`, or `suipay_login({ target: "local" })` |
160
+ | `local` | `http://localhost:3000` | `http://127.0.0.1:4340` | `--local` / `-local` |
155
161
 
156
162
  ```bash
157
163
  # Railway suipay-dev (default)
158
- npx @mysten-incubation/suipay-mcp@0.3.0-dev.3
164
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.30
159
165
 
160
166
  # Laptop stack
161
- npx @mysten-incubation/suipay-mcp@0.3.0-dev.3 --local
167
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.30 --local
162
168
  ```
163
169
 
164
170
  `SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
165
171
  `SUIPAY_GATEWAY_URL` / `SUIPAY_CONSOLE_URL` fill the process default when no
166
172
  credential is bound yet. After a successful login, `credentials.json`
167
- `gatewayUrl` is the bound gateway: `pay` / `discover` / `suipay_login` without
168
- `target` stay on that binding so a leftover env cannot silently retarget spend.
169
- Rebind with `suipay_login({ target: "dev" | "local" })` (same key, new consent
170
- if that stack has no live grant).
173
+ `gatewayUrl` is the bound gateway: `pay` / `discover` stay on that binding so a
174
+ leftover env cannot silently retarget spend. `suipay_login` refuses a process
175
+ gateway that differs from the stored binding, with or without `target`.
176
+ A `suipay_login({ target })` argument must also match the process gateway.
177
+ To connect another environment, restart with its target and a separate
178
+ `SUIPAY_MCP_PROFILE`; the existing key binding stays unchanged.
179
+
180
+ ### Isolate connection environments
181
+
182
+ `SUIPAY_MCP_PROFILE` selects a separate agent-held key file at
183
+ `~/.suipay/profiles/<sha256-of-trimmed-profile>/credentials.json`. Unset or
184
+ blank keeps the existing `~/.suipay/credentials.json`. The profile is a local
185
+ storage selector, not an authorization grant or gateway override: set
186
+ `SUIPAY_GATEWAY_URL` and `SUIPAY_CONSOLE_URL` as well. Use the same stable profile
187
+ for the same environment. Login, status, discovery, pay, and logout all use
188
+ that profile; logout removes only its file. Files stay mode `0600` inside a
189
+ `0700` profile directory. Existing files are never copied, rebound, or deleted
190
+ when selecting a profile. A new profile requires fresh owner authorization.
191
+
192
+ The console's Connect Agent prompt uses its public gateway URL as the profile.
193
+ Install an MCP package that supports profiles before using this prompt, and
194
+ verify the returned login gateway matches the configured environment before
195
+ continuing. An older package may ignore the variable and reuse legacy
196
+ credentials. Stop on a mismatch; do not pay or delete the existing key.
171
197
 
172
198
  ## Client environment
173
199
 
@@ -175,6 +201,8 @@ if that stack has no live grant).
175
201
  # Optional. Unset = Railway suipay-dev. --local uses localhost:3000 / 127.0.0.1:4340.
176
202
  SUIPAY_GATEWAY_URL=https://gateway.example
177
203
  SUIPAY_CONSOLE_URL=https://console.example
204
+ # Optional. Unset/blank retains the legacy credentials file.
205
+ SUIPAY_MCP_PROFILE=https://gateway.example
178
206
  SUIPAY_RPC_URL=https://your-testnet-rpc.example
179
207
  SUIPAY_NETWORK=testnet
180
208
  SUIPAY_MCP_TARGET=dev
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../chunk-OAHWW4H7.js";
4
+ } from "../chunk-U4VGOG67.js";
5
5
  import {
6
6
  logError
7
- } from "../chunk-HIBLRYTW.js";
7
+ } from "../chunk-XQW6WNT3.js";
8
8
 
9
9
  // src/bin/suipay.ts
10
10
  main().catch((err) => {
@@ -5,7 +5,7 @@ import {
5
5
  loadMcpConfig,
6
6
  loadPaymentProfile,
7
7
  logError
8
- } from "./chunk-HIBLRYTW.js";
8
+ } from "./chunk-XQW6WNT3.js";
9
9
 
10
10
  // src/index.ts
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";