@stratabook/mcp 0.2.14 → 0.2.15

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/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to the Strata SDKs (`@stratabook/sdk`, `@stratabook/mcp`,
4
4
  and the `strata-sdk` Rust crate) are recorded here. Versions move together.
5
5
 
6
+ ## 0.2.15
7
+
8
+ - Add explicit IntentBook prepare/submit tools in advanced mode and a one-call
9
+ post/permanent-revoke tool for locally configured Vault sessions.
10
+ - Apply the existing ask/limits/instant slider, USD budgets, capability gates,
11
+ exact retry behavior, and sponsored-fee explanation to intent controls.
12
+
6
13
  ## 0.2.14
7
14
 
8
15
  - Make `strata-mcp connect` the complete client-neutral trading setup flow:
package/README.md CHANGED
@@ -104,6 +104,7 @@ Advanced mode additionally exposes the complete protocol surface, including:
104
104
  - `strata_market_making_submit_and_wait` — submit the externally signed preparation idempotently and wait for matching chain-derived state
105
105
  - `strata_market_making_strand_prepare`, `strata_market_making_strand_submit`
106
106
  - `strata_market_making_current_prepare`, `strata_market_making_current_submit`
107
+ - `strata_market_making_intent_prepare`, `strata_market_making_intent_submit` — control an existing curated IntentBook seat with a Vault session; Strata pays the fee
107
108
  - `strata_vault_status`
108
109
  - `strata_vault_setup`, `strata_vault_deposit`, `strata_vault_withdraw`, `strata_vault_delegate`, `strata_vault_policy`, `strata_vault_pause` — prepare owner actions with Strata as sponsored fee payer
109
110
  - `strata_vault_submit` — submit the owner-signed preparation; Strata pays and broadcasts
@@ -157,6 +158,12 @@ restart. Use `action: "stop"` through the same pair. The older product-specific
157
158
  tools remain available for strategies that deliberately manage every low-level
158
159
  array and safety field.
159
160
 
161
+ With a local trading session, `strata_market_making_intent_execute` posts or
162
+ permanently revokes an existing curated IntentBook seat in one call under the
163
+ same ask/limits/instant slider. The session signs only the SDK-verified packet;
164
+ the owner wallet does not sign each update. Exact submit retries return the
165
+ original confirmed signature while the packet remains live.
166
+
160
167
  For maker funding, initialize the market Vault if needed, activate the Strand
161
168
  or Current, then deposit with `strata_vault_deposit`. The market keeps that
162
169
  available collateral while a control is live and returns it after the final
@@ -17,8 +17,9 @@
17
17
  * caps (the owner's per-asset limits, tolerance, interval,
18
18
  * expiry). Hyperliquid-style.
19
19
  *
20
- * Withdraw, policy, pause, and revoke are never on this slider — they always
21
- * require the owner's wallet. The on-chain session caps are the hard ceiling;
20
+ * Vault withdrawal, policy, session rotation, and pause are never on this
21
+ * slider — they always require the owner's wallet. An IntentBook seat's own
22
+ * session-authorized revoke remains available as its permanent risk exit. The on-chain session caps are the hard ceiling;
22
23
  * this slider is a softer layer above them. An agent can *read* the level
23
24
  * (`strata_autonomy`) and *offer* to change it, but nothing an agent calls can
24
25
  * raise its own autonomy: the only knob is the human's (env / Agents page).
@@ -17,8 +17,9 @@
17
17
  * caps (the owner's per-asset limits, tolerance, interval,
18
18
  * expiry). Hyperliquid-style.
19
19
  *
20
- * Withdraw, policy, pause, and revoke are never on this slider — they always
21
- * require the owner's wallet. The on-chain session caps are the hard ceiling;
20
+ * Vault withdrawal, policy, session rotation, and pause are never on this
21
+ * slider — they always require the owner's wallet. An IntentBook seat's own
22
+ * session-authorized revoke remains available as its permanent risk exit. The on-chain session caps are the hard ceiling;
22
23
  * this slider is a softer layer above them. An agent can *read* the level
23
24
  * (`strata_autonomy`) and *offer* to change it, but nothing an agent calls can
24
25
  * raise its own autonomy: the only knob is the human's (env / Agents page).
