@mysten-incubation/suipay-mcp 0.3.0-dev.13 → 0.3.0-dev.14

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.13` in MCP config for the `latest` dist-tag.
8
+ Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.14` 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.13
16
+ claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.14
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.13
158
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.14
159
159
 
160
160
  # Laptop stack
161
- npx @mysten-incubation/suipay-mcp@0.3.0-dev.13 --local
161
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.14 --local
162
162
  ```
163
163
 
164
164
  `SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../chunk-D6LFU4VE.js";
4
+ } from "../chunk-PQVBESG2.js";
5
5
  import {
6
6
  logError
7
- } from "../chunk-RD34GGSA.js";
7
+ } from "../chunk-VLN3ZX5D.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-RD34GGSA.js";
8
+ } from "./chunk-VLN3ZX5D.js";
9
9
 
10
10
  // src/index.ts
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -13788,6 +13788,12 @@ function normalizePayIntent(args) {
13788
13788
  }
13789
13789
  intent.maxAmount = BigInt(raw);
13790
13790
  }
13791
+ if (args.dialect !== void 0 && args.dialect !== null) {
13792
+ if (args.dialect !== "mpp" && args.dialect !== "x402") {
13793
+ throw invalidArgument("dialect must be mpp or x402");
13794
+ }
13795
+ intent.dialect = args.dialect;
13796
+ }
13791
13797
  return intent;
13792
13798
  }
13793
13799
  function intentViolation(intent, prepared) {
@@ -13813,6 +13819,9 @@ function intentViolation(intent, prepared) {
13813
13819
  return `prepared payment costs ${amount} which exceeds the requested maxAmount ${intent.maxAmount}`;
13814
13820
  }
13815
13821
  }
13822
+ if (intent.dialect && prepared.dialect !== intent.dialect) {
13823
+ return `prepared payment uses ${prepared.dialect}, not the requested dialect ${intent.dialect}`;
13824
+ }
13816
13825
  return null;
13817
13826
  }
