@cmdoss/suipay-mcp 0.2.2-dev.3 → 0.2.2-dev.31
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 +77 -14
- package/dist/bin/suipay.js +2 -2
- package/dist/{chunk-C2IYSV43.js → chunk-IH6HQD2V.js} +2 -2
- package/dist/{chunk-SRMAH6MK.js → chunk-YMOMYFKL.js} +5836 -810
- package/dist/{http-B4YTVw0k.d.ts → http-DvnvTrb3.d.ts} +268 -4
- package/dist/http.d.ts +5 -1
- package/dist/http.js +1 -1
- package/dist/index.d.ts +15 -210
- package/dist/index.js +2 -2
- package/package.json +15 -14
package/README.md
CHANGED
|
@@ -5,15 +5,21 @@ 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.2.2` in MCP config
|
|
9
|
-
|
|
8
|
+
Pin `@cmdoss/suipay-mcp@0.2.2-dev.31` in MCP config for the `latest` dist-tag.
|
|
9
|
+
`npx -y @cmdoss/suipay-mcp@dev` tracks the `dev` prerelease line.
|
|
10
|
+
`1.0.1` remains on the registry as a historical release; do not install it
|
|
11
|
+
for new agents.
|
|
10
12
|
|
|
11
13
|
## Install
|
|
12
14
|
|
|
13
15
|
```bash
|
|
14
|
-
claude mcp add --scope user suipay -- npx -y @cmdoss/suipay-mcp@0.2.2
|
|
16
|
+
claude mcp add --scope user suipay -- npx -y @cmdoss/suipay-mcp@0.2.2-dev.31
|
|
15
17
|
```
|
|
16
18
|
|
|
19
|
+
`@dev` installs the Railway-dev gateway/console defaults. A workspace
|
|
20
|
+
checkout still defaults to localhost. `SUIPAY_GATEWAY_URL` and
|
|
21
|
+
`SUIPAY_CONSOLE_URL` always override.
|
|
22
|
+
|
|
17
23
|
No wallet secret belongs in this command or MCP config. There is no
|
|
18
24
|
Sign-In With Sui (SIWS) step. To reuse an existing delegate seed locally,
|
|
19
25
|
set `SUIPAY_MCP_KEY` (64-hex or `suiprivkey1…`) in the MCP env — never in
|
|
@@ -51,7 +57,7 @@ missing, expired, or revoked.
|
|
|
51
57
|
| Tool | Purpose |
|
|
52
58
|
| --- | --- |
|
|
53
59
|
| `discover` | Search live gateway resources. After login: `name`, `path`, `url`, `targetHash`, catalog price, and `affordable` (can this session cover one call — not authorization). `pay({ url })` still settles |
|
|
54
|
-
| `pay` | Fetch resource, prepare `spend_account` settlement, settle when this process holds the grant key |
|
|
60
|
+
| `pay` | Fetch resource, prepare `spend_account` settlement, 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` |
|
|
55
61
|
| `receipts` | List settlement receipts, optionally by challenge ID |
|
|
56
62
|
| `access_context` | Report current session / delegate / policy state (no secret material) |
|
|
57
63
|
| `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 |
|
|
@@ -76,13 +82,66 @@ json: {"prompt":"a cat"}
|
|
|
76
82
|
maxAmount: 50000
|
|
77
83
|
```
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
To store local bytes (Walrus), do not paste base64. Name the file and field.
|
|
86
|
+
Set `SUIPAY_MCP_FILE_ROOT` to an absolute directory; `file` must resolve inside
|
|
87
|
+
it (unset disables attach). Paths under `~/.suipay` are refused even if that
|
|
88
|
+
directory falls inside the root.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Pay this SuiPay resource with the suipay MCP `pay` tool. Do not write SDK code.
|
|
92
|
+
|
|
93
|
+
url: https://gateway.example/v1/walrus/store
|
|
94
|
+
method: POST
|
|
95
|
+
json: {"contentType":"text/plain"}
|
|
96
|
+
file: /absolute/path/to/note.txt
|
|
97
|
+
fileField: contentBase64
|
|
98
|
+
maxAmount: 50000
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`pay` uses SDK `createPayer` internally. When this process settles, a binary
|
|
102
|
+
body is written once under `~/.suipay/deliveries/` and named first in the
|
|
103
|
+
JSON as `savedTo` (absolute path) and `savedToUrl` (`file://`). Hosted `/mcp`
|
|
104
|
+
is prepare-only and does not write a buyer file. Any MIME — image, audio,
|
|
105
|
+
pdf, octet-stream. JSON stays compact (no base64 wall). An MCP `image` block
|
|
106
|
+
is an extra display hint when the type is `image/*`; hosts such as Claude
|
|
107
|
+
Code's TUI may not render it. Always quote `savedTo` when present. If
|
|
108
|
+
`savedTo` is null, quote `saveError` and do not call `pay` again.
|
|
109
|
+
|
|
110
|
+
## Tool errors — branch on `code`
|
|
111
|
+
|
|
112
|
+
A tool result whose `status` is `failed` or `ambiguous` sets `isError: true`
|
|
113
|
+
and puts the error model in `structuredContent`:
|
|
114
|
+
|
|
115
|
+
| Field | Meaning |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `status`, `paid` | As before. `paid` is `true`, `false` or `'unknown'`. |
|
|
118
|
+
| `code` | Registered error code, e.g. `request.file_outside_root`. **Branch on this**, never on the text. |
|
|
119
|
+
| `paymentState` | `charged`, `unknown` or `not_charged`; always agrees with `paid`. |
|
|
120
|
+
| `retryable` | `true` only when a retry cannot charge twice. |
|
|
121
|
+
| `nextAction` | `retry`, `retry_later`, `fix_request`, `sign_in`, `approve_access`, `add_funds`, `reconcile`, `contact_support` or `none`. |
|
|
122
|
+
| `supportCode` | Always present. The gateway's when it produced the failure; otherwise minted by this MCP server and written, with the failure, to its stderr log. Find the cause in the MCP host's log by searching for it. |
|
|
123
|
+
| `detail` | Developer text that states the fix. |
|
|
124
|
+
| `txDigest`, `paymentId` | When known. |
|
|
125
|
+
|
|
126
|
+
The text block holds the same object as JSON. When money moved or may have
|
|
127
|
+
moved it **starts** with a line for the model:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
You were charged. Do not pay again for this request.
|
|
131
|
+
{ "status": "ambiguous", "paid": true, "code": "delivery.seller_unreachable", "paymentState": "charged", ... }
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
(`This payment may have gone through. Do not pay again until it is resolved.`
|
|
135
|
+
when `paymentState` is `unknown`.) A result whose `status` is `ok` or
|
|
136
|
+
`prepared` is never an error, including a free response that needed no
|
|
137
|
+
payment.
|
|
138
|
+
|
|
139
|
+
Common local codes: `auth.login_required` (run `suipay_login`),
|
|
140
|
+
`request.file_outside_root` / `request.file_root_unset` (set
|
|
141
|
+
`SUIPAY_MCP_FILE_ROOT`), `client.local_credentials_invalid` (log in again),
|
|
142
|
+
`client.gateway_unreachable` (retry later). An unknown tool name is a JSON-RPC
|
|
143
|
+
error, not a tool result; an invalid argument such as a relative `url` is a
|
|
144
|
+
tool error with a `request.*` code and `nextAction: "fix_request"`.
|
|
86
145
|
|
|
87
146
|
## Targets
|
|
88
147
|
|
|
@@ -95,10 +154,10 @@ Default is Railway **suipay-dev**. `--local` / `target: "local"` is laptop-only.
|
|
|
95
154
|
|
|
96
155
|
```bash
|
|
97
156
|
# Railway suipay-dev (default)
|
|
98
|
-
npx @cmdoss/suipay-mcp@0.2.2
|
|
157
|
+
npx @cmdoss/suipay-mcp@0.2.2-dev.31
|
|
99
158
|
|
|
100
159
|
# Laptop stack
|
|
101
|
-
npx @cmdoss/suipay-mcp@0.2.2 --local
|
|
160
|
+
npx @cmdoss/suipay-mcp@0.2.2-dev.31 --local
|
|
102
161
|
```
|
|
103
162
|
|
|
104
163
|
`SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
|
|
@@ -158,4 +217,8 @@ node packages/mcp/dist/bin/suipay.js
|
|
|
158
217
|
Binary writes status banner to stderr only. Stdout stays reserved for
|
|
159
218
|
MCP protocol.
|
|
160
219
|
|
|
161
|
-
|
|
220
|
+
Publishing is the `release-npm` workflow: merge to `dev` publishes
|
|
221
|
+
`@cmdoss/suipay-mcp@<version>-dev.N` with dist-tag `dev` (OIDC, pack gate,
|
|
222
|
+
provenance). `latest` is a gated dispatch from `main` (`dry_run` default
|
|
223
|
+
true). Do not `npm publish` from a laptop. See
|
|
224
|
+
[`docs/guide/npm-release.md`](../../docs/guide/npm-release.md).
|
package/dist/bin/suipay.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
loadLocalSigningKeyRecord,
|
|
5
5
|
loadMcpConfig,
|
|
6
6
|
loadPaymentProfile
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YMOMYFKL.js";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -19,7 +19,7 @@ async function main() {
|
|
|
19
19
|
const argv = process.argv.slice(2);
|
|
20
20
|
const cfg = loadMcpConfig(process.env, argv);
|
|
21
21
|
const target = cfg.target ?? "dev";
|
|
22
|
-
const server = createServer(cfg);
|
|
22
|
+
const server = createServer(cfg, void 0, void 0, { transport: "stdio" });
|
|
23
23
|
await server.connect(new StdioServerTransport());
|
|
24
24
|
try {
|
|
25
25
|
const boundGateway = loadLocalSigningKeyRecord()?.gatewayUrl ?? cfg.gatewayUrl;
|