@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,742 @@
1
+ # MCP Setup
2
+
3
+ This is the setup guide for Sui MCP clients. It owns installation, MCP client connection, first-use flow, local settings, and troubleshooting.
4
+
5
+ It does not define tool field contracts or response wording. Use `docs/MCP_TOOLS.md` for the MCP API reference and `docs/AGENT_BEHAVIOR.md` for the answer playbook.
6
+
7
+ The README keeps only the short entry path; client-specific setup, restart behavior, and troubleshooting live here.
8
+
9
+ These instructions target `@zktx.io/sui-mcp@0.5.0`. Package installation requires
10
+ that exact version to be published; use the developer checkout instructions when
11
+ it is not available. A repository rename or local build does not publish the
12
+ package. Changing client settings or rebuilding files does not replace an
13
+ already running shared server. Restart all clients using the service and verify
14
+ the package identity when switching installations.
15
+
16
+ ## Key terms
17
+
18
+ - Sui: the mainnet blockchain whose DeFi state this project reads.
19
+ - MCP: Model Context Protocol, the tool-calling interface used by AI clients.
20
+ - DeepBook: Sui's onchain order book protocol.
21
+ - SDK: Software Development Kit, a version-pinned library dependency used by this repository.
22
+ - gRPC and GraphQL: Sui SDK transports used by this runtime for mainnet reads.
23
+ - WalletConnect: the backend's transport for wallet-approved connections and individual transaction requests.
24
+ - stdio: standard input/output, the local transport used by MCP clients to talk to this server.
25
+ - `@zktx.io`: the npm package scope. `zktx-mcp` is the GitHub organization. Sui MCP is the product; `sui-mcp` is the MCP server name and executable command.
26
+
27
+ ## Requirements
28
+
29
+ - Node.js 22+. Node 22 or 24 LTS is recommended.
30
+ - An MCP client that can run a local stdio server.
31
+ - Network access to Sui mainnet gRPC for runtime startup validation and to Sui mainnet GraphQL for user-requested activity reads.
32
+
33
+ ## Default Setup
34
+
35
+ No Sui endpoint setup is required for the default path. The runtime creates a local SQLite database automatically, stores default Sui mainnet gRPC and GraphQL endpoints there on first start, and uses those endpoints for read-only mainnet tools.
36
+
37
+ If you want a custom Sui gRPC or GraphQL provider, or local data controls, configure them after the MCP server is connected by asking your AI client to create a local settings session:
38
+
39
+ - "Show my Sui MCP local settings."
40
+ - "Open my Sui MCP local settings page."
41
+
42
+ Open the returned settings URL in the same machine's system browser. Custom endpoint changes apply after the MCP server restarts. Advanced temporary environment overrides are documented in [Advanced Runtime Settings](#advanced-runtime-settings).
43
+
44
+ DeepBook orderbook, raw-quantity quote, and display-amount quote reads use an internal mainnet SDK simulation sender placeholder.
45
+
46
+ They do not require wallet connection.
47
+
48
+ This placeholder is only the sender value required by DeepBook SDK simulation reads. It is not a user's wallet, signing authorization, or fake user liquidity.
49
+
50
+ Reads that require a connected default account use `session.create_wallet_connection`. Tools with an `account` input also accept an explicit Sui address without a wallet connection.
51
+
52
+ ## Developer Checkout Setup
53
+
54
+ Use this path when you download the repository from GitHub and want to test the local build:
55
+
56
+ ```bash
57
+ git clone https://github.com/zktx-mcp/sui-mcp.git
58
+ cd sui-mcp
59
+ npm install
60
+ npm run build
61
+ ```
62
+
63
+ Generic stdio MCP configuration:
64
+
65
+ ```json
66
+ {
67
+ "command": "node",
68
+ "args": ["/absolute/path/to/sui-mcp/dist/runtime/start.js"]
69
+ }
70
+ ```
71
+
72
+ Do not wrap the MCP stdio command in a shell script that writes ordinary text to stdout.
73
+
74
+ On native Windows clients that need `cmd`, use the same command through `cmd /c`:
75
+
76
+ ```json
77
+ {
78
+ "command": "cmd",
79
+ "args": ["/c", "node", "C:\\absolute\\path\\to\\sui-mcp\\dist\\runtime\\start.js"]
80
+ }
81
+ ```
82
+
83
+ To delegate local setup to an AI coding agent, tell it:
84
+
85
+ ```text
86
+ Register this repository as a local stdio MCP server using the built /absolute/path/to/sui-mcp/dist/runtime/start.js file.
87
+ Use the default Sui mainnet endpoint unless I explicitly ask for a custom provider.
88
+ ```
89
+
90
+ ## Commands
91
+
92
+ These `npm run` scripts run from a local checkout. They are developer and maintainer scripts, not MCP tools or packaged product commands:
93
+
94
+ ```bash
95
+ npm install
96
+ npm run typecheck
97
+ npm run build
98
+ npm test
99
+ npm run release:check
100
+ npm run generate:deepbook-registry
101
+ npm run smoke:mainnet
102
+ ```
103
+
104
+ `npm run generate:deepbook-registry` writes `registry/generated/deepbook-mainnet.json`, which is ignored by Git because generated registry data must include provenance and should be regenerated from the pinned SDK.
105
+
106
+ ## Install from the MCP Registry
107
+
108
+ If your MCP client can install servers from the
109
+ [MCP Registry](https://registry.modelcontextprotocol.io/v0.1/servers?search=sui-mcp),
110
+ find the `io.github.zktx-mcp/sui-mcp` entry and install it through your
111
+ client. The resulting stdio server command is equivalent to:
112
+
113
+ ```sh
114
+ npx -y @zktx.io/sui-mcp
115
+ ```
116
+
117
+ Clients that do not install from the registry use the published-package and
118
+ per-client configuration below, which give the exact `command` and `args`.
119
+
120
+ ## Published Package Setup
121
+
122
+ The npm package for this release is `@zktx.io/sui-mcp`. The commands below
123
+ require the requested version to be published; confirm it with
124
+ `npm view @zktx.io/sui-mcp@0.5.0 version` before switching. Both installation
125
+ methods start the same `sui-mcp` stdio MCP server. Use a local checkout when
126
+ working on a version that has not been published.
127
+
128
+ ### Download on demand (npx, tracks the latest release)
129
+
130
+ ```json
131
+ {
132
+ "command": "npx",
133
+ "args": ["-y", "@zktx.io/sui-mcp"]
134
+ }
135
+ ```
136
+
137
+ No install step, and each launch resolves the latest published version. The
138
+ trade-off: the first launch (or the first after the npx cache is cleared)
139
+ downloads the package and its native dependencies. On a cold cache this can take
140
+ long enough to exceed a client's MCP startup timeout, so the client may stop the
141
+ server before it connects. If that happens, warm the cache once in a terminal and
142
+ then restart the client:
143
+
144
+ ```bash
145
+ npx -y @zktx.io/sui-mcp
146
+ # wait until it logs "review server started", then stop it with Ctrl-C
147
+ ```
148
+
149
+ ### Install once (global, fastest startup, pinned version)
150
+
151
+ ```bash
152
+ npm install -g @zktx.io/sui-mcp
153
+ ```
154
+
155
+ ```json
156
+ {
157
+ "command": "sui-mcp"
158
+ }
159
+ ```
160
+
161
+ The global `sui-mcp` command starts with no per-launch download, so it
162
+ avoids the cold-start timeout, and it stays on the installed version until you
163
+ update it explicitly:
164
+
165
+ ```bash
166
+ npm install -g @zktx.io/sui-mcp@latest
167
+ ```
168
+
169
+ The unscoped npm package `sui-mcp` is unrelated and can provide the same global
170
+ command name. Always install the full `@zktx.io/sui-mcp` package and verify
171
+ `read.get_server_status.packageName` after starting it. If another installation
172
+ owns the global command, use the scoped `npx` configuration instead.
173
+
174
+ The per-client sections below use the `npx` form. To use a global install
175
+ instead, replace the published-package command with `"command": "sui-mcp"`
176
+ and drop the `args`. On native Windows clients that need `cmd`, wrap either
177
+ command, for example `"command": "cmd", "args": ["/c", "npx", "-y", "@zktx.io/sui-mcp"]`.
178
+
179
+ ## Switching the Installed Package
180
+
181
+ Use these steps when selecting a different package installation. Confirm the
182
+ requested version is available before changing your client configuration.
183
+ Sui MCP starts with a new database and private WalletConnect store in its own
184
+ data directory. It does not discover, read, import or convert a previous
185
+ package's database or backup. Existing connections, saved cards, transaction
186
+ history and endpoint settings are not transferred. Configure endpoints if needed
187
+ and connect your wallet through a new card. Existing blockchain transactions
188
+ are unaffected and must never be resubmitted as an installation step.
189
+
190
+ Fully quit every app using the service and wait for its shared backend to exit
191
+ before starting the new package. A client using a different service identity,
192
+ API version or data directory is refused while that backend owns the port.
193
+ If a transaction request is in progress, inspect its state and coordinate a safe
194
+ restart first. A previous wallet pairing can remain in the wallet app; remove
195
+ an unwanted pairing there rather than assuming new local storage disconnected it.
196
+
197
+ Replace the old registration instead of adding a second one. Use exactly
198
+ `sui-mcp` for the registration name and select `@zktx.io/sui-mcp@0.5.0` in its
199
+ command arguments. Do not append an environment label, version or numeric
200
+ suffix. Remove obsolete runtime environment overrides. If you set
201
+ `SUI_MCP_DATA_DIR`, choose a new empty directory; never point it at another
202
+ package's database or private WalletConnect store. Keep the same new directory
203
+ and `SUI_MCP_REVIEW_PORT` in every participating client.
204
+
205
+ After restarting the clients, call `read.get_server_status` in each. Check
206
+ `packageName`, `version` and `serverName`: they must identify the intended npm
207
+ package and version, with `serverName` equal to `sui-mcp`. Open a new management
208
+ card and confirm the new empty wallet state. This check does not require signing
209
+ or submitting a transaction. Prior conversation cards are not current controls;
210
+ open cards through the new registration.
211
+
212
+ ### Data and resource identifiers
213
+
214
+ Sui MCP uses `SUI_MCP_DATA_DIR` and `SUI_MCP_REVIEW_PORT` for local configuration.
215
+ The default application directory is `sui-mcp`, the database is `sui-mcp.sqlite`,
216
+ and the private WalletConnect store is in that same data directory. These values
217
+ select the current installation; no previous-package aliases are supported.
218
+ Card addresses use `suimcp://` and `ui://sui-mcp/`; see
219
+ [MCP Tools](MCP_TOOLS.md#resources).
220
+
221
+ ## Claude Code
222
+
223
+ Claude Code supports local stdio MCP servers through `claude mcp add`. Put Claude CLI options such as `--transport` and `--scope` before the server name; the `--` separator starts the command that runs Sui MCP.
224
+
225
+ Developer checkout:
226
+
227
+ ```bash
228
+ claude mcp add --transport stdio \
229
+ sui-mcp \
230
+ -- node /absolute/path/to/sui-mcp/dist/runtime/start.js
231
+ ```
232
+
233
+ Published npm package:
234
+
235
+ ```bash
236
+ claude mcp add --transport stdio \
237
+ sui-mcp \
238
+ -- npx -y @zktx.io/sui-mcp
239
+ ```
240
+
241
+ Claude Code scopes:
242
+
243
+ - `local`: default; private to the current project.
244
+ - `project`: shared through a checked-in `.mcp.json`.
245
+ - `user`: private to your user account and available across projects.
246
+
247
+ Project-scope `.mcp.json` example:
248
+
249
+ ```json
250
+ {
251
+ "mcpServers": {
252
+ "sui-mcp": {
253
+ "type": "stdio",
254
+ "command": "node",
255
+ "args": ["/absolute/path/to/sui-mcp/dist/runtime/start.js"]
256
+ }
257
+ }
258
+ }
259
+ ```
260
+
261
+ Verify the server and tool list:
262
+
263
+ ```bash
264
+ claude mcp list
265
+ claude mcp get sui-mcp
266
+ ```
267
+
268
+ Inside Claude Code, use `/mcp` to inspect connected servers. After changing MCP configuration or rebuilding the local runtime, restart the Claude Code session so the stdio process is started from the new command. If startup is slow, launch Claude Code with a larger startup timeout such as `MCP_TIMEOUT=10000 claude`.
269
+
270
+ ## Claude Desktop
271
+
272
+ Claude Desktop can run local stdio MCP servers through its Developer settings. It does not require a `.dxt` extension for this package.
273
+
274
+ Open Claude Desktop settings, go to Developer, choose Edit Config, and add a server to `claude_desktop_config.json`.
275
+
276
+ Common config paths:
277
+
278
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
279
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
280
+
281
+ Developer checkout:
282
+
283
+ ```json
284
+ {
285
+ "mcpServers": {
286
+ "sui-mcp": {
287
+ "command": "node",
288
+ "args": ["/absolute/path/to/sui-mcp/dist/runtime/start.js"]
289
+ }
290
+ }
291
+ }
292
+ ```
293
+
294
+ Published npm package:
295
+
296
+ ```json
297
+ {
298
+ "mcpServers": {
299
+ "sui-mcp": {
300
+ "command": "npx",
301
+ "args": ["-y", "@zktx.io/sui-mcp"]
302
+ }
303
+ }
304
+ }
305
+ ```
306
+
307
+ On native Windows, use `cmd /c` if direct `npx` or `node` resolution fails:
308
+
309
+ ```json
310
+ {
311
+ "mcpServers": {
312
+ "sui-mcp": {
313
+ "command": "cmd",
314
+ "args": ["/c", "npx", "-y", "@zktx.io/sui-mcp"]
315
+ }
316
+ }
317
+ }
318
+ ```
319
+
320
+ Save the file and fully restart Claude Desktop. If the server does not appear, check MCP logs:
321
+
322
+ - macOS: `~/Library/Logs/Claude`
323
+ - Windows: `%APPDATA%\Claude\logs`
324
+
325
+ Claude Desktop writes general MCP connection logs to `mcp.log` and named server stderr logs to files such as `mcp-server-sui-mcp.log`.
326
+
327
+ ## Codex
328
+
329
+ Codex CLI supports stdio MCP servers and stores MCP settings in `config.toml`; by default this is `~/.codex/config.toml`, and trusted projects can use `.codex/config.toml`.
330
+
331
+ Developer checkout:
332
+
333
+ ```bash
334
+ codex mcp add sui-mcp \
335
+ -- node /absolute/path/to/sui-mcp/dist/runtime/start.js
336
+ ```
337
+
338
+ Published npm package:
339
+
340
+ ```bash
341
+ codex mcp add sui-mcp \
342
+ -- npx -y @zktx.io/sui-mcp
343
+ ```
344
+
345
+ Verify with:
346
+
347
+ ```bash
348
+ codex mcp list
349
+ ```
350
+
351
+ Inside the Codex TUI, use `/mcp` to see active MCP servers.
352
+
353
+ Equivalent `~/.codex/config.toml` entry for a developer checkout:
354
+
355
+ ```toml
356
+ [mcp_servers.sui-mcp]
357
+ command = "node"
358
+ args = ["/absolute/path/to/sui-mcp/dist/runtime/start.js"]
359
+ startup_timeout_sec = 10
360
+ tool_timeout_sec = 60
361
+ ```
362
+
363
+ Equivalent `~/.codex/config.toml` entry after npm publication:
364
+
365
+ ```toml
366
+ [mcp_servers.sui-mcp]
367
+ command = "npx"
368
+ args = ["-y", "@zktx.io/sui-mcp"]
369
+ startup_timeout_sec = 10
370
+ tool_timeout_sec = 60
371
+ ```
372
+
373
+ After changing `config.toml`, restart the Codex session so the stdio process is relaunched from the new config.
374
+
375
+ ## Cursor
376
+
377
+ Cursor supports MCP servers through `mcp.json`.
378
+
379
+ Configuration locations:
380
+
381
+ - Project-specific: `.cursor/mcp.json`
382
+ - Global: `~/.cursor/mcp.json`
383
+
384
+ Developer checkout:
385
+
386
+ ```json
387
+ {
388
+ "mcpServers": {
389
+ "sui-mcp": {
390
+ "command": "node",
391
+ "args": ["/absolute/path/to/sui-mcp/dist/runtime/start.js"]
392
+ }
393
+ }
394
+ }
395
+ ```
396
+
397
+ Published npm package:
398
+
399
+ ```json
400
+ {
401
+ "mcpServers": {
402
+ "sui-mcp": {
403
+ "command": "npx",
404
+ "args": ["-y", "@zktx.io/sui-mcp"]
405
+ }
406
+ }
407
+ }
408
+ ```
409
+
410
+ Restart Cursor after changing `mcp.json`. Cursor MCP logs are available from the Output panel; choose the MCP Logs output channel.
411
+
412
+ ## First Use Flow
413
+
414
+ After the MCP server is connected:
415
+
416
+ 1. Call `read.get_server_status` and record `packageName`, `version`, `evidencePolicy.version`, `network`, and `implementedToolsCount` before running evidence-policy checks. Use the returned numeric `implementedToolsCount` field instead of hand-counting the tool array.
417
+ 2. Use wallet-free read tools directly when you need market context:
418
+ - `read.list_deepbook_pools`
419
+ - `read.list_deepbook_tokens`
420
+ - `read.get_deepbook_mid_price`
421
+ - `read.inspect_deepbook_orderbook`
422
+ - `read.quote_deepbook_action`
423
+ - `read.quote_deepbook_display_amount`
424
+ 3. For wallet-account reads, call `session.create_wallet_connection`.
425
+ 4. Use the internal Connect card in Claude Desktop or Codex desktop and explicitly choose the connection operation.
426
+ 5. Scan the card’s pairing QR in a Sui mainnet wallet and approve the connection. This is not approval of a transaction.
427
+ 6. Read or wait on the returned cardId. A card that still needs a selection does not have a pending pairing. Select an approved account explicitly if the wallet provides several.
428
+ 7. Call `session.get_interaction_status` to check the connection and available default asset account. `account.get_active_account` separately reports the stored selection.
429
+ Then call the read tool that matches the user's request:
430
+ - `read.summarize_wallet_assets` for balances.
431
+ - `read.classify_wallet_assets` for coin-balance roles.
432
+ - `read.preview_intent_evidence` for natural-language USD-denominated coverage or settlement-asset balance-total evidence.
433
+ - `read.summarize_deepbook_account_inventory` for DeepBook manager or pool-account inventory.
434
+ - `read.summarize_sui_activity_scan` for a live bounded activity summary.
435
+ - `read.summarize_sui_function_activity_scan` for sent transactions that called one full function target.
436
+ If the selected tool accepts `account` and the user supplied a Sui address, pass it instead of starting wallet connection. DeepBook account inventory has no explicit address input.
437
+ 8. For local review evidence, use `read.list_review_activity`, `read.summarize_review_funnel`, or `read.get_review_session_detail`.
438
+ 9. For local endpoint settings or local data controls, ask your AI client to call `settings.create_local_settings_session`, then open the returned settings URL in the same machine's system browser. Setting changes apply after restart.
439
+
440
+ ## Wallet Connection Boundary
441
+
442
+ An active account is read context, not login, ownership proof or transaction
443
+ permission. Explicit public-address reads do not set it. Connect and Review use
444
+ internal MCP Apps views; there is no external wallet/review page or browser
445
+ signer. A client without a card surface can use ordinary reads but cannot start
446
+ these UI workflows. See [Wallet Connection](WALLET_CONNECTION.md).
447
+
448
+ The package includes Sui MCP's WalletConnect project identifier. Wallet
449
+ connection requires no project ID setting and offers no project ID override.
450
+ The identifier is public, not a wallet credential. Installations share that
451
+ project's Relay service limits; service availability is not guaranteed by a
452
+ local configuration value. Only the backend owner starts its isolated SDK child, and
453
+ clients use the same product identifier when identifying that shared backend.
454
+ Do not paste pairing URIs or UI permission values into chat.
455
+
456
+ Sui MCP allows one usable wallet connection across the shared data folder,
457
+ with one or more wallet-approved Sui mainnet addresses. If several valid
458
+ connections are saved, the Connect card lists them for target-specific
459
+ Disconnect confirmation. Account use and signing remain blocked until the
460
+ conflict is resolved. No connection is silently chosen or remotely removed.
461
+
462
+ There is no Restart wallet service button in Connect or Settings. If the
463
+ connection service is unavailable or a disconnection remains unresponsive,
464
+ fully quit all apps using Sui MCP and reopen them. Closing only a window
465
+ or a client that does not own the shared backend is insufficient. Another open
466
+ client may take ownership. Verify that the old backend and SDK child exited
467
+ and that the new service becomes available; editing a config file is not a
468
+ runtime restart. A process that survives app exit needs separate diagnosis,
469
+ not a claim that recovery succeeded.
470
+
471
+ Restarting does not cancel a transaction on Sui or confirm remote disconnection.
472
+ Check retained connections in your wallet app. Saved results and the known
473
+ digests of submitted transactions remain available after restart. An
474
+ unsubmitted approval needs a fresh review and explicit wallet approval; nothing
475
+ is resent automatically. Normal initialization is not a failure warning.
476
+
477
+ The shared backend uses internal API version 7. All clients sharing a data
478
+ folder must use a compatible installation. Fully quit the old clients before
479
+ starting the same updated installation; an incompatible owner is refused.
480
+ Product schema 9 and private SDK format 1 are retained.
481
+
482
+ Review requires an explicit card action and individual wallet approval. The
483
+ backend uses Sui sign-only requests, verifies returned bytes/digest/signer and
484
+ submits once. Wallet support must be confirmed through its normal sign-only
485
+ flow; an advertised namespace or rejected request is not sufficient. Account,
486
+ Receipt and Chart do not sign or submit.
487
+
488
+ ## Internal read cards
489
+
490
+ Ask the AI client to show an account asset card, a transaction result card, or a DeepBook USDC chart. The corresponding tools are `ui.open_account`, `ui.open_receipt`, and `ui.open_chart`. Claude Desktop and Codex desktop use their internal MCP Apps view. A client without that UI receives `ui_unavailable`; ordinary read tools still provide evidence.
491
+
492
+ A card accepts one read selection. Moving between chats or recreating its frame does not close valid unsubmitted input. After the server accepts the selection or its input period expires, the original input stays closed. Request a new card for a different selection. A server restart ends unfinished cards without repeating their queries; completed results remain readable. If a reply is lost, use the same card’s saved-state recovery before starting another request. These read cards do not connect a wallet, sign or submit transactions. Cards do not provide clipboard or copy-button features.
493
+
494
+ ## Local data format
495
+
496
+ Start this runtime with an empty `SUI_MCP_DATA_DIR` or a database already in its current format. A mismatched existing database is refused before writes. There is no older DB or backup migration. The current database and public backup use schema 9; a development checkout replacing schema 8 needs a new empty data folder, preserving the previous folder. Older local records, known/active accounts and stored endpoints are not inherited; set the needed account context and endpoints again. Existing files are left in place, and environment overrides keep their existing precedence. See [Local DB Architecture](LOCAL_DB_ARCHITECTURE.md) for the current format, backup scope and card-result retention. Card results do not expire with the input period and can increase DB size. Reset/import removes them along with the affected local data; it is not a card-only space cleanup operation.
497
+
498
+ ## Local Settings
499
+
500
+ Beginner setup uses the built-in Sui mainnet gRPC and GraphQL endpoints. You do not need to copy an endpoint into Claude, Codex, Cursor, or another MCP client.
501
+
502
+ To inspect settings or change stored endpoints, ask your AI client:
503
+
504
+ - "Show my Sui MCP local settings."
505
+ - "Open my Sui MCP local settings page."
506
+
507
+ The settings page lets the user:
508
+
509
+ - save custom Sui gRPC and GraphQL endpoints;
510
+ - restore the default Sui gRPC and GraphQL URLs;
511
+ - clear active account read context;
512
+ - reset logical local data;
513
+ - export local data;
514
+ - import replace-only local data.
515
+
516
+ Settings validation rules:
517
+
518
+ - Import preview validates the backup shape without contacting the imported endpoint.
519
+ - Import accepts only the current backup format and schema identifier. Required settings and activity fields must be present; missing fields are not filled from defaults.
520
+ - Current-format backups can contain `function_scan` provenance. Unsupported formats and scan-kind values are rejected rather than partially imported.
521
+ - Endpoint chain-identifier verification runs only when the user confirms the replace-only import.
522
+ - A custom gRPC endpoint must be an `http` or `https` URL with an explicit port and no credentials, path, query string, or fragment.
523
+ - A custom GraphQL endpoint must be an `https` URL with no credentials, query string, or fragment.
524
+ - The runtime verifies custom endpoints report the expected Sui mainnet chain identifier before saving them, including when an endpoint comes from an imported local data backup. The GraphQL endpoint is also verified lazily on first Sui activity tool use after process start.
525
+ - Endpoint changes apply after MCP server restart; restart the MCP client after setting or restoring the value.
526
+
527
+ ## Advanced Runtime Settings
528
+
529
+ `SUI_GRPC_URL` and `SUI_GRAPHQL_URL` are advanced temporary overrides for operators and smoke tests. They win over the stored local setting for the current process and do not mutate SQLite:
530
+
531
+ ```bash
532
+ SUI_GRPC_URL="https://fullnode.mainnet.sui.io:443" node /absolute/path/to/sui-mcp/dist/runtime/start.js
533
+ ```
534
+
535
+ ```bash
536
+ SUI_GRAPHQL_URL="https://graphql.mainnet.sui.io/graphql" node /absolute/path/to/sui-mcp/dist/runtime/start.js
537
+ ```
538
+
539
+ Use this only when you need a one-run override or need to recover from a stored custom endpoint that no longer starts.
540
+
541
+ After the MCP server starts with the override:
542
+
543
+ 1. Open the local settings page.
544
+ 2. Restore the default endpoint or save a new endpoint.
545
+ 3. Remove the environment override.
546
+ 4. Restart the client.
547
+
548
+ Restoring default returns the stored endpoint to the built-in default.
549
+
550
+ If the custom provider is only temporarily unavailable, keep using the environment override or save a new custom endpoint instead.
551
+
552
+ `SUI_MCP_DATA_DIR` stays outside SQLite because the database path must be known before the database opens:
553
+
554
+ ```bash
555
+ SUI_MCP_DATA_DIR="/path/to/local/app-data" node /absolute/path/to/sui-mcp/dist/runtime/start.js
556
+ ```
557
+
558
+ To reset local product data files, stop the MCP server and delete `sui-mcp.sqlite`, `sui-mcp.sqlite-wal`, and `sui-mcp.sqlite-shm`, or use a new `SUI_MCP_DATA_DIR`.
559
+
560
+ Resetting, importing or replacing that database does not disconnect approvals
561
+ in your wallet app. Private SDK sessions are stored separately, and the backend
562
+ does not restore a connection without its product database record. If an old
563
+ connection is no longer listed in Sui MCP, remove it from the connected-app
564
+ list in your wallet app. Removing local data cannot cancel a transaction on Sui.
565
+
566
+ ### Fixed review server port
567
+
568
+ `SUI_MCP_REVIEW_PORT` selects the authenticated shared backend port
569
+ (1–65535, default 8765). Clients for the same data folder must use the same port
570
+ and configuration. A second runtime owner for that folder is refused even on a
571
+ different port. No client forces a peer backend to stop. The parent can end only
572
+ its own SDK child, whose separate storage lease prevents overlapping SDK writers.
573
+ The port is not a browser-wallet authorization origin.
574
+
575
+ ## Packed Package Testing
576
+
577
+ `npm run release:check` checks synchronized release metadata, typechecks, tests,
578
+ builds, and verifies the actual npm tarball and bundled licenses. It installs the
579
+ tarball in a temporary directory and runs that installed binary to check MCP
580
+ initialization, tools, document/card resources, the local Settings page and
581
+ assets, and the isolated SDK child. It confirms that Connect rejects restart
582
+ input, manage does not pair merely by opening, and the SDK keeps its exclusive
583
+ storage lease until shutdown. Runtime startup requires reachable Sui mainnet endpoints; a startup
584
+ failure leaves dependent checks unverified. The check uses an isolated data
585
+ directory and port, ends the child process before cleanup, and does not use your
586
+ stored wallet sessions, pair a wallet, sign, submit, reset data, or publish to npm.
587
+ See [Utility Index](UTILITY_INDEX.md#release-package-check) for prerequisites.
588
+
589
+ ## Current Release Limitations
590
+
591
+ - Product-facing behavior is mainnet-only.
592
+ - Current asset reads without an explicit address require the selected account to have a usable current wallet connection. An explicit address works only for tools that accept `account`; DeepBook account inventory instead needs a usable connection and account selection. Saved result reads remain available.
593
+ - Account-bound DeepBook review requires all evidence stages. The internal
594
+ Review card then allows an explicit WalletConnect request under user control.
595
+ Requests and observed chain results are separate; missing results remain
596
+ unknown and are not resubmitted automatically.
597
+ - External proposals remain non-signable. `blocked` refers to that review's
598
+ unmet evidence requirements, not to a hidden fallback signing path.
599
+ - The `npx` and global-install client configs require a published version of
600
+ `@zktx.io/sui-mcp`. A developer checkout or packed tarball tests local
601
+ changes; its existence does not establish public package availability.
602
+
603
+ ## Mainnet Read Smoke
604
+
605
+ Run this manually before release checks when a mainnet gRPC provider is available. Normal setup does not require setting `SUI_GRPC_URL`; this environment variable is an operator override for the smoke process.
606
+
607
+ ```bash
608
+ export SUI_GRPC_URL="https://fullnode.mainnet.sui.io:443"
609
+ export SUI_GRAPHQL_URL="https://graphql.mainnet.sui.io/graphql" # optional override; default is the built-in mainnet GraphQL endpoint
610
+ export SMOKE_SUI_ADDRESS="0x..."
611
+ export SMOKE_DEEPBOOK_POOL_KEY="DEEP_SUI"
612
+ export SMOKE_QUOTE_AMOUNT="1000000000" # raw integer units; for SUI, 1000000000 = 1 SUI
613
+ # Optional: export SMOKE_INSPECT_DIGEST="..."
614
+ # Optional: export SMOKE_INSPECT_RANDOM_LATEST="true"
615
+ # Optional: export SMOKE_FUNCTION_TARGET="0x...::module::function"
616
+ npm run build
617
+ npm run smoke:mainnet
618
+ ```
619
+
620
+ The smoke script calls read-only MCP tools against mainnet:
621
+
622
+ - wallet assets;
623
+ - DeepBook orderbook;
624
+ - raw-quantity DeepBook quote;
625
+ - `read.scan_sui_account_activity` for `SMOKE_SUI_ADDRESS` with limit 5;
626
+ - `read.summarize_sui_activity_scan` through active account context with limit 5.
627
+
628
+ When `SMOKE_FUNCTION_TARGET` is set to a full `package::module::function`, it also calls:
629
+
630
+ - `read.scan_sui_function_activity` for `SMOKE_SUI_ADDRESS` with limit 5;
631
+ - `read.summarize_sui_function_activity_scan` through active account context with limit 5.
632
+
633
+ The raw-quantity DeepBook quote smoke path does not call the display-amount quote.
634
+ It also does not exercise account-bound DeepBook transaction-material build or
635
+ internal digest binding. A funded-account material-build smoke is a separate
636
+ operator check before smoke results can be treated as product-grade proof for
637
+ that review stage.
638
+
639
+ Empty account or function activity pages are valid smoke outcomes. They are recorded with `rowCount: 0` and `emptyAccepted: true`.
640
+
641
+ When `SMOKE_FUNCTION_TARGET` is unset, function activity smoke is recorded as not run with `notRunReason: "missing_env"`.
642
+
643
+ The smoke result file records tool names, environment-variable presence, activity status, row counts, source method, window/order flags, persistence status, whether a function target was present, and evidence-boundary metrics.
644
+
645
+ Recorded metrics include:
646
+
647
+ - `fullDetailsReturned`;
648
+ - `compactReturned`;
649
+ - `compactBalanceChangeRowCount`;
650
+ - `compactAggregatedBalanceChangeRowCount`;
651
+ - `transactionContextCount`;
652
+ - `requestedAccountTransactionFactCount`;
653
+ - `requestedAccountTransactionFactBalanceChangeRowCount`;
654
+ - `requestedAccountEffectBalanceChangeRowCount`;
655
+ - `requestedAccountEffectTruncatedTransactionCount`;
656
+ - `requestedAccountCoinFlowCount`;
657
+ - `analysisCoinFlowCount`.
658
+
659
+ The result file does not store raw GraphQL payloads, transaction bytes, signatures, raw transaction details, or compact transaction aggregates.
660
+
661
+ Activity scan and summary smoke paths fail if full transaction details or compact transaction aggregates are returned.
662
+
663
+ It does not call DeepBook account inventory tools.
664
+
665
+ If `SMOKE_INSPECT_DIGEST` is set, it also calls `read.inspect_sui_transaction` for that digest and the smoke address.
666
+
667
+ If `SMOKE_INSPECT_RANDOM_LATEST=true` is set and `SMOKE_INSPECT_DIGEST` is unset, it samples one digest from the latest GraphQL transaction page and inspects that digest without an account argument.
668
+
669
+ It is not part of CI or `release:check`.
670
+ `SMOKE_SUI_ADDRESS` must be a 32-byte hex Sui address, for example `0x` followed by 64 hex characters.
671
+ `SMOKE_FUNCTION_TARGET` is optional. When set, it must be a full Sui function target in `package::module::function` form; package-only, package-and-module-only, bare function names, and generic/type-argument forms fail the optional function activity smoke path.
672
+ `SMOKE_INSPECT_DIGEST` is optional. Use a digest whose sender or returned balance-change owner is `SMOKE_SUI_ADDRESS` to exercise the stored digest-lookup path; otherwise the lookup can still return `ok` with `persistence.stored: false`.
673
+ `SMOKE_INSPECT_RANDOM_LATEST=true` checks current transaction-read shape without pinning a specific user address and without exercising the stored relation path.
674
+
675
+ ## Troubleshooting
676
+
677
+ ### Server does not appear in the client
678
+
679
+ - Confirm the command uses absolute paths for local checkout setup.
680
+ - Confirm `npm run build` has completed after source changes.
681
+ - Restart the MCP client so it relaunches the stdio process.
682
+ - Run the configured command directly in a terminal and check stderr.
683
+ - For Claude Desktop, check the MCP logs under `~/Library/Logs/Claude` or `%APPDATA%\Claude\logs`.
684
+
685
+ ### Runtime exits on startup
686
+
687
+ A bootstrap failure exits with code 1 and a `fatal runtime error` diagnostic on
688
+ stderr, including a safe stage and reason. An MCP initialization response alone
689
+ does not mean backend startup succeeded. A foreign or incompatible port owner,
690
+ private data ownership/permission failure, and mainnet endpoint failure are
691
+ reported separately. Use the same installed runtime and configuration in all
692
+ clients; the runtime does not replace an incompatible listener automatically.
693
+ Normal client input closure exits with code 0 after cleanup. SIGINT/SIGTERM keep
694
+ codes 130/143. Cleanup failure is reported and makes a normal closure fail; it
695
+ cannot erase an earlier fatal or signal exit. SDK service unavailability is a
696
+ separate condition and does not by itself shut down the parent read service.
697
+
698
+ - Do not set `SUI_RPC_URL`; this runtime intentionally uses Sui gRPC and rejects Sui JSON-RPC config.
699
+ - If a stored custom endpoint fails, temporarily start with `SUI_GRPC_URL`, open the local settings page, restore the default Sui gRPC URL or save a new endpoint, remove the override, and restart.
700
+ - If an environment override is present, confirm it has scheme, host, and explicit port only.
701
+ - If the startup chain identifier guard fails, use a Sui mainnet gRPC endpoint. If a Sui activity tool fails its GraphQL chain identifier guard, use a Sui mainnet GraphQL endpoint.
702
+
703
+ ### Tool calls return `active_account_not_set`
704
+
705
+ For tools with an `account` input, provide an explicit Sui address in chat. DeepBook account inventory has no address input and needs a connected selected account. When connection or account selection is wanted:
706
+
707
+ 1. Open a Connect card with `session.create_wallet_connection` and `intent: connect`.
708
+ 2. The card prepares the QR after confirming current state.
709
+ 3. Scan it and approve the Sui mainnet connection in your wallet.
710
+ 4. Read or wait on that cardId; select an approved read account when required.
711
+ 5. Confirm connection availability with `session.get_interaction_status`. Stored read context alone is not a usable default for current asset reads.
712
+
713
+ If the user supplied a specific Sui address for `read.summarize_wallet_assets` or `read.classify_wallet_assets`, pass that address as `account` instead of creating a wallet connection session.
714
+
715
+ ### NPM command returns 404
716
+
717
+ A 404 means the requested package or version could not be retrieved from the
718
+ selected registry. Confirm the exact name and version, for example with
719
+ `npm view @zktx.io/sui-mcp@0.5.0 version --registry=https://registry.npmjs.org`.
720
+ A new version may not have been published or become visible yet; a mistyped name
721
+ or an alternate/private registry can also explain the response. Check the
722
+ publication result and registry configuration before retrying. Do not assume
723
+ that the package exists solely because a local checkout builds successfully.
724
+ Developer Checkout Setup or `npm run release:check` can test local changes;
725
+ neither substitutes for public publication.
726
+
727
+ ## Client Snippets
728
+
729
+ The Claude Code, Claude Desktop, Codex, and Cursor snippets above were checked against official client documentation current to this repository update. If a client changes its MCP config format, prefer that client's official documentation over this file and update this file in the same change.
730
+
731
+ ### Optional account-bound review smoke
732
+
733
+ Set `SMOKE_SWAP_PROTOCOL`, `SMOKE_SWAP_FROM_SYMBOL`, `SMOKE_SWAP_TO_SYMBOL` and
734
+ `SMOKE_SWAP_AMOUNT_DISPLAY` together to opt into read-only account-bound review
735
+ computation. Protocol is explicitly `deep`; the smoke does not silently select a protocol.
736
+ A partially configured group is an error. `SMOKE_SWAP_MAX_SLIPPAGE_BPS` keeps the
737
+ existing explicit override. The script uses the same runtime review composition,
738
+ material store and evidence validation as the product, and records whether
739
+ transaction review data was emitted. This can involve mainnet simulation but
740
+ never wallet pairing, signing or submission. The temporary active-account
741
+ fixture is not proof of a wallet connection or ownership. Without the complete
742
+ optional group, the result records that review computation was not run.