13818
13827
  async function pay(args, cfg, deps = {}) {
@@ -13859,6 +13868,12 @@ async function pay(args, cfg, deps = {}) {
13859
13868
  return mcpFailure(kind === "too_large" ? "request.body_too_large" : "request.invalid", detail);
13860
13869
  }
13861
13870
  if (deps.auth?.spendAccountPay) {
13871
+ if (deps.agentHeld && intent.dialect === "x402") {
13872
+ return mcpFailure(
13873
+ "account.policy_rejected",
13874
+ "dialect x402 is not supported when settling a prepared payment here; use stdio pay"
13875
+ );
13876
+ }
13862
13877
  const sp = deps.auth.spendAccountPay;
13863
13878
  const trace = payerTrace(deps);
13864
13879
  const liveKindBuilder = !deps.buildPayKind && !deps.agentHeld ? createSpendAccountChain({
@@ -13877,6 +13892,7 @@ async function pay(args, cfg, deps = {}) {
13877
13892
  ...sp.assertLive ? { assertLive: sp.assertLive } : {}
13878
13893
  },
13879
13894
  cfg,
13895
+ ...intent.dialect ? { preferredDialect: intent.dialect } : {},
13880
13896
  deps: {
13881
13897
  ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {},
13882
13898
  ...trace ? { trace } : {},
@@ -14040,6 +14056,7 @@ async function payStdioWithLocalKey(args) {
14040
14056
  method: request.method,
14041
14057
  ...request.method === "POST" ? { body: request.body } : {},
14042
14058
  ...request.contentType ? { contentType: request.contentType } : {},
14059
+ ...intent.dialect ? { dialect: intent.dialect } : {},
14043
14060
  intent: {
14044
14061
  maxAmount,
14045
14062
  asset: payer.grant.coinType,
@@ -14636,6 +14653,11 @@ var TOOLS = [
14636
14653
  maxAmount: {
14637
14654
  type: "string",
14638
14655
  description: "Atomic ceiling you will spend on this call. The payment is refused, unsigned, if the offer costs more."
14656
+ },
14657
+ dialect: {
14658
+ type: "string",
14659
+ enum: ["mpp", "x402"],
14660
+ description: "Payment dialect to settle in when the 402 offers both. Defaults to mpp. A declared dialect the payment cannot use is refused, unsigned."
14639
14661
  }
14640
14662
  },
14641
14663
  required: ["url"]
@@ -14784,7 +14806,8 @@ function createServer2(cfg, auth, trace, options = {}) {
14784
14806
  ...args.json !== void 0 ? { json: args.json } : {},
14785
14807
  ...transport === "stdio" ? fileArgs : {},
14786
14808
  ...args.recipient !== void 0 ? { recipient: args.recipient } : {},
14787
- ...args.maxAmount !== void 0 ? { maxAmount: args.maxAmount } : {}
14809
+ ...args.maxAmount !== void 0 ? { maxAmount: args.maxAmount } : {},
14810
+ ...args.dialect !== void 0 ? { dialect: args.dialect } : {}
14788
14811
  },
14789
14812
  cfg,
14790
14813
  {
@@ -4934,6 +4934,11 @@ declare const TOOLS: readonly [{
4934
4934
  readonly type: "string";
4935
4935
  readonly description: "Atomic ceiling you will spend on this call. The payment is refused, unsigned, if the offer costs more.";
4936
4936
  };
4937
+ readonly dialect: {
4938
+ readonly type: "string";
4939
+ readonly enum: readonly ["mpp", "x402"];
4940
+ readonly description: "Payment dialect to settle in when the 402 offers both. Defaults to mpp. A declared dialect the payment cannot use is refused, unsigned.";
4941
+ };
4937
4942
  };
4938
4943
  readonly required: readonly ["url"];
4939
4944
  };
package/dist/http.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { I as handleSuipayMcpHttpRequest } from './http-ZG_iISm1.js';
1
+ export { I as handleSuipayMcpHttpRequest } from './http-UzIPB5sy.js';
2
2
  import '@modelcontextprotocol/sdk/server/index.js';
3
3
  import '@mysten/sui/keypairs/ed25519';
4
4
  import 'node:crypto';
package/dist/http.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  handleSuipayMcpHttpRequest
3
- } from "./chunk-RD34GGSA.js";
3
+ } from "./chunk-VLN3ZX5D.js";
4
4
  export {
5
5
  handleSuipayMcpHttpRequest
6
6
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
2
- import { S as SpendAccountSigningRequest, P as PaidHttpRequest, D as DelegatedKeySigner, G as GetObjectJson, a as DelegatedPayerSession, b as DelegatedPayerConfig, c as DelegatedPayerDeps, d as SpendIntent, e as DelegatedPayResult, f as DelegationScope, C as CodeFor, N as NextAction, g as GrantPolicyBinding, h as PaymentAttemptLedger, O as OfferPublicKeySource, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, k as Offer, M as McpConfig, l as McpAuthContext, m as McpTraceHooks, n as SpendAccountPayDeps, o as createReader } from './http-ZG_iISm1.js';
3
- export { A as AgentHeldResolver, p as AgentHeldSettlement, q as MCP_TARGET_PRESETS, r as McpEnvelope, s as McpEnvelopeEntry, t as McpServerOptions, u as McpTarget, v as McpTraceContext, w as McpTraceRuntime, x as PACKAGE_NAME, y as PreparedPayment, z as SpendAccountPrepareResult, B as SpendAccountPrepareSession, T as TOOLS, E as buildSpendAccountPayKind, F as canonicalMcpRequestId, H as createServer, I as handleSuipayMcpHttpRequest, J as inspectMcpEnvelope, K as loadMcpConfig, L as parseMcpTargetFlag, Q as prepareSpendAccountPayment, R as resetAgentHeldProcessLedger, U as resolveAgentHeldSettlement, V as resolveGrantTarget, W as resolveMcpTarget, Y as sameMcpGateway, Z as traceMcpHttpRequest, _ as verifySpendAccountPayReconstructs } from './http-ZG_iISm1.js';
2
+ import { S as SpendAccountSigningRequest, P as PaidHttpRequest, D as DelegatedKeySigner, G as GetObjectJson, a as DelegatedPayerSession, b as DelegatedPayerConfig, c as DelegatedPayerDeps, d as SpendIntent, e as DelegatedPayResult, f as DelegationScope, C as CodeFor, N as NextAction, g as GrantPolicyBinding, h as PaymentAttemptLedger, O as OfferPublicKeySource, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, k as Offer, M as McpConfig, l as McpAuthContext, m as McpTraceHooks, n as SpendAccountPayDeps, o as createReader } from './http-UzIPB5sy.js';
3
+ export { A as AgentHeldResolver, p as AgentHeldSettlement, q as MCP_TARGET_PRESETS, r as McpEnvelope, s as McpEnvelopeEntry, t as McpServerOptions, u as McpTarget, v as McpTraceContext, w as McpTraceRuntime, x as PACKAGE_NAME, y as PreparedPayment, z as SpendAccountPrepareResult, B as SpendAccountPrepareSession, T as TOOLS, E as buildSpendAccountPayKind, F as canonicalMcpRequestId, H as createServer, I as handleSuipayMcpHttpRequest, J as inspectMcpEnvelope, K as loadMcpConfig, L as parseMcpTargetFlag, Q as prepareSpendAccountPayment, R as resetAgentHeldProcessLedger, U as resolveAgentHeldSettlement, V as resolveGrantTarget, W as resolveMcpTarget, Y as sameMcpGateway, Z as traceMcpHttpRequest, _ as verifySpendAccountPayReconstructs } from './http-UzIPB5sy.js';
4
4
  import { SuiGrpcClient } from '@mysten/sui/grpc';
5
5
  import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
6
6
  import '@modelcontextprotocol/sdk/server/index.js';
@@ -596,6 +596,7 @@ declare function pay(args: {
596
596
  fileField?: unknown;
597
597
  recipient?: unknown;
598
598
  maxAmount?: unknown;
599
+ dialect?: unknown;
599
600
  }, cfg: McpConfig, deps?: ToolDeps): Promise<ToolResult>;
600
601
  type LiveGrantCheck = {
601
602
  kind: 'live';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadBootProfile,
3
3
  main
4
- } from "./chunk-D6LFU4VE.js";
4
+ } from "./chunk-PQVBESG2.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-RD34GGSA.js";
29
+ } from "./chunk-VLN3ZX5D.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.13",
3
+ "version": "0.3.0-dev.14",
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": {