@zktx.io/sui-mcp 0.5.0

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.
Files changed (218) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/@mysten-bcs-2.0.5-Apache-2.0.txt +205 -0
  3. package/LICENSES/@mysten-sui-2.17.0-Apache-2.0.txt +201 -0
  4. package/LICENSES/@mysten-utils-0.3.3-Apache-2.0.txt +205 -0
  5. package/LICENSES/fancy-canvas-2.1.0-MIT.txt +7 -0
  6. package/LICENSES/lightweight-charts-5.2.0-NOTICE.txt +2 -0
  7. package/README.md +288 -0
  8. package/dist/adapters/adapterLifecycleValidators.js +5 -0
  9. package/dist/adapters/adapterPromptSurfaces.js +60 -0
  10. package/dist/adapters/deepbook/deepbookHumanReviewProducer.js +178 -0
  11. package/dist/adapters/deepbook/deepbookQuotePolicy.js +112 -0
  12. package/dist/adapters/deepbook/deepbookReviewEvidence.js +507 -0
  13. package/dist/adapters/deepbook/deepbookReviewLifecycle.js +85 -0
  14. package/dist/adapters/deepbook/deepbookSwapIntent.js +79 -0
  15. package/dist/adapters/deepbook/deepbookTransactionMaterialProducer.js +254 -0
  16. package/dist/adapters/intentPlanFactories.js +51 -0
  17. package/dist/adapters/reviewAdapters.js +47 -0
  18. package/dist/core/action/adapterLifecycleValidation.js +12 -0
  19. package/dist/core/action/contractNameRegistry.js +151 -0
  20. package/dist/core/action/forbiddenFields.js +43 -0
  21. package/dist/core/action/humanReadableReviewEvidence.js +193 -0
  22. package/dist/core/action/humanReadableReviewProjectionVerifier.js +29 -0
  23. package/dist/core/action/ptbVisualizationProducer.js +71 -0
  24. package/dist/core/action/receiptPtbGraph.js +29 -0
  25. package/dist/core/action/reviewCheckResults.js +6 -0
  26. package/dist/core/action/reviewStateValidation.js +11 -0
  27. package/dist/core/action/reviewTimeSimulationEvidence.js +470 -0
  28. package/dist/core/action/schemas.js +491 -0
  29. package/dist/core/action/signableAdapterContract.js +998 -0
  30. package/dist/core/action/suiChainReceiptEvidence.js +106 -0
  31. package/dist/core/action/suiChainReceiptMapping.js +107 -0
  32. package/dist/core/action/suiChainReceiptReader.js +211 -0
  33. package/dist/core/action/suiChainReceiptVerifier.js +178 -0
  34. package/dist/core/action/swapHumanReadableReviewProjection.js +130 -0
  35. package/dist/core/action/swapQuotePolicyEvidence.js +271 -0
  36. package/dist/core/action/transactionFunding.js +244 -0
  37. package/dist/core/action/transactionObjectOwnershipEvidence.js +256 -0
  38. package/dist/core/action/transactionObjectOwnershipProducer.js +323 -0
  39. package/dist/core/action/types.js +33 -0
  40. package/dist/core/action/walletReviewContractAssembler.js +286 -0
  41. package/dist/core/activity/accountAssetTimeline.js +157 -0
  42. package/dist/core/activity/accountAssetTimelineUsdcReferences.js +120 -0
  43. package/dist/core/activity/activityStore.js +16 -0
  44. package/dist/core/activity/externalActivityCoverage.js +76 -0
  45. package/dist/core/activity/externalActivityTransactionStream.js +82 -0
  46. package/dist/core/activity/localDataService.js +296 -0
  47. package/dist/core/activity/localDataTypes.js +11 -0
  48. package/dist/core/activity/localDataValidation.js +439 -0
  49. package/dist/core/activity/schemaVersion.js +2 -0
  50. package/dist/core/activity/sqliteActivityStore.js +1068 -0
  51. package/dist/core/activity/sqliteActivityStoreRows.js +389 -0
  52. package/dist/core/activity/sqliteActivityStoreSchema.js +367 -0
  53. package/dist/core/activity/sqliteActivityStoreTypes.js +5 -0
  54. package/dist/core/activity/suiFunctionTarget.js +43 -0
  55. package/dist/core/activity/transactionActivityAccountEffects.js +186 -0
  56. package/dist/core/activity/transactionActivityAnalysis.js +295 -0
  57. package/dist/core/activity/transactionActivityClassifier.js +306 -0
  58. package/dist/core/activity/transactionActivityDetails.js +229 -0
  59. package/dist/core/activity/transactionActivityProtocolRules.js +218 -0
  60. package/dist/core/activity/transactionActivityScanPolicy.js +170 -0
  61. package/dist/core/activity/transactionActivityService.js +379 -0
  62. package/dist/core/activity/transactionActivityTypes.js +18 -0
  63. package/dist/core/eventlog/sink.js +35 -0
  64. package/dist/core/evidence/settlementFamilies.js +85 -0
  65. package/dist/core/evidence/userAnswerUse.js +1 -0
  66. package/dist/core/numeric/rawU64.js +63 -0
  67. package/dist/core/preferences/preferencesStore.js +26 -0
  68. package/dist/core/preferences/sqlitePreferencesRepository.js +136 -0
  69. package/dist/core/proposal/externalProposalReview.js +347 -0
  70. package/dist/core/proposal/schemas.js +208 -0
  71. package/dist/core/proposal/types.js +35 -0
  72. package/dist/core/read/amounts.js +14 -0
  73. package/dist/core/read/coinMetadata.js +60 -0
  74. package/dist/core/read/deepbookOfficialIndexerSource.js +373 -0
  75. package/dist/core/read/deepbookRawQuoteClient.js +86 -0
  76. package/dist/core/read/deepbookReadHelpers.js +321 -0
  77. package/dist/core/read/deepbookRegistry.js +157 -0
  78. package/dist/core/read/deepbookSourceOwners.js +159 -0
  79. package/dist/core/read/deepbookUsdcChartService.js +342 -0
  80. package/dist/core/read/intentEvidenceResponseFormatting.js +228 -0
  81. package/dist/core/read/readCardInputs.js +19 -0
  82. package/dist/core/read/readCardResult.js +40 -0
  83. package/dist/core/read/readResponseGuidance.js +402 -0
  84. package/dist/core/read/readService.js +1639 -0
  85. package/dist/core/read/readServiceTypes.js +88 -0
  86. package/dist/core/read/settlementParityFormatting.js +82 -0
  87. package/dist/core/read/walletReadHelpers.js +99 -0
  88. package/dist/core/review/reviewChecks.js +45 -0
  89. package/dist/core/review/reviewComputation.js +38 -0
  90. package/dist/core/review/reviewComputationResult.js +87 -0
  91. package/dist/core/session/cardSession.js +31 -0
  92. package/dist/core/session/cardSessionStore.js +204 -0
  93. package/dist/core/session/keyedRecordStore.js +18 -0
  94. package/dist/core/session/liveReviewSessionContract.js +3 -0
  95. package/dist/core/session/localSession.js +31 -0
  96. package/dist/core/session/privateReviewArtifacts.js +75 -0
  97. package/dist/core/session/reviewValidity.js +49 -0
  98. package/dist/core/session/sessionErrors.js +9 -0
  99. package/dist/core/session/sessionRecordStore.js +40 -0
  100. package/dist/core/session/sessionStore.js +655 -0
  101. package/dist/core/session/settingsSession.js +1 -0
  102. package/dist/core/session/settingsSessions.js +45 -0
  103. package/dist/core/session/sqliteCardStore.js +88 -0
  104. package/dist/core/session/sqliteSessionStore.js +213 -0
  105. package/dist/core/session/sqliteTransactionMaterialStore.js +64 -0
  106. package/dist/core/session/sqliteWalletWorkflowStore.js +821 -0
  107. package/dist/core/session/status.js +60 -0
  108. package/dist/core/session/transactionMaterialStore.js +221 -0
  109. package/dist/core/session/transactionRequest.js +72 -0
  110. package/dist/core/session/wait.js +79 -0
  111. package/dist/core/session/walletConnection.js +92 -0
  112. package/dist/core/session/walletRuntime.js +38 -0
  113. package/dist/core/session/walletWorkflow.js +608 -0
  114. package/dist/core/session/workflowState.js +80 -0
  115. package/dist/core/session/workflowView.js +150 -0
  116. package/dist/core/suiAddress.js +18 -0
  117. package/dist/core/suiEndpoint.js +72 -0
  118. package/dist/mcp/activeAccountResponse.js +24 -0
  119. package/dist/mcp/prompts.js +146 -0
  120. package/dist/mcp/registerTool.js +19 -0
  121. package/dist/mcp/resources.js +72 -0
  122. package/dist/mcp/responseGuidance.js +326 -0
  123. package/dist/mcp/result.js +17 -0
  124. package/dist/mcp/schemas.js +11 -0
  125. package/dist/mcp/server.js +32 -0
  126. package/dist/mcp/serverInfo.js +131 -0
  127. package/dist/mcp/toolErrors.js +118 -0
  128. package/dist/mcp/toolNames.js +58 -0
  129. package/dist/mcp/tools/account/index.js +44 -0
  130. package/dist/mcp/tools/action/prepareSuiActionReview.js +126 -0
  131. package/dist/mcp/tools/read/commonSchemas.js +43 -0
  132. package/dist/mcp/tools/read/deepbookReadTools.js +686 -0
  133. package/dist/mcp/tools/read/index.js +14 -0
  134. package/dist/mcp/tools/read/readToolHelpers.js +97 -0
  135. package/dist/mcp/tools/read/reviewActivityTools.js +179 -0
  136. package/dist/mcp/tools/read/serverStatusTools.js +100 -0
  137. package/dist/mcp/tools/read/transactionActivityOutput.js +371 -0
  138. package/dist/mcp/tools/read/transactionActivityTools.js +858 -0
  139. package/dist/mcp/tools/read/walletReadTools.js +734 -0
  140. package/dist/mcp/tools/session/executionResultTools.js +44 -0
  141. package/dist/mcp/tools/session/index.js +8 -0
  142. package/dist/mcp/tools/session/shared.js +36 -0
  143. package/dist/mcp/tools/session/statusTools.js +69 -0
  144. package/dist/mcp/tools/session/walletConnectionTools.js +69 -0
  145. package/dist/mcp/tools/settings/index.js +66 -0
  146. package/dist/mcp-app/account.html +3133 -0
  147. package/dist/mcp-app/account.notices.txt +973 -0
  148. package/dist/mcp-app/chart.html +3354 -0
  149. package/dist/mcp-app/chart.notices.txt +1194 -0
  150. package/dist/mcp-app/connect.html +3179 -0
  151. package/dist/mcp-app/connect.notices.txt +1012 -0
  152. package/dist/mcp-app/receipt.html +8430 -0
  153. package/dist/mcp-app/receipt.notices.txt +3549 -0
  154. package/dist/mcp-app/review.html +8430 -0
  155. package/dist/mcp-app/review.notices.txt +3549 -0
  156. package/dist/mcp-ui/contracts.js +31 -0
  157. package/dist/mcp-ui/readCards.js +28 -0
  158. package/dist/mcp-ui/tools.js +134 -0
  159. package/dist/review-app/brand-dark.svg +1 -0
  160. package/dist/review-app/brand-light.svg +1 -0
  161. package/dist/review-app/favicon.svg +1 -0
  162. package/dist/review-app/settings.css +1 -0
  163. package/dist/review-app/settings.js +1 -0
  164. package/dist/review-app/ui.css +809 -0
  165. package/dist/review-server/assets.js +48 -0
  166. package/dist/review-server/html.js +45 -0
  167. package/dist/review-server/http.js +47 -0
  168. package/dist/review-server/middleware/hostOrigin.js +48 -0
  169. package/dist/review-server/middleware/reviewToken.js +7 -0
  170. package/dist/review-server/reviewServerPolicy.js +1 -0
  171. package/dist/review-server/server.js +72 -0
  172. package/dist/review-server/settingsApi.js +158 -0
  173. package/dist/runtime/application.js +203 -0
  174. package/dist/runtime/config.js +97 -0
  175. package/dist/runtime/localSettingsService.js +198 -0
  176. package/dist/runtime/logger.js +66 -0
  177. package/dist/runtime/reviewDependencies.js +58 -0
  178. package/dist/runtime/reviewServerAcquire.js +93 -0
  179. package/dist/runtime/runtimeTermination.js +60 -0
  180. package/dist/runtime/shared/authenticatedFetch.js +127 -0
  181. package/dist/runtime/shared/control.js +93 -0
  182. package/dist/runtime/shared/dataAccess.js +66 -0
  183. package/dist/runtime/shared/mcpHttp.js +84 -0
  184. package/dist/runtime/shared/ownerLease.js +50 -0
  185. package/dist/runtime/shared/server.js +98 -0
  186. package/dist/runtime/shared/stdio.js +113 -0
  187. package/dist/runtime/smokeMainnetRead.js +391 -0
  188. package/dist/runtime/smokeMainnetReadAssertions.js +306 -0
  189. package/dist/runtime/smokeReview.js +40 -0
  190. package/dist/runtime/start.js +90 -0
  191. package/dist/runtime/suiEndpoint.js +97 -0
  192. package/dist/runtime/suiTransactionGraphqlMapping.js +200 -0
  193. package/dist/runtime/suiTransactionGraphqlQueries.js +231 -0
  194. package/dist/runtime/suiTransactionGraphqlSource.js +148 -0
  195. package/dist/runtime/walletConnectConfig.js +3 -0
  196. package/dist/runtime/walletConnectStorage.js +99 -0
  197. package/dist/runtime/walletConnectTransport.js +128 -0
  198. package/dist/runtime/walletSdkChild.js +3 -0
  199. package/dist/runtime/walletSdkChildRuntime.js +160 -0
  200. package/dist/runtime/walletSdkIpc.js +26 -0
  201. package/dist/runtime/walletSdkProcess.js +358 -0
  202. package/docs/AGENT_BEHAVIOR.md +524 -0
  203. package/docs/AGENT_DEVELOPMENT_POLICY.md +815 -0
  204. package/docs/FRONTEND_POLICY.md +534 -0
  205. package/docs/LOCAL_DB_ARCHITECTURE.md +381 -0
  206. package/docs/MCP_SETUP.md +742 -0
  207. package/docs/MCP_TOOLS.md +1318 -0
  208. package/docs/SDK_API.md +206 -0
  209. package/docs/SIGNABLE_ADAPTER_CONTRACT.md +396 -0
  210. package/docs/TRANSACTION_ACTIVITY_LOG.md +194 -0
  211. package/docs/UTILITY_INDEX.md +275 -0
  212. package/docs/WALLET_CONNECTION.md +238 -0
  213. package/docs/golden-scenarios/BEHAVIOR_MATRIX.md +166 -0
  214. package/docs/golden-scenarios/INTENT_EVIDENCE_GOLDEN_ANSWERS.md +161 -0
  215. package/docs/golden-scenarios/INTENT_EVIDENCE_MATRIX.md +259 -0
  216. package/package.json +79 -0
  217. package/protocols/deepbook-margin.md +15 -0
  218. package/protocols/deepbook-v3.md +24 -0
