@stratabook/mcp 0.2.16 → 0.2.17

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.17
7
+
8
+ - Consume the matching strategy-timed TypeScript SDK and allow an optional
9
+ zero cadence floor in advanced setup calls.
10
+ - Keep the local pairing listener alive longer and close its helper tab after
11
+ credentials are saved, with a branded Strata return page as the fallback.
12
+
6
13
  ## 0.2.16
7
14
 
8
15
  - Consume the matching TypeScript SDK 0.2.16 packaging-parity release. MCP
package/README.md CHANGED
@@ -1,20 +1,46 @@
1
+ <p align="center">
2
+ <a href="https://stratabook.app">
3
+ <img src="https://raw.githubusercontent.com/alsk1992/strata-mcp/main/assets/readme-hero.svg?v=20260826-2" alt="Strata MCP — The deepest book in DeFi" width="100%" />
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://stratabook.app">Trade</a> ·
9
+ <a href="https://stratabook.org/docs/agent-mcp">Docs</a> ·
10
+ <a href="https://www.npmjs.com/package/@stratabook/mcp">npm</a> ·
11
+ <a href="https://api.stratabook.app/mcp">Hosted MCP</a>
12
+ </p>
13
+
1
14
  # Strata MCP
2
15
 
3
- Official MCP access to Strata and Sonar for every MCP-compatible client. It is
4
- not tied to Codex, Claude, Cursor, or any other host. The server delegates to
5
- `@stratabook/sdk` and follows Strata's live public policy.
16
+ Give any MCP-compatible agent direct access to Strata markets and Sonar. It
17
+ works across Claude Desktop, Cursor, Windsurf, Codex and any standards-based
18
+ MCP host.
19
+
20
+ Read-only access works immediately. No wallet, API key, session key, environment
21
+ variable or settings screen is required to explore markets, books, prices,
22
+ candles, trades, quotes and public maker data.
23
+
24
+ | How you connect | Best for | What stays private |
25
+ | --- | --- | --- |
26
+ | Hosted: `https://api.stratabook.app/mcp` | Instant reads, Sonar quotes and externally signed prepare/submit flows | The shared server never receives a session secret |
27
+ | Local: `npx -y @stratabook/mcp` | Reads now; optional one-call trading after `connect` | The session secret remains in a mode-0600 file on the user's machine |
28
+
29
+ Intent, Strand and Current controls are live. A connected local MCP can execute
30
+ session-backed trades, orders, TWAPs and Intent updates in one call. The hosted
31
+ shared MCP exposes Intent prepare/submit instead because it deliberately never
32
+ stores a user's session secret. Current tracks Strata's live mark automatically.
6
33
 
7
- The official hosted endpoint currently exposes market, exact-output, and
8
- asset-to-asset Sonar quotes, together with quote-bound execution tools.
9
- "Capability gated" simply means a tool disappears if Strata disables that
10
- operation live. It does **not** mean quotes need activation or user setup.
34
+ Tool availability follows Strata's live safety policy. If an operation is
35
+ paused, its tool disappears immediately; everyday reads and quotes require no
36
+ activation.
11
37
 
12
38
  The default tool mode is deliberately compact. Agents call the requested tool
13
39
  directly instead of burning discovery calls before a quote. Use
14
40
  `--mode advanced` (or `STRATA_MCP_MODE=advanced`) only when an integration
15
41
  needs the explicit challenge / prepare / submit protocol tools.
16
42
 
17
- ## Local stdio
43
+ ## Start locally
18
44
 
19
45
  Read-only use needs no wallet, key, autonomy setting, or environment variable:
20
46
 
@@ -167,8 +193,8 @@ original confirmed signature while the packet remains live.
167
193
  For maker funding, initialize the market Vault if needed, activate the Strand
168
194
  or Current, then deposit with `strata_vault_deposit`. The market keeps that
169
195
  available collateral while a control is live and returns it after the final
170
- control is disabled, exhausted, expired, or cancelled. Current follows Strata's
171
- live mark and needs no separate publisher transaction.
196
+ control is disabled, exhausted, expired, or cancelled. Current tracks Strata's
197
+ live mark automatically.
172
198
 
173
199
  The matching TypeScript package ships `strata-maker-conformance`. Its default
174
200
  `safe` mode exercises this hosted MCP's discovery, public maker reads, and
@@ -17,6 +17,8 @@ export interface PairingOptions {
17
17
  readonly env?: Readonly<Record<string, string | undefined>>;
18
18
  readonly nowMs?: () => number;
19
19
  }