@@ -173,6 +173,9 @@ const LEGACY_TOOL_CAPABILITIES = {
173
173
  strata_market_making_strand_submit: { ids: ["mm.strand.manage"] },
174
174
  strata_market_making_current_prepare: { ids: ["mm.current.manage"] },
175
175
  strata_market_making_current_submit: { ids: ["mm.current.manage"] },
176
+ strata_market_making_intent_prepare: { ids: ["mm.intent.manage"] },
177
+ strata_market_making_intent_submit: { ids: ["mm.intent.manage"] },
178
+ strata_market_making_intent_execute: { ids: ["mm.intent.manage"] },
176
179
  strata_market_making_prepare: { ids: ["mm.strand.manage", "mm.current.manage"], match: "any" },
177
180
  strata_market_making_submit_and_wait: { ids: ["mm.strand.manage", "mm.current.manage"], match: "any" },
178
181
  strata_execute_quote: { ids: ["trade.submit"] },
@@ -216,6 +219,9 @@ const PLATFORM_TOOL_CAPABILITIES = {
216
219
  strata_market_making_strand_submit: { ids: ["mm.strand.manage"] },
217
220
  strata_market_making_current_prepare: { ids: ["mm.current.manage"] },
218
221
  strata_market_making_current_submit: { ids: ["mm.current.manage"] },
222
+ strata_market_making_intent_prepare: { ids: ["mm.intent.manage"] },
223
+ strata_market_making_intent_submit: { ids: ["mm.intent.manage"] },
224
+ strata_market_making_intent_execute: { ids: ["mm.intent.manage"] },
219
225
  strata_market_making_prepare: { ids: ["mm.strand.manage", "mm.current.manage"], match: "any" },
220
226
  strata_market_making_submit_and_wait: { ids: ["mm.strand.manage", "mm.current.manage"], match: "any" },
221
227
  strata_rewards: { ids: ["rewards.read"] },
@@ -2059,6 +2065,76 @@ export async function createStrataMcpServer(options = {}) {
2059
2065
  });
2060
2066
  return toolResult(response, `Submitted ${response.action} as ${response.signature}.`);
2061
2067
  }));
2068
+ const makerIntentPrepare = registerTool("strata_market_making_intent_prepare", {
2069
+ title: "Prepare Strata IntentBook control",
2070
+ description: "Prepare one sponsored Vault-session transaction for an existing curated IntentBook seat. "
2071
+ + "Post updates its side, price band, and maximum fill. Revoke permanently closes the seat; "
2072
+ + "it cannot be posted again. The owner wallet does not sign each update.",
2073
+ inputSchema: {
2074
+ marketId: makerMarketIdSchema,
2075
+ action: z.enum(["post", "revoke"]),
2076
+ ownerWallet: makerPublicKeySchema,
2077
+ sessionPublicKey: makerPublicKeySchema,
2078
+ side: z.enum(["buy", "sell", "both"]).optional(),
2079
+ minPriceAtoms: makerPositiveAtomicSchema.optional(),
2080
+ maxPriceAtoms: makerPositiveAtomicSchema.optional(),
2081
+ maxFillSizeAtoms: makerPositiveAtomicSchema.optional(),
2082
+ },
2083
+ annotations: {
2084
+ readOnlyHint: false,
2085
+ destructiveHint: true,
2086
+ idempotentHint: false,
2087
+ openWorldHint: true,
2088
+ },
2089
+ }, async (args) => guardedTool(client, "mm.intent.manage", async () => {
2090
+ let request;
2091
+ if (args.action === "revoke") {
2092
+ request = {
2093
+ action: "revoke",
2094
+ ownerWallet: args.ownerWallet,
2095
+ sessionPublicKey: args.sessionPublicKey,
2096
+ };
2097
+ }
2098
+ else {
2099
+ if (args.side === undefined
2100
+ || args.minPriceAtoms === undefined
2101
+ || args.maxPriceAtoms === undefined
2102
+ || args.maxFillSizeAtoms === undefined) {
2103
+ return toolError("invalid_request", "Intent post requires side, minPriceAtoms, maxPriceAtoms, and maxFillSizeAtoms.", false);
2104
+ }
2105
+ request = {
2106
+ action: "post",
2107
+ ownerWallet: args.ownerWallet,
2108
+ sessionPublicKey: args.sessionPublicKey,
2109
+ side: args.side,
2110
+ minPriceAtoms: args.minPriceAtoms,
2111
+ maxPriceAtoms: args.maxPriceAtoms,
2112
+ maxFillSizeAtoms: args.maxFillSizeAtoms,
2113
+ };
2114
+ }
2115
+ const response = await platformClient.marketMaking.intent.prepare(args.marketId, request);
2116
+ return toolResult(response, `Prepared IntentBook ${response.action}; verify and add only the session signature before ${response.expires_at_ms}. Strata pays the network fee.`);
2117
+ }));
2118
+ const makerIntentSubmit = registerTool("strata_market_making_intent_submit", {
2119
+ title: "Submit Strata IntentBook control",
2120
+ description: "Submit the exact session-signed IntentBook packet. Exact retries during the packet's live "
2121
+ + "blockhash window return the original confirmed signature.",
2122
+ inputSchema: {
2123
+ marketId: makerMarketIdSchema,
2124
+ signedTransactionBase64: makerBase64Schema,
2125
+ },
2126
+ annotations: {
2127
+ readOnlyHint: false,
2128
+ destructiveHint: true,
2129
+ idempotentHint: true,
2130
+ openWorldHint: true,
2131
+ },
2132
+ }, async ({ marketId, signedTransactionBase64 }) => guardedTool(client, "mm.intent.manage", async () => {
2133
+ const response = await platformClient.marketMaking.intent.submit(marketId, {
2134
+ signedTransactionBase64,
2135
+ });
2136
+ return toolResult(response, `Submitted IntentBook control as ${response.signature}.`);
2137
+ }));
2062
2138
  registerAutonomyTools(registerTool, client, platformClient, options.sessionAutonomy, () => typeof Date !== "undefined" ? Date.now() : 0);
