@stratabook/mcp 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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.14
7
+
8
+ - Make `strata-mcp connect` the complete client-neutral trading setup flow:
9
+ choose limits in Strata, sign once, save the secret locally, and return to a
10
+ confirmed connected Control Center without environment variables or config
11
+ editing.
12
+ - Re-running `connect` now rotates an existing local session atomically, and
13
+ saves the new credential only after both activation and old-key revocation
14
+ are confirmed.
15
+
6
16
  ## 0.2.13
7
17
 
8
18
  - Add `strata-mcp connect`: generate the session secret locally, open the
package/README.md CHANGED
@@ -30,6 +30,11 @@ The browser and Strata receive only the public key:
30
30
  npx -y @stratabook/mcp connect
31
31
  ```
32
32
 
33
+ This opens the client-neutral Strata limit picker, registers the locally
34
+ generated key with one wallet signature, saves the credential privately, and
35
+ returns to the live Control Center. Run the same command again to replace the
36
+ old key atomically; the old key is revoked in the same signed transaction.
37
+
33
38
  There is no secret to paste into chat, no environment-variable screen, and no
34
39
  client config to edit after the read-only server is installed. Restart or
35
40
  refresh the MCP client after the browser confirms connection. Revoke the exact
package/dist/src/cli.js CHANGED
@@ -88,9 +88,10 @@ Options:
88
88
  --no-open Print the wallet pairing URL without opening a browser
89
89
 
90
90
  Read-only markets, books, and Sonar quotes work immediately. Run strata-mcp
91
- doctor to check them. Run strata-mcp connect once to register a local session
92
- with the owner wallet; there are no secrets to copy or environment variables
93
- to edit. Run strata-mcp disconnect to revoke it. Strata never asks for seed phrases.
91
+ doctor to check them. Run strata-mcp connect to choose limits and register a
92
+ local session with one owner signature; run it again to replace that session
93
+ atomically. There are no secrets to copy or environment variables to edit.
94
+ Run strata-mcp disconnect to revoke it. Strata never asks for seed phrases.
94
95
  `);
95
96
  }