20
+ /** Local success page: close the helper tab when allowed, otherwise return to Strata. */
21
+ export declare function pairingCompletionDocument(returnUrl: string): string;
20
22
  export declare function tradingCredentialsPath(env?: Readonly<Record<string, string | undefined>>, platform?: NodeJS.Platform, home?: string): string;
21
23
  export declare function readTradingConnection(path?: string): Promise<StoredTradingConnection | null>;
22
24
  export declare function writeTradingConnection(connection: StoredTradingConnection, path?: string): Promise<void>;
@@ -7,8 +7,18 @@ import { dirname, join, resolve } from "node:path";
7
7
  import { DEFAULT_API_BASE, generateSessionKeypair, } from "@stratabook/sdk";
8
8
  const PUBLIC_KEY_PATTERN = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
9
9
  const SECRET_KEY_PATTERN = /^[1-9A-HJ-NP-Za-km-z]{80,90}$/;
10
- const PAIRING_TIMEOUT_MS = 10 * 60_000;
10
+ const PAIRING_TIMEOUT_MS = 30 * 60_000;
11
11
  export const DEFAULT_PAIRING_WEB_BASE = "https://stratabook.app";
12
+ /** Local success page: close the helper tab when allowed, otherwise return to Strata. */
13
+ export function pairingCompletionDocument(returnUrl) {
14
+ const destination = JSON.stringify(returnUrl).replaceAll("<", "\\u003c");
15
+ return `<!doctype html>
16
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
17
+ <title>Agent connected · Strata</title><style>
18
+ :root{color-scheme:dark}body{margin:0;min-height:100vh;display:grid;place-items:center;background:#090b10;color:#f4f7fa;font:16px/1.5 system-ui,sans-serif}.card{max-width:34rem;margin:2rem;padding:2rem;border:1px solid #1b8596;border-radius:18px;background:linear-gradient(135deg,#0c171d,#100d1e)}h1{margin:.25rem 0 .5rem;font-size:1.7rem}p{margin:0;color:#aeb8c5}.mark{color:#34d6c4;font-weight:700;letter-spacing:.08em;text-transform:uppercase;font-size:.75rem}
19
+ </style></head><body><main class="card"><div class="mark">Strata</div><h1>Agent connected</h1><p>Your local credential is saved. You can close this tab.</p></main>
20
+ <script>const destination=${destination};window.close();setTimeout(()=>location.replace(destination),700);</script></body></html>`;
21
+ }
12
22
  function validPublicKey(value) {
13
23
  return typeof value === "string" && PUBLIC_KEY_PATTERN.test(value);
14
24
  }
@@ -198,13 +208,17 @@ async function waitForPairingCallback(sessionPublicKey, state, returnUrl, onComp
198
208
  finished = true;
199
209
  try {
200
210
  await onComplete(ownerWallet);
201
- response.writeHead(303, {
202
- location: returnUrl,
211
+ const document = pairingCompletionDocument(returnUrl);
212
+ response.writeHead(200, {
213
+ "content-type": "text/html; charset=utf-8",
214
+ "content-length": Buffer.byteLength(document),
203
215
  "cache-control": "no-store",
216
+ "content-security-policy": "default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; base-uri 'none'; frame-ancestors 'none'",
217
+ "referrer-policy": "no-referrer",
204
218
  "x-content-type-options": "nosniff",
205
219
  "x-frame-options": "DENY",
206
220
  });
207
- response.end();
221
+ response.end(document);
208
222
  settle(ownerWallet);
209
223
  }
210
224
  catch (error) {
@@ -234,7 +248,7 @@ async function waitForPairingCallback(sessionPublicKey, state, returnUrl, onComp
234
248
  return;
235
249
  finished = true;
236
250
  server.close();
237
- reject(new Error("Strata pairing timed out after 10 minutes"));
251
+ reject(new Error("Strata pairing timed out after 30 minutes"));
238
252
  }, PAIRING_TIMEOUT_MS);
239
253
  timeout.unref();
240
254
  completion.finally(() => clearTimeout(timeout)).catch(() => undefined);
@@ -939,7 +939,7 @@ export async function createStrataMcpServer(options = {}) {
939
939
  .max(4)
940
940
  .optional(),
941
941
  expiresAtMs: z.number().int().positive().optional(),
942
- minimumIntervalSeconds: z.number().int().min(1).max(86_400).optional(),
942
+ minimumIntervalSeconds: z.number().int().min(0).max(86_400).optional(),
943
943
  maximumToleranceBps: z.number().int().min(1).max(1_000).optional(),
944
944
  },
945
945
  annotations: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratabook/mcp",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
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.16",
48
+ "@stratabook/sdk": "0.2.17",
49
49
  "zod": "^3.25.76"
50
50
  },
51
51
  "devDependencies": {