2063
2139
  void [
2064
2140
  markets,
@@ -2077,6 +2153,8 @@ export async function createStrataMcpServer(options = {}) {
2077
2153
  makerStrandSubmit,
2078
2154
  makerCurrentPrepare,
2079
2155
  makerCurrentSubmit,
2156
+ makerIntentPrepare,
2157
+ makerIntentSubmit,
2080
2158
  ];
2081
2159
  applyToolAvailability(registeredTools, initialCatalog, initialPlatformCatalog, toolMode);
2082
2160
  let closed = false;
@@ -2175,6 +2253,65 @@ function registerAutonomyTools(registerTool, client, platformClient, autonomy, n
2175
2253
  };
2176
2254
  };
2177
2255
  const refuse = (reason, prepared, summary) => toolResult({ executed: false, reason, prepared }, summary);
2256
+ // ── one-shot existing IntentBook seat control ──────────────────────────────
2257
+ registerTool("strata_market_making_intent_execute", {
2258
+ title: "Execute Strata IntentBook control",
2259
+ description: "Post or permanently revoke an existing curated IntentBook seat in one call. The configured "
2260
+ + "Vault session verifies and signs; Strata pays the network fee. Under ask, or above a limits "
2261
+ + "ceiling, this prepares the exact packet but does not sign it.",
2262
+ inputSchema: {
2263
+ marketId: makerMarketIdSchema,
2264
+ action: z.enum(["post", "revoke"]),
2265
+ side: z.enum(["buy", "sell", "both"]).optional(),
2266
+ minPriceAtoms: makerPositiveAtomicSchema.optional(),
2267
+ maxPriceAtoms: makerPositiveAtomicSchema.optional(),
2268
+ maxFillSizeAtoms: makerPositiveAtomicSchema.optional(),
2269
+ },
2270
+ annotations: {
2271
+ readOnlyHint: false,
2272
+ destructiveHint: true,
2273
+ idempotentHint: false,
2274
+ openWorldHint: true,
2275
+ },
2276
+ }, async (args) => guardedTool(client, "mm.intent.manage", async () => {
2277
+ let operation;
2278
+ if (args.action === "revoke") {
2279
+ operation = { action: "revoke", ownerWallet: autonomy.ownerWallet };
2280
+ }
2281
+ else {
2282
+ if (args.side === undefined
2283
+ || args.minPriceAtoms === undefined
2284
+ || args.maxPriceAtoms === undefined
2285
+ || args.maxFillSizeAtoms === undefined) {
2286
+ return toolError("invalid_request", "Intent post requires side, minPriceAtoms, maxPriceAtoms, and maxFillSizeAtoms.", false);
2287
+ }
2288
+ operation = {
2289
+ action: "post",
2290
+ ownerWallet: autonomy.ownerWallet,
2291
+ side: args.side,
2292
+ minPriceAtoms: args.minPriceAtoms,
2293
+ maxPriceAtoms: args.maxPriceAtoms,
2294
+ maxFillSizeAtoms: args.maxFillSizeAtoms,
2295
+ };
2296
+ }
2297
+ const baseAtoms = operation.action === "post" ? BigInt(operation.maxFillSizeAtoms) : 0n;
2298
+ const notional = await estimateBaseNotionalUsd(resolver, markFor, args.marketId, baseAtoms);
2299
+ const decision = decideAutonomy(autonomy, args.marketId, notional, nowMs());
2300
+ if (!decision.allow) {
2301
+ const prepared = await platformClient.marketMaking.intent.prepare(args.marketId, {
2302
+ ...operation,
2303
+ sessionPublicKey: autonomy.signer.publicKey,
2304
+ });
2305
+ return refuse(decision.reason, prepared, decision.reason);
2306
+ }
2307
+ const receipt = await platformClient.marketMaking.intent.execute(args.marketId, {
2308
+ operation,
2309
+ signer: autonomy.signer,
2310
+ });
2311
+ if (notional !== null)
2312
+ autonomy.dailyBudget.record(notional, nowMs());
2313
+ return toolResult({ executed: true, receipt, notional_usd: notional }, `Executed IntentBook ${operation.action} as ${receipt.signature}.`);
2314
+ }));
2178
2315
  // ── one-shot immediate execution from a fresh Sonar quote ─────────────────
2179
2316
  registerTool("strata_execute_quote", {
2180
2317
  title: "Execute a Strata quote",
@@ -14,6 +14,7 @@ export const SIMPLE_TOOL_NAMES = new Set([
14
14
  "strata_market_making_status",
15
15
  "strata_market_making_prepare",
16
16
  "strata_market_making_submit_and_wait",
17
+ "strata_market_making_intent_execute",
17
18
  "strata_autonomy",
18
19
  "strata_trade",
19
20
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratabook/mcp",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "Connect AI agents to Strata markets and Sonar quotes with MCP.",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@modelcontextprotocol/sdk": "1.30.0",
48
- "@stratabook/sdk": "0.2.14",
48
+ "@stratabook/sdk": "0.2.15",
49
49
  "zod": "^3.25.76"
50
50
  },
51
51
  "devDependencies": {