96
97
  async function runDoctor(options, sessionEnv) {
@@ -49,7 +49,7 @@ export declare const STRATA_AGENT_HARNESS: {
49
49
  readonly instruction: "When an owner requests a Vault pause or resume and vault.pause is live, prepare the exact transaction with the official SDK, verify that the wallet and requested state are unchanged, then have the owner-configured signer sign and broadcast it externally. Preparation alone does not change state.";
50
50
  }, {
51
51
  readonly id: "onboard_vault";
52
- readonly instruction: "Onboarding is one owner signature, once: register the external session key with vault.setup (only the wallet and the session key are required; one session then trades every market) or simply name the session key on the first vault.deposit, which registers it in the same transaction. Policy fields — expiry, cadence, tolerance, per-asset limits — are optional. Verify every echoed field and the prepared transaction before external owner signing and broadcast; retain the session key only in the owner's signer.";
52
+ readonly instruction: "Onboarding is one owner signature: register the external session key with vault.setup (only the wallet and the session key are required; one session then trades every market) or simply name the session key on the first vault.deposit, which registers it in the same transaction. Policy fields — expiry, cadence, tolerance, per-asset limits — are optional. Supplying replace_session_public_key atomically revokes the old key while registering the new one. Verify every echoed field and the prepared transaction before external owner signing and broadcast; retain the session key only in the owner's signer.";
53
53
  }, {
54
54
  readonly id: "fund_vault";
55
55
  readonly instruction: "When vault.deposit is live, select an asset from the discovered market and use an exact positive atomic amount. Verify the echoed owner, market, asset, and amount plus the prepared transaction before external owner signing and broadcast.";
@@ -64,7 +64,7 @@ export declare const STRATA_AGENT_HARNESS: {
64
64
  readonly instruction: "When vault.policy.manage is live, use blocked mode with no allowed wallets to freeze withdrawals or restricted mode with one to eight exact destination-owner wallets. Verify the echoed mode and complete wallet list before external owner signing and broadcast.";
65
65
  }, {
66
66
  readonly id: "reconcile_maker_status";
67
- readonly instruction: "When mm.status.read is live, read the maker's products by wallet address (public, no signature) before and after any maker action: resting firm orders, the intent budget, live signed quotes, each Strand and Current with its remaining exposure and expiry, oracle health, and armed dead-man guards. Reconcile against what the agent believes it posted; treat missing, expired, or disabled products as not quoting.";
67
+ readonly instruction: "When mm.status.read is live, read the maker's products by wallet address (public, no signature) before and after any maker action: resting firm orders, live signed quotes, each Strand and Current with its remaining exposure and expiry, oracle health, and armed dead-man guards. Reconcile against what the agent believes it posted; treat missing, expired, or disabled products as not quoting.";
68
68
  }, {
69
69
  readonly id: "stream_maker_fills";
70
70
  readonly instruction: "When mm.fills.stream is live, keep one maker stream open per market through the official SDK by wallet address (public, no signature): start from the maker snapshot, apply only contiguous maker_fill and maker_status events, and recover any gap or reconnect from a fresh snapshot. Reconcile every fill and exposure change against the maker's own state before quoting further.";
@@ -551,4 +551,4 @@ export declare const STRATA_ACTION_GRAPH: {
551
551
  }];
552
552
  };
553
553
  export declare const STRATA_ACTION_GRAPH_URI = "strata://action-graph/v1";
554
- export declare const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata read-only tools work immediately with no wallet, approval, session key, or environment setup. Call the requested tool directly: use strata_quote for a quote, strata_markets only when the market is unknown, and strata_portfolio for a public account. Do not begin with capability, graph, status, or market discovery unless the requested tool is unavailable, the objective is advanced or ambiguous, or the user asks what Strata supports. Simple MCP tools accept exact human amounts such as 0.1 SOL, 20 USDC, or $20; advanced and SDK interfaces also accept token atoms. Never request or accept a session secret in chat. A session is needed only when the user asks to sign a trading write; if it is missing, strata_trade returns a read-only quote and the single setup link https://stratabook.app/agents. The user can run npx -y @stratabook/mcp connect to generate and store the secret locally while the Agents page receives only its public key. Revoke, withdraw, pause, and policy changes are owner-wallet actions and never use the session signer. Strata Agent Harness 1.0. The action-graph resources are optional references for advanced integrations. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Check quote bindings, labelled fees, minimum output, price impact, tolerance, and expiry. When portfolio.read is live, read the owner's live Vault portfolio before sizing a write and treat null USD totals as an incomplete valuation, never as zero. When mm.status.read is live, reconcile the owner's maker products and exposure before and after maker actions. For normal Strand or Current operation, prefer strata_market_making_prepare, sign only its prepared transaction externally, then pass its unchanged preparationToken with the signed transaction to strata_market_making_submit_and_wait. Advanced order, TWAP, and execution integrations may use explicit challenge, prepare, verify, sign, and submit flows with idempotency. Stop on ambiguity, sequence gaps, unavailable capabilities, paused markets, inconsistent bindings, expiry, or missing signer authority.";
554
+ export declare const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata read-only tools work immediately with no wallet, approval, session key, or environment setup. Call the requested tool directly: use strata_quote for a quote, strata_markets only when the market is unknown, and strata_portfolio for a public account. Do not begin with capability, graph, status, or market discovery unless the requested tool is unavailable, the objective is advanced or ambiguous, or the user asks what Strata supports. Simple MCP tools accept exact human amounts such as 0.1 SOL, 20 USDC, or $20; advanced and SDK interfaces also accept token atoms. Never request or accept a session secret in chat. A session is needed only when the user asks to sign a trading write; if it is missing, strata_trade returns a read-only quote and the single setup link https://stratabook.app/agents. The user can run npx -y @stratabook/mcp connect to generate the secret locally, choose on-chain limits, and register with one owner signature while the Agents page receives only the public key. Rerunning the command atomically replaces the old session. Revoke, withdraw, pause, and policy changes are owner-wallet actions and never use the session signer. Strata Agent Harness 1.0. The action-graph resources are optional references for advanced integrations. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Check quote bindings, labelled fees, minimum output, price impact, tolerance, and expiry. When portfolio.read is live, read the owner's live Vault portfolio before sizing a write and treat null USD totals as an incomplete valuation, never as zero. When mm.status.read is live, reconcile the owner's maker products and exposure before and after maker actions. For normal Strand or Current operation, prefer strata_market_making_prepare, sign only its prepared transaction externally, then pass its unchanged preparationToken with the signed transaction to strata_market_making_submit_and_wait. Advanced order, TWAP, and execution integrations may use explicit challenge, prepare, verify, sign, and submit flows with idempotency. Stop on ambiguity, sequence gaps, unavailable capabilities, paused markets, inconsistent bindings, expiry, or missing signer authority.";
@@ -141,7 +141,7 @@ export const STRATA_AGENT_HARNESS = {
141
141
  },
142
142
  {
143
143
  "id": "onboard_vault",
144
- "instruction": "Onboarding is one owner signature, once: register the external session key with vault.setup (only the wallet and the session key are required; one session then trades every market) or simply name the session key on the first vault.deposit, which registers it in the same transaction. Policy fields — expiry, cadence, tolerance, per-asset limits — are optional. Verify every echoed field and the prepared transaction before external owner signing and broadcast; retain the session key only in the owner's signer."
144
+ "instruction": "Onboarding is one owner signature: register the external session key with vault.setup (only the wallet and the session key are required; one session then trades every market) or simply name the session key on the first vault.deposit, which registers it in the same transaction. Policy fields — expiry, cadence, tolerance, per-asset limits — are optional. Supplying replace_session_public_key atomically revokes the old key while registering the new one. Verify every echoed field and the prepared transaction before external owner signing and broadcast; retain the session key only in the owner's signer."
145
145
  },
146
146
  {
147
147
  "id": "fund_vault",
@@ -161,7 +161,7 @@ export const STRATA_AGENT_HARNESS = {
161
161
  },
162
162
  {
163
163
  "id": "reconcile_maker_status",
164
- "instruction": "When mm.status.read is live, read the maker's products by wallet address (public, no signature) before and after any maker action: resting firm orders, the intent budget, live signed quotes, each Strand and Current with its remaining exposure and expiry, oracle health, and armed dead-man guards. Reconcile against what the agent believes it posted; treat missing, expired, or disabled products as not quoting."
164
+ "instruction": "When mm.status.read is live, read the maker's products by wallet address (public, no signature) before and after any maker action: resting firm orders, live signed quotes, each Strand and Current with its remaining exposure and expiry, oracle health, and armed dead-man guards. Reconcile against what the agent believes it posted; treat missing, expired, or disabled products as not quoting."
165
165
  },
166
166
  {
167
167
  "id": "stream_maker_fills",
@@ -789,4 +789,4 @@ export const STRATA_ACTION_GRAPH = {
789
789
  ]
790
790
  };
791
791
  export const STRATA_ACTION_GRAPH_URI = "strata://action-graph/v1";
792
- export const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata read-only tools work immediately with no wallet, approval, session key, or environment setup. Call the requested tool directly: use strata_quote for a quote, strata_markets only when the market is unknown, and strata_portfolio for a public account. Do not begin with capability, graph, status, or market discovery unless the requested tool is unavailable, the objective is advanced or ambiguous, or the user asks what Strata supports. Simple MCP tools accept exact human amounts such as 0.1 SOL, 20 USDC, or $20; advanced and SDK interfaces also accept token atoms. Never request or accept a session secret in chat. A session is needed only when the user asks to sign a trading write; if it is missing, strata_trade returns a read-only quote and the single setup link https://stratabook.app/agents. The user can run npx -y @stratabook/mcp connect to generate and store the secret locally while the Agents page receives only its public key. Revoke, withdraw, pause, and policy changes are owner-wallet actions and never use the session signer. Strata Agent Harness 1.0. The action-graph resources are optional references for advanced integrations. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Check quote bindings, labelled fees, minimum output, price impact, tolerance, and expiry. When portfolio.read is live, read the owner's live Vault portfolio before sizing a write and treat null USD totals as an incomplete valuation, never as zero. When mm.status.read is live, reconcile the owner's maker products and exposure before and after maker actions. For normal Strand or Current operation, prefer strata_market_making_prepare, sign only its prepared transaction externally, then pass its unchanged preparationToken with the signed transaction to strata_market_making_submit_and_wait. Advanced order, TWAP, and execution integrations may use explicit challenge, prepare, verify, sign, and submit flows with idempotency. Stop on ambiguity, sequence gaps, unavailable capabilities, paused markets, inconsistent bindings, expiry, or missing signer authority.";
792
+ export const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata read-only tools work immediately with no wallet, approval, session key, or environment setup. Call the requested tool directly: use strata_quote for a quote, strata_markets only when the market is unknown, and strata_portfolio for a public account. Do not begin with capability, graph, status, or market discovery unless the requested tool is unavailable, the objective is advanced or ambiguous, or the user asks what Strata supports. Simple MCP tools accept exact human amounts such as 0.1 SOL, 20 USDC, or $20; advanced and SDK interfaces also accept token atoms. Never request or accept a session secret in chat. A session is needed only when the user asks to sign a trading write; if it is missing, strata_trade returns a read-only quote and the single setup link https://stratabook.app/agents. The user can run npx -y @stratabook/mcp connect to generate the secret locally, choose on-chain limits, and register with one owner signature while the Agents page receives only the public key. Rerunning the command atomically replaces the old session. Revoke, withdraw, pause, and policy changes are owner-wallet actions and never use the session signer. Strata Agent Harness 1.0. The action-graph resources are optional references for advanced integrations. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Check quote bindings, labelled fees, minimum output, price impact, tolerance, and expiry. When portfolio.read is live, read the owner's live Vault portfolio before sizing a write and treat null USD totals as an incomplete valuation, never as zero. When mm.status.read is live, reconcile the owner's maker products and exposure before and after maker actions. For normal Strand or Current operation, prefer strata_market_making_prepare, sign only its prepared transaction externally, then pass its unchanged preparationToken with the signed transaction to strata_market_making_submit_and_wait. Advanced order, TWAP, and execution integrations may use explicit challenge, prepare, verify, sign, and submit flows with idempotency. Stop on ambiguity, sequence gaps, unavailable capabilities, paused markets, inconsistent bindings, expiry, or missing signer authority.";
@@ -23,4 +23,5 @@ export declare function writeTradingConnection(connection: StoredTradingConnecti
23
23
  export declare function removeTradingConnection(path?: string): Promise<void>;
24
24
  /** Explicit environment variables win; otherwise load the private local file. */
25
25
  export declare function loadTradingEnvironment(env?: Readonly<Record<string, string | undefined>>): Promise<Record<string, string | undefined>>;
26
+ export declare function pairingPageUrl(webBase: string, action: PairingAction, sessionPublicKey: string, callbackUrl: string, existing: Pick<StoredTradingConnection, "owner_wallet" | "session_public_key"> | null): string;
26
27
  export declare function runLocalPairing(options: PairingOptions): Promise<void>;
@@ -114,41 +114,50 @@ function launchBrowser(url) {
114
114
  child.on("error", () => undefined);
115
115
  child.unref();
116
116
  }
117
- function successHtml(action, wallet) {
118
- const connected = action === "connect";
119
- return `<!doctype html>
120
- <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">
121
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'">
122
- <title>Strata agent ${connected ? "connected" : "disconnected"}</title>
123
- <style>html{color-scheme:dark}body{margin:0;min-height:100vh;display:grid;place-items:center;background:#080b11;color:#e2e8f0;font:15px Inter,system-ui,sans-serif}.card{width:min(520px,calc(100% - 48px));padding:28px;border:1px solid transparent;border-radius:16px;background:linear-gradient(#10141c,#090c12) padding-box,linear-gradient(120deg,#22d3ee,#8b5cf6) border-box;box-shadow:0 22px 80px #0008}h1{margin:0 0 10px;color:white;font-size:24px}p{line-height:1.55;color:#94a3b8}.ok{color:#34d399;font-weight:700}.mono{font-family:ui-monospace,monospace;color:#cbd5e1}</style>
124
- </head><body><main class="card"><div class="ok">${connected ? "CONNECTED" : "REVOKED"}</div>
125
- <h1>${connected ? "Your agent can trade" : "Agent access removed"}</h1>
126
- <p>${connected ? "The session secret was saved only on this computer. Restart or refresh your MCP client, then trade normally." : "The local trading credential has been removed. Read-only Strata tools still work."}</p>
127
- <p class="mono">Wallet ${wallet.slice(0, 6)}…${wallet.slice(-6)}</p></main></body></html>`;
117
+ export function pairingPageUrl(webBase, action, sessionPublicKey, callbackUrl, existing) {
118
+ const agentUrl = new URL("/agents", pairingWebBase(webBase));
119
+ agentUrl.searchParams.set("pair", action);
120
+ agentUrl.searchParams.set("session_public_key", sessionPublicKey);
121
+ if (existing)
122
+ agentUrl.searchParams.set("owner_wallet", existing.owner_wallet);
123
+ if (action === "connect" && existing) {
124
+ agentUrl.searchParams.set("replace_session_public_key", existing.session_public_key);
125
+ }
126
+ agentUrl.searchParams.set("callback", callbackUrl);
127
+ return agentUrl.toString();
128
128
  }
129
- async function waitForOnChainSession(apiBase, action, ownerWallet, sessionPublicKey) {
129
+ async function waitForOnChainSession(apiBase, action, ownerWallet, sessionPublicKey, replaceSessionPublicKey) {
130
130
  const deadline = Date.now() + 60_000;
131
131
  let lastState = "unavailable";
132
+ const stateFor = async (key) => {
133
+ const query = new URLSearchParams({
134
+ wallet_address: ownerWallet,
135
+ session_public_key: key,
136
+ });
137
+ const response = await fetch(`${apiBase.replace(/\/$/, "")}/v2/vault/status?${query.toString()}`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(10_000) });
138
+ if (!response.ok) {
139
+ lastState = `http_${response.status}`;
140
+ return null;
141
+ }
142
+ const body = await response.json();
143
+ if (body.wallet_address !== ownerWallet)
144
+ return null;
145
+ if (!body.session)
146
+ return "absent";
147
+ if (body.session.session_public_key !== key || typeof body.session.state !== "string")
148
+ return null;
149
+ return body.session.state;
150
+ };
132
151
  while (Date.now() < deadline) {
133
152
  try {
134
- const query = new URLSearchParams({
135
- wallet_address: ownerWallet,
136
- session_public_key: sessionPublicKey,
137
- });
138
- const response = await fetch(`${apiBase.replace(/\/$/, "")}/v2/vault/status?${query.toString()}`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(10_000) });
139
- if (response.ok) {
140
- const body = await response.json();
141
- if (body.wallet_address === ownerWallet) {
142
- lastState = typeof body.session?.state === "string" ? body.session.state : "absent";
143
- const exactSession = body.session?.session_public_key === sessionPublicKey;
144
- if (action === "connect" && exactSession && body.session?.state === "active")
145
- return;
146
- if (action === "disconnect" && (!body.session || (exactSession && body.session.state === "absent")))
147
- return;
148
- }
149
- }
150
- else {
151
- lastState = `http_${response.status}`;
153
+ const state = await stateFor(sessionPublicKey);
154
+ lastState = state ?? lastState;
155
+ if (action === "disconnect" && state === "absent")
156
+ return;
157
+ if (action === "connect" && state === "active") {
158
+ if (!replaceSessionPublicKey || await stateFor(replaceSessionPublicKey) === "absent")
159
+ return;
160
+ lastState = "old_session_still_active";
152
161
  }
153
162
  }
154
163
  catch (error) {
@@ -159,7 +168,7 @@ async function waitForOnChainSession(apiBase, action, ownerWallet, sessionPublic
159
168
  throw new Error(`Strata could not confirm the ${action === "connect" ? "active" : "revoked"} session on-chain `
160
169
  + `(last state: ${lastState}). The local credential was not changed.`);
161
170
  }
162
- async function waitForPairingCallback(action, sessionPublicKey, state, onComplete) {
171
+ async function waitForPairingCallback(sessionPublicKey, state, returnUrl, onComplete) {
163
172
  let settle;
164
173
  let reject;
165
174
  const completion = new Promise((resolvePromise, rejectPromise) => {
@@ -189,13 +198,13 @@ async function waitForPairingCallback(action, sessionPublicKey, state, onComplet
189
198
  finished = true;
190
199
  try {
191
200
  await onComplete(ownerWallet);
192
- response.writeHead(200, {
193
- "content-type": "text/html; charset=utf-8",
201
+ response.writeHead(303, {
202
+ location: returnUrl,
194
203
  "cache-control": "no-store",
195
204
  "x-content-type-options": "nosniff",
196
205
  "x-frame-options": "DENY",
197
206
  });
198
- response.end(successHtml(action, ownerWallet));
207
+ response.end();
199
208
  settle(ownerWallet);
200
209
  }
201
210
  catch (error) {
@@ -238,16 +247,12 @@ export async function runLocalPairing(options) {
238
247
  const env = options.env ?? process.env;
239
248
  const path = options.credentialsFile ?? tradingCredentialsPath(env);
240
249
  const existing = await readTradingConnection(path);
241
- if (options.action === "connect" && existing) {
242
- throw new Error(`Trading is already connected for wallet ${existing.owner_wallet}. `
243
- + "Run strata-mcp disconnect before replacing this session.");
244
- }
245
250
  if (options.action === "disconnect" && !existing) {
246
251
  process.stdout.write("Strata trading is not connected. Read-only tools remain ready.\n");
247
252
  return;
248
253
  }
249
254
  let generated;
250
- if (existing) {
255
+ if (options.action === "disconnect" && existing) {
251
256
  generated = existing;
252
257
  }
253
258
  else {
@@ -262,8 +267,14 @@ export async function runLocalPairing(options) {
262
267
  };
263
268
  }
264
269
  const state = randomBytes(24).toString("hex");
265
- const callback = await waitForPairingCallback(options.action, generated.session_public_key, state, async (ownerWallet) => {
266
- await waitForOnChainSession(options.apiBase ?? DEFAULT_API_BASE, options.action, ownerWallet, generated.session_public_key);
270
+ const webBase = pairingWebBase(options.webBase ?? DEFAULT_PAIRING_WEB_BASE);
271
+ const returnUrl = new URL("/agents", webBase);
272
+ returnUrl.searchParams.set("paired", options.action === "connect" ? "connected" : "revoked");
273
+ const replaceSessionPublicKey = options.action === "connect"
274
+ ? existing?.session_public_key ?? null
275
+ : null;
276
+ const callback = await waitForPairingCallback(generated.session_public_key, state, returnUrl.toString(), async (ownerWallet) => {
277
+ await waitForOnChainSession(options.apiBase ?? DEFAULT_API_BASE, options.action, ownerWallet, generated.session_public_key, replaceSessionPublicKey);
267
278
  if (options.action === "disconnect") {
268
279
  if (existing?.owner_wallet !== ownerWallet) {
269
280
  throw new Error("the revoking wallet does not own this local Strata connection");
@@ -277,14 +288,10 @@ export async function runLocalPairing(options) {
277
288
  connected_at_ms: (options.nowMs ?? Date.now)(),
278
289
  }, path);
279
290
  });
280
- const webBase = pairingWebBase(options.webBase ?? DEFAULT_PAIRING_WEB_BASE);
281
- const agentUrl = new URL("/agents", webBase);
282
- agentUrl.searchParams.set("pair", options.action);
283
- agentUrl.searchParams.set("session_public_key", generated.session_public_key);
284
- agentUrl.searchParams.set("callback", callback.callbackUrl);
285
- process.stdout.write(`${options.action === "connect" ? "Connect" : "Revoke"} Strata agent access in your browser:\n${agentUrl.toString()}\n\n`);
291
+ const agentUrl = pairingPageUrl(webBase, options.action, generated.session_public_key, callback.callbackUrl, existing);
292
+ process.stdout.write(`${options.action === "disconnect" ? "Revoke" : replaceSessionPublicKey ? "Replace" : "Connect"} Strata agent access in your browser:\n${agentUrl}\n\n`);
286
293
  if (options.openBrowser !== false)
287
- launchBrowser(agentUrl.toString());
294
+ launchBrowser(agentUrl);
288
295
  process.stdout.write("Waiting for the owner-wallet signature…\n");
289
296
  const ownerWallet = await callback.completion;
290
297
  process.stdout.write(options.action === "connect"
@@ -524,7 +524,7 @@ export async function createStrataMcpServer(options = {}) {
524
524
  },
525
525
  }, async ({ marketId, walletAddress }) => {
526
526
  const response = await platformClient.marketMaking.status(marketId, walletAddress);
527
- return toolResult(response, `${response.active_products} active maker products; reconcile intent, Strand, Current, signed-quote, and dead-man state before changing exposure.`);
527
+ return toolResult(response, `${response.active_products} active maker products; reconcile Strand, Current, signed-quote, and dead-man state before changing exposure.`);
528
528
  });
529
529
  registerTool("strata_market_making_reputation", {
530
530
  title: "Read Strata maker reputation",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratabook/mcp",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
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.13",
48
+ "@stratabook/sdk": "0.2.14",
49
49
  "zod": "^3.25.76"
50
50
  },
51
51
  "devDependencies": {