@cmdoss/suipay-mcp 0.2.2-dev.3 → 0.2.2-dev.5

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
@@ -76,13 +76,14 @@ json: {"prompt":"a cat"}
76
76
  maxAmount: 50000
77
77
  ```
78
78
 
79
- `pay` uses SDK `createPayer` internally. A binary body is written once under
80
- `~/.suipay/deliveries/` and named first in the JSON as `savedTo` (absolute
81
- path) and `savedToUrl` (`file://`). Any MIME — image, audio, pdf,
82
- octet-stream. JSON stays compact (no base64 wall). An MCP `image` block is an
83
- extra display hint when the type is `image/*`; hosts such as Claude Code's
84
- TUI may not render it. Always quote `savedTo` to the user. Do not call `pay`
85
- again to "save" a delivery that already settled.
79
+ `pay` uses SDK `createPayer` internally. When this process settles, a binary
80
+ body is written once under `~/.suipay/deliveries/` and named first in the
81
+ JSON as `savedTo` (absolute path) and `savedToUrl` (`file://`). Hosted `/mcp`
82
+ is prepare-only and does not write a buyer file. Any MIME — image, audio,
83
+ pdf, octet-stream. JSON stays compact (no base64 wall). An MCP `image` block
84
+ is an extra display hint when the type is `image/*`; hosts such as Claude
85
+ Code's TUI may not render it. Always quote `savedTo` when present. If
86
+ `savedTo` is null, quote `saveError` and do not call `pay` again.
86
87
 
87
88
  ## Targets
88
89
 
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../chunk-C2IYSV43.js";
5
- import "../chunk-SRMAH6MK.js";
4
+ } from "../chunk-P54ZYBPN.js";
5
+ import "../chunk-THLDEMGS.js";
6
6
 
7
7
  // src/bin/suipay.ts
8
8
  main().catch((err) => {
@@ -4,7 +4,7 @@ import {
4
4
  loadLocalSigningKeyRecord,
5
5
  loadMcpConfig,
6
6
  loadPaymentProfile
7
- } from "./chunk-SRMAH6MK.js";
7
+ } from "./chunk-THLDEMGS.js";
8
8
 
9
9
  // src/index.ts
10
10
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -6909,12 +6909,19 @@ function saveDeliveredBody(input) {
6909
6909
  if (input.bytes.byteLength === 0) return void 0;
6910
6910
  const dir = mcpDeliveriesDir();
6911
6911
  mkdirSync2(dir, { recursive: true, mode: 448 });
6912
+ try {
6913
+ chmodSync2(dir, 448);
6914
+ } catch {
6915
+ }
6912
6916
  const path = join3(
6913
6917
  dir,
6914
6918
  `${fileStem(input.digest, input.challengeId)}${extensionFor(input.contentType)}`
6915
6919
  );
6916
6920
  writeFileSync(path, input.bytes, { mode: 384 });
6917
- chmodSync2(path, 384);
6921
+ try {
6922
+ chmodSync2(path, 384);
6923
+ } catch {
6924
+ }
6918
6925
  return path;
6919
6926
  }
6920
6927
 
@@ -6944,6 +6951,7 @@ function receiptChallengeId(receipt) {
6944
6951
  const id = receipt.challengeId;
6945
6952
  return typeof id === "string" && id.length > 0 ? id : void 0;
6946
6953
  }
6954
+ var MCP_SAVE_ERROR = "delivery file was not written; do not call pay again";
6947
6955
  function paidResult(result) {
6948
6956
  if (!isBinaryBody(result.body)) return text(result);
6949
6957
  const body = result.body;
@@ -6968,7 +6976,12 @@ function paidResult(result) {
6968
6976
  savedToUrl: pathToFileURL(savedTo).href,
6969
6977
  ...result,
6970
6978
  body: shape
6971
- } : { ...result, body: shape };
6979
+ } : {
6980
+ savedTo: null,
6981
+ saveError: MCP_SAVE_ERROR,
6982
+ ...result,
6983
+ body: shape
6984
+ };
6972
6985
  const content = [
6973
6986
  {
6974
6987
  type: "text",
@@ -7597,7 +7610,7 @@ var TOOLS = [
7597
7610
  },
7598
7611
  {
7599
7612
  name: "pay",
7600
- description: "Pay a HTTP resource via delegate. On hosted /mcp the gateway PREPARES an unsigned transaction and returns it (prepare-only \u2014 it never holds the delegate key and cannot settle). Only a process holding the delegate key the grant names can complete settlement (e.g. local stdio MCP, or any self-hosted process with the matching key). Pass recipient and/or maxAmount to state who you intend to pay and what you will spend; both are checked before anything is signed or handed back. Local V1 allowance pay is retired. A paid binary body is written under ~/.suipay/deliveries/ and named as savedTo (absolute path) and savedToUrl (file://) at the top of the JSON. Always quote savedTo to the user so they can open the file. Do not assume the host rendered an image block. Never call pay again to display or save a delivery that already settled.",
7613
+ description: "Pay a HTTP resource via delegate. On hosted /mcp the gateway PREPARES an unsigned transaction and returns it (prepare-only \u2014 it never holds the delegate key and cannot settle). Only a process holding the delegate key the grant names can complete settlement (e.g. local stdio MCP, or any self-hosted process with the matching key). Pass recipient and/or maxAmount to state who you intend to pay and what you will spend; both are checked before anything is signed or handed back. Local V1 allowance pay is retired. When this process settles a paid binary body, it writes the bytes under ~/.suipay/deliveries/ and names savedTo (absolute path) and savedToUrl (file://) first in the JSON. Hosted /mcp is prepare-only and does not write a buyer file. Always quote savedTo when present. If savedTo is null, quote saveError and do not call pay again. Do not assume the host rendered an image block. Never call pay again to display or save a delivery that already settled.",
7601
7614
  inputSchema: {
7602
7615
  type: "object",
7603
7616
  properties: {
package/dist/http.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  handleSuipayMcpHttpRequest
3
- } from "./chunk-SRMAH6MK.js";
3
+ } from "./chunk-THLDEMGS.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-C2IYSV43.js";
4
+ } from "./chunk-P54ZYBPN.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-SRMAH6MK.js";
29
+ } from "./chunk-THLDEMGS.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": "@cmdoss/suipay-mcp",
3
- "version": "0.2.2-dev.3",
3
+ "version": "0.2.2-dev.5",
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
  "main": "./dist/index.js",