@@ -0,0 +1,259 @@
1
+ # Intent Evidence Matrix
2
+
3
+ This matrix is a current-release release review checklist for AI clients. It tests whether the implemented read and review surfaces let a user get a concise, useful answer before any transaction-building or signing work.
4
+
5
+ The goal is not to push the user toward a review session. The goal is to verify that current intent evidence is easy for AI clients to consume, summarize, and explain without claiming that the product can do unsupported work such as autonomous execution, signing readiness, route recommendation, fiat cash-out, or P&L.
6
+
7
+ For deterministic natural-language USD-denominated replay scenarios, required MCP tool paths, expected answer shapes, and manual client observation fields, see `docs/golden-scenarios/INTENT_EVIDENCE_GOLDEN_ANSWERS.md`.
8
+
9
+ Before running the question corpus, call `read.get_server_status` and record:
10
+
11
+ - `packageName`;
12
+ - `version`;
13
+ - `evidencePolicy.version`;
14
+ - `network`;
15
+ - `implementedToolsCount`.
16
+
17
+ Use the returned numeric `implementedToolsCount` field instead of hand-counting the tool array.
18
+
19
+ If the status does not include the expected evidence policy, the client may be attached to the wrong MCP build and the observation is not a valid release gate result.
20
+
21
+ ## Standard Clauses
22
+
23
+ Use these clauses, or equivalent wording with the same meaning, when the answer needs the corresponding boundary.
24
+
25
+ Bounded activity page:
26
+ This is a bounded provider page, not complete wallet history.
27
+
28
+ Affected vs sent:
29
+ Affected activity means the account appeared in returned transaction effects; it does not mean the account sent the transaction.
30
+
31
+ Summary-first path:
32
+ Use summary output first; inspect full details only when the user asks for transaction-level facts.
33
+
34
+ Requested account facts:
35
+ For wallet/account-specific balance questions, use `requestedAccountTransactionFacts`, `requestedAccount.coinFlows`, and `transactions[].requestedAccountEffect` before transaction-wide aggregates. These fields are raw integer facts scoped to the requested account.
36
+
37
+ Incomplete balance evidence:
38
+ `accountBalanceChangeEvidence: "incomplete_account_balance_changes"` or `"account_balance_changes_unavailable"` is not zero-balance evidence.
39
+
40
+ `accountBalanceChangeInferencePolicy: "do_not_infer_from_transaction_context"` means the requested account amount must not be inferred from transaction-level context, visible recipient patterns, or current wallet balances. Do not describe it as likely or almost certain.
41
+
42
+ Only `no_account_balance_changes_returned` with complete details supports saying no requested-account balance change was returned.
43
+
44
+ Transaction context:
45
+ Live scan and live-summary rows use `transactionContext` for transaction-level calls, objects, events, gas, truncation, and protocol labels. It intentionally omits transaction-wide balance-change aggregates.
46
+
47
+ Compact facts:
48
+ Inspect and stored-summary rows can include `compact`.
49
+
50
+ `compact.factScope: "transaction"` and `compact.requestedAccountScoped: false` mean compact balance changes, object changes, events, and gas are transaction-level facts.
51
+
52
+ Compact balance changes can aggregate repeated ownerless raw changes with `count`; `analysis.coinFlows` is a transaction/page aggregate, not wallet-specific evidence.
53
+
54
+ Raw display boundary:
55
+ Do not convert raw token amounts into display units unless the response includes verified decimals for that asset.
56
+
57
+ Wallet snapshot boundary:
58
+ Wallet balance reads are current coin-balance snapshots, not transaction history, receipt proof for a specific digest, acquisition source, object provenance, P&L, or cost basis.
59
+
60
+ Intent evidence boundary:
61
+ Intent evidence is pre-transaction evidence summary. It is not payment execution, settlement-token selection, route recommendation, transaction building, signing readiness, fiat USD cash-out, P&L, or cost basis.
62
+
63
+ Settlement asset coverage:
64
+ `responseSummary` is the response field for current settlement-asset total, covered-by-settlement-asset-balance, and settlement-asset shortfall statements inside the supported settlement asset group.
65
+
66
+ When no target settlement asset is selected, `responseEvidence.primaryEvidenceFields` limits response evidence to `responseSummary`.
67
+
68
+ When `responseEvidence.mode` is `selected_target_context`, use the response fields listed in `userAnswerUse.answerFields`, including `responseSummary`, `selectedTarget`, `candidateConversions`, and `requiredUserChoices`.
69
+
70
+ Direct pool quote evidence is present only when the same response lists `direct_pool_quote_evidence` in `responseEvidence.supportedResponseClaims` and `direct_pool_quote_evidence_for_user_selected_target` in `userAnswerUse.canAnswer`.
71
+
72
+ Settlement asset coverage is not settlement-token selection, payment execution readiness, gas readiness, route-dependent payment support, or signing readiness.
73
+
74
+ Settlement asset group boundary:
75
+ USD-denominated settlement asset groups are pinned SDK registry evidence, not fiat USD support, live liquidity, or a complete stablecoin universe.
76
+
77
+ Stored facts:
78
+ Stored summaries are local normalized facts, not a background index or complete history.
79
+
80
+ Quote evidence:
81
+ Quote evidence is not payment coverage, shortfall contribution, final min-out, or signing input.
82
+
83
+ Quote impact boundary:
84
+ DeepBook quote output is not effective price, price impact, mid-price slippage, venue comparison, best route, or route recommendation evidence.
85
+
86
+ Fiat cash-out boundary:
87
+ A USDC quote is not a fiat USD cash-out estimate, external USDC/USD market lookup, or peg assumption.
88
+
89
+ P&L unsupported:
90
+ Profit, tax, performance, and cost-basis calculations are not Sui MCP surfaces. Do not provide a profit formula or hypothetical profit example, even when the user supplies an assumed acquisition price.
91
+
92
+ Display intent:
93
+ Display intent is proposal context, not a raw signing amount.
94
+
95
+ Review evidence:
96
+ Review evidence explains what was checked; it is not signing readiness or a safety guarantee.
97
+
98
+ Wallet identity:
99
+ Wallet identity is active account read context, not login, custody, or transaction authorization.
100
+
101
+ Protocol labels:
102
+ Protocol labels are conservative activity labels, not protocol support, position inventory, P&L, route quality, signing data, or signing readiness.
103
+
104
+ ## Current Release Questions
105
+
106
+ `What is 1 SUI worth?`
107
+ Use `read.get_deepbook_mid_price` with `poolKey: "SUI_USDC"`.
108
+ Answer with DeepBook SUI/USDC, `fetchedAt`, and not-global-market-price boundary.
109
+ Do not ask for a wallet, start a review session, recommend a route, or imply signing readiness.
110
+
111
+ `If I sell 10 SUI, how many USDC do I get?`
112
+ Use `read.quote_deepbook_display_amount` after pool and direction are clear.
113
+ Include source input, pool, direction, quote asset, and `fetchedAt`.
114
+ Do not provide final min-out, transaction-building input, route quality, or signing readiness.
115
+
116
+ `If I sell 10 SUI, how many dollars do I get?`
117
+ Do not quote until the user selects a registered DeepBook quote asset or pool, or asks for wallet-scoped USD-denominated intent evidence.
118
+ If the user chooses a pool such as SUI/USDC, call `read.quote_deepbook_display_amount`.
119
+ Say Sui MCP cannot turn "dollars" into fiat USD or silently choose USDC/USDT.
120
+ Ask whether the user wants a specific DeepBook USD-denominated quote token/pool or wallet-scoped settlement-asset-group evidence.
121
+ Do not provide a silent USDC/USDT default, USDC/USD peg conversion, web or finance lookup, bank cash-out estimate, final min-out, route quality, or signing readiness.
122
+
123
+ `If I sell some SUI, how much do I get?`
124
+ Clarify the source amount. Give examples such as `1 SUI` or `10 SUI`.
125
+ Do not map vague words to a fixed amount or percent.
126
+
127
+ `What is in my wallet?`
128
+ Use `session.get_interaction_status.assetReadAccount` if available; otherwise ask for a Sui address for an address-capable read. Open Connect only when the user requests connection. A stored selection does not prove a usable connection or signing authority.
129
+
130
+ `Show balances for this address: 0x...`
131
+ Use `read.summarize_wallet_assets` or `read.classify_wallet_assets` with `account`.
132
+ Include snapshot time and explicit address scope.
133
+ Do not imply ownership proof, active account context, or wallet authorization.
134
+
135
+ `Summarize the latest 5 transactions for this wallet.`
136
+ Use `read.summarize_sui_activity_scan` first.
137
+ Answer with a short table or bullets.
138
+ Include relationship, requested-account raw flows when discussing the wallet's own changes, bounded page status, and continuation/coverage if returned.
139
+ Do not return full raw JSON, claim complete history, inspect unnecessary details, or treat `analysis.coinFlows` as wallet-specific.
140
+
141
+ `Show details for the first transaction.`
142
+ Use `read.inspect_sui_transaction` for the digest, or scan details when already present.
143
+ Include digest, status, sender, key Move calls, and available raw balance/gas facts.
144
+ Do not infer missing fields when details are absent or truncated.
145
+
146
+ `Did this wallet send it, or was it only affected?`
147
+ Use returned `relationship` and transaction sender facts.
148
+ Distinguish sent from affected.
149
+ Use the affected-vs-sent clause when relationship is affected.
150
+
151
+ `Show all older transactions too.`
152
+ Continue with cursor only if available.
153
+ Explain continuation and coverage.
154
+ Do not claim pagination proves complete history.
155
+
156
+ `Which DeFi protocols did I use recently?`
157
+ Use `read.summarize_sui_activity_scan`, or stored summary if the user asks for stored facts.
158
+ Use conservative protocol labels and limitations.
159
+ Do not infer position inventory, P&L, supported-protocol list, or signing readiness.
160
+
161
+ `How much profit did I make?`
162
+ Unsupported.
163
+ Explain P&L is not a Sui MCP surface.
164
+ Offer available raw activity, balance snapshots, or quote evidence if useful.
165
+ Do not provide P&L, tax, performance, profit calculation, cost-basis formula, or hypothetical profit example.
166
+
167
+ `Can you calculate my profit if I bought 10 SUI for 10 USDC?`
168
+ Unsupported.
169
+ Explain that an assumed acquisition price still does not turn Sui MCP into a P&L or accounting surface.
170
+ State available quote proceeds or raw activity evidence only if already fetched.
171
+ Do not provide a profit calculation, cost-basis formula, hypothetical example, or tax/accounting interpretation.
172
+
173
+ `Recommend the best route.`
174
+ Unsupported.
175
+ Offer scoped quote facts when source amount and pool can be specified.
176
+ Do not provide best route, ranking, route quality, or settlement choice.
177
+
178
+ `Can I cover a 1000 dollar payment?`
179
+ Call `read.list_settlement_asset_groups`, then `read.preview_intent_evidence` with `intentKind: "cover_payment_like_amount"`, `denomination: "dollar"`, and `requiredDisplayAmount: "1000"`.
180
+ Answer from `responseSummary`: covered, shortfall, or unavailable.
181
+ Ask only for returned `responseSummary.requiredUserChoices`.
182
+ Do not silently select USDC/USDT, claim fiat USD cash-out, route-dependent payment support, gas readiness, transaction building, or signing readiness.
183
+
184
+ `Can I pay for this 1000-dollar item?`
185
+ Use the same intent-evidence path as `Can I cover a 1000 dollar payment?`.
186
+ Answer intent evidence first, then ask only for required user choices returned by `responseSummary`.
187
+ Do not silently select USDC/USDT, claim fiat USD cash-out, route-dependent payment support, transaction building, or signing readiness.
188
+
189
+ `How much are my USD-denominated assets together?`
190
+ Call `read.list_settlement_asset_groups`, then `read.preview_intent_evidence` with `intentKind: "summarize_settlement_asset_group_balance"` and `denomination: "dollar"`.
191
+ Report current settlement-asset total only from `responseSummary.conclusionKind: "current_settlement_asset_total"`.
192
+ Do not invent a payment target, silently select USDC/USDT, claim fiat USD cash-out, recommend a route, build a transaction, or imply signing readiness.
193
+
194
+ `Which USD-denominated asset is highest or lowest right now?`
195
+ Call `read.list_settlement_asset_groups`, then `read.summarize_settlement_asset_group_parity` with `denomination: "dollar"`.
196
+ Report available asset group parity max/min and, if useful, mean/median.
197
+ State that the reference asset is only a measurement reference.
198
+ Do not turn parity into settlement-token selection, fiat USD cash-out, USDC/USD peg assumption, payment readiness, best route, transaction building, or signing readiness.
199
+
200
+ `What is the shortfall?`
201
+ If a target amount is already established, call `read.preview_intent_evidence` with that amount.
202
+ Otherwise clarify the missing target amount.
203
+ Report `responseSummary.shortfallDisplayAmount` only when `conclusionKind` is `shortfall_in_settlement_asset_balance`.
204
+ Report zero shortfall only when `conclusionKind` is `covered_by_settlement_asset_balance`.
205
+ Do not guess the amount, silently choose a settlement token, choose source assets, rank routes, claim gas readiness, claim payment execution readiness, or imply signing readiness.
206
+
207
+ `If USDC is short, can I fill it?`
208
+ Use `read.preview_intent_evidence` with the established `requiredDisplayAmount`, `targetAssetSymbol: "USDC"`, and `targetAssetSelectionSource: "user_explicit"` or `"prior_user_explicit_context"` according to the user's wording.
209
+ Distinguish settlement-asset aggregate shortfall from `selectedTarget.shortfallDisplayAmount`.
210
+ Ask only for returned choices.
211
+ Do not set a target source for an agent-inferred target. Do not count non-group quote proceeds as payment coverage, auto-select source assets, rank routes, claim route-dependent payment support, or imply signing readiness.
212
+
213
+ `Prepare selling 10 SUI.`
214
+ Use `action.prepare_sui_action_review` and present the internal Review card.
215
+ Explain returned checks; only an explicit card selection and wallet approval
216
+ can authorize the backend request. Do not return bytes, signing readiness or
217
+ an execution claim from preparation alone.
218
+
219
+ `Tell me this review session status.`
220
+ Use `session.get_review_status` or `read.get_review_session_detail`.
221
+ Report current status and checks returned by the review layer.
222
+ Do not give a safety guarantee or signing-readiness claim when status is blocked.
223
+
224
+ `Connect my wallet.`
225
+ Use `session.create_wallet_connection` with `intent: connect`, then read or wait on its cardId.
226
+ Its authenticated View starts pairing only after confirming permission and current eligibility. A manage card instead waits for the user to choose Connect wallet. Confirm the usable default through `assetReadAccount`; an ordinary tool call or wait does not pair.
227
+ Do not call it login, permanent authorization, or transaction permission.
228
+
229
+ `Can I sign now?`
230
+ Use review status only.
231
+ A `ready_for_wallet_review` status with emitted transaction review data means
232
+ the evidence is available to inspect, not that input permission or wallet
233
+ eligibility is current. Request wallet approval must be offered by the current
234
+ authenticated Review card, and the user must approve that exact transaction
235
+ in their own wallet. If the
236
+ review is blocked, explain the returned missing or failed review evidence.
237
+ Do not use safe-to-sign language, do not return transaction material, and do
238
+ not describe MCP output as signing data.
239
+
240
+ `Cancel the transaction I just sent.`
241
+ Unsupported.
242
+ Explain submitted onchain transactions cannot be canceled by this toolkit.
243
+ Offer digest inspection when a digest is available.
244
+
245
+ ## Manual Client Observation Requirement
246
+
247
+ Release review should record at least one client observation file before claiming that a specific external AI client build followed this matrix unaided. The deterministic MCP replay tests are the product evidence-policy gate; manual observation files are client-behavior evidence. Each observation row should capture:
248
+
249
+ - client name and date,
250
+ - `read.get_server_status` package version, evidence policy version, and `implementedToolsCount`,
251
+ - prompt,
252
+ - tool path used,
253
+ - whether the client used the summary-first path,
254
+ - whether the client had to inspect raw tool-result files or run shell/JQ processing,
255
+ - answer length class,
256
+ - missing or incorrect standard clauses,
257
+ - follow-up fix needed.
258
+
259
+ Observation files belong in ignored local planning notes because they are local client evidence. Durable failures found from those observations must be promoted to code, docs, tests, or this matrix.
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@zktx.io/sui-mcp",
3
+ "version": "0.5.0",
4
+ "mcpName": "io.github.zktx-mcp/sui-mcp",
5
+ "description": "Sui MCP is a local-first toolkit for helping AI applications and users inspect Sui DeFi actions before execution.",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "bin": {
9
+ "sui-mcp": "./dist/runtime/start.js"
10
+ },
11
+ "files": [
12
+ "dist/",
13
+ "README.md",
14
+ "docs/",
15
+ "protocols/deepbook-v3.md",
16
+ "protocols/deepbook-margin.md",
17
+ "LICENSE",
18
+ "LICENSES/"
19
+ ],
20
+ "keywords": [
21
+ "mcp",
22
+ "model-context-protocol",
23
+ "sui",
24
+ "deepbook",
25
+ "transaction-review",
26
+ "wallet-review"
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/zktx-mcp/sui-mcp.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/zktx-mcp/sui-mcp/issues"
34
+ },
35
+ "homepage": "https://github.com/zktx-mcp/sui-mcp#readme",
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "tag": "latest"
39
+ },
40
+ "scripts": {
41
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
42
+ "build": "npm run clean && tsc -p tsconfig.build.json && vite build && tsx scripts/build-mcp-ui.ts",
43
+ "prepublishOnly": "npm run release:check",
44
+ "release:check": "tsx scripts/release-check.ts",
45
+ "smoke:mainnet": "node dist/runtime/smokeMainnetRead.js",
46
+ "test": "vitest run",
47
+ "typecheck": "tsc -p tsconfig.json --noEmit",
48
+ "generate:deepbook-registry": "tsx scripts/generate-deepbook-registry.ts"
49
+ },
50
+ "dependencies": {
51
+ "@modelcontextprotocol/ext-apps": "1.7.5",
52
+ "@modelcontextprotocol/sdk": "1.29.0",
53
+ "@mysten/deepbook-v3": "1.3.6",
54
+ "@mysten/sui": "2.17.0",
55
+ "@scure/bip39": "2.2.0",
56
+ "@walletconnect/sign-client": "2.23.10",
57
+ "@walletconnect/types": "2.23.10",
58
+ "@walletconnect/utils": "2.23.10",
59
+ "@zktx.io/ptb-model": "0.5.0",
60
+ "better-sqlite3": "12.9.0",
61
+ "lightweight-charts": "5.2.0",
62
+ "mermaid": "11.12.0",
63
+ "qrcode": "1.5.4",
64
+ "zod": "4.4.3"
65
+ },
66
+ "devDependencies": {
67
+ "@types/better-sqlite3": "7.6.13",
68
+ "@types/node": "25.6.2",
69
+ "@types/qrcode": "1.5.6",
70
+ "marked": "16.4.2",
71
+ "tsx": "4.21.0",
72
+ "typescript": "6.0.3",
73
+ "vite": "8.0.11",
74
+ "vitest": "4.1.5"
75
+ },
76
+ "engines": {
77
+ "node": ">=22"
78
+ }
79
+ }
@@ -0,0 +1,15 @@
1
+ # DeepBook Margin
2
+
3
+ This file is a protocol reference for AI and human readers. It is not a runtime registry, not a supported-protocol list, not a live liquidity source, not a route recommendation source, and not a signing-readiness signal.
4
+
5
+ Current product support is declared by `read.get_server_status`, `read.list_supported_protocols`, concrete MCP tool schemas, and concrete MCP tool responses. This note does not expose margin support by itself.
6
+
7
+ DeepBook Margin is treated as mainnet protocol notes for Sui MCP.
8
+
9
+ This note covers these protocol topics only:
10
+
11
+ - Protocol notes only.
12
+ - No MCP read tools expose margin pool, collateral, borrow, liquidation, or interest data in this release.
13
+ - No signable margin action.
14
+
15
+ Signable margin review requires a separate adapter and explicit deterministic checks for liquidation and borrow risk.
@@ -0,0 +1,24 @@
1
+ # DeepBookV3
2
+
3
+ This file is a protocol reference for AI and human readers. It is not a runtime registry, not a supported-protocol list, not a live liquidity source, not a route recommendation source, and not a signing-readiness signal.
4
+
5
+ Current product support is declared by `read.get_server_status`, `read.list_supported_protocols`, concrete MCP tool schemas, and concrete MCP tool responses. This note only explains DeepBookV3 protocol concepts that those runtime surfaces may reference.
6
+
7
+ DeepBookV3 is the first protocol domain for Sui MCP.
8
+
9
+ Protocol concepts referenced by current runtime evidence include:
10
+
11
+ - Mainnet package and pool metadata through the pinned `@mysten/deepbook-v3` SDK constants.
12
+ - Read-only protocol and pool listing.
13
+ - Read-only orderbook context through pinned DeepBook SDK simulation reads.
14
+ - Read-only raw-quantity and display-amount quotes through pinned DeepBook SDK simulation reads.
15
+
16
+ DeepBook orderbook, raw-quantity quote, and display-amount quote reads use an internal SDK simulation sender placeholder. They use `client.core.simulateTransaction` and do not require wallet connection because these market reads are not wallet-account reads. These read queries are separate from review-time simulation of the exact transaction material.
17
+
18
+ Signable swap review for the account-bound DeepBook swap route is part of current runtime support; `read.list_supported_protocols` and the concrete MCP tool responses are the authoritative status. The internal Review card displays account-bound evidence after the backend validates the pinned registry, refreshes the live quote, resolves objects, and simulates the exact stored material with validation checks enabled. `ready_for_wallet_review` describes that evidence, not signing authority.
19
+
20
+ Out of scope:
21
+
22
+ - Limit or market order review.
23
+
24
+ Ordinary MCP tools and review-status reads do not authorize a transaction or return transaction bytes. An explicit Review-card action admits the exact request, the user's wallet signs it through WalletConnect, and the backend verifies the returned bytes and signer before submitting once. Chain outcome comes from independent receipt reads.