@stratabook/mcp 0.1.6 → 0.1.8
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/README.md +3 -1
- package/dist/src/generated-harness.d.ts +24 -5
- package/dist/src/generated-harness.js +30 -5
- package/dist/src/server.js +98 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ The tools currently available are:
|
|
|
35
35
|
- `strata_order_challenge`, when `orders.prepare` is enabled for MCP
|
|
36
36
|
- `strata_order_prepare`, when `orders.prepare` is enabled for MCP
|
|
37
37
|
- `strata_order_submit`, when `orders.submit` is enabled for MCP
|
|
38
|
+
- `strata_order_status`, when `orders.submit` is enabled for MCP
|
|
38
39
|
|
|
39
40
|
Every initialization response carries the compact Strata Agent Harness. The
|
|
40
41
|
server also publishes the complete harness as the
|
|
@@ -75,7 +76,8 @@ manifest at `/.well-known/strata-agent.json` and the graph at
|
|
|
75
76
|
|
|
76
77
|
The external agent owner decides what its agent may do and configures its
|
|
77
78
|
signer. MCP can request authorization bytes, prepare quote-bound trades or
|
|
78
|
-
|
|
79
|
+
atomic place, cancel, cancel-all, replace, or bounded batch order controls, and
|
|
80
|
+
submit the externally signed result. It accepts
|
|
79
81
|
public keys, detached signatures, and signed transactions, never private keys,
|
|
80
82
|
seed phrases, or wallet secrets. Amounts are token atoms encoded as base-10
|
|
81
83
|
strings.
|
|
@@ -15,7 +15,7 @@ export declare const STRATA_AGENT_HARNESS: {
|
|
|
15
15
|
readonly manifest: "https://api.stratabook.app/.well-known/strata-agent.json";
|
|
16
16
|
};
|
|
17
17
|
readonly interfaces: {
|
|
18
|
-
readonly mcp_tool_order: readonly ["strata_capabilities", "strata_action_graph", "strata_markets", "strata_quote", "strata_execution_challenge", "strata_execution_prepare", "strata_execution_submit", "strata_order_challenge", "strata_order_prepare", "strata_order_submit"];
|
|
18
|
+
readonly mcp_tool_order: readonly ["strata_capabilities", "strata_action_graph", "strata_markets", "strata_quote", "strata_execution_challenge", "strata_execution_prepare", "strata_execution_submit", "strata_order_challenge", "strata_order_prepare", "strata_order_submit", "strata_order_status"];
|
|
19
19
|
readonly terminal: readonly ["npx -y @stratabook/sdk capabilities --json", "npx -y @stratabook/sdk action-graph --json", "npx -y @stratabook/sdk markets --json", "npx -y @stratabook/sdk quote --market SOL/USDC --side sell --amount-atoms 10000000 --json"];
|
|
20
20
|
};
|
|
21
21
|
readonly workflow: readonly [{
|
|
@@ -50,10 +50,10 @@ export declare const STRATA_AGENT_HARNESS: {
|
|
|
50
50
|
readonly instruction: "Report consumed input, expected output, minimum output, fees by asset side, price impact, and remaining validity.";
|
|
51
51
|
}, {
|
|
52
52
|
readonly id: "authorize_writes";
|
|
53
|
-
readonly instruction: "When prepare and submit are exposed, keep signing external to Strata: request canonical authorization bytes, sign them with the owner-configured signer, verify the prepared transaction preserves the quote or exact opaque order set, then submit the externally signed transaction with idempotency. Resting-order control
|
|
53
|
+
readonly instruction: "When prepare and submit are exposed, keep signing external to Strata: request canonical authorization bytes, sign them with the owner-configured signer, verify the prepared transaction preserves the quote or exact opaque order set, then submit the externally signed transaction with idempotency. Resting-order control supports place, cancel, bounded cancel-all, atomic replace, and atomic heterogeneous batches of up to six operations.";
|
|
54
54
|
}, {
|
|
55
55
|
readonly id: "monitor_outcome";
|
|
56
|
-
readonly instruction: "After an authorized submission, report the durable receipt or explicit failure. Never claim completion from preparation, signing, or an unconfirmed request.";
|
|
56
|
+
readonly instruction: "After an authorized submission, report the durable receipt or explicit failure. If the request times out or either process restarts, recover it with the same control ID and idempotency key. Never claim completion from preparation, signing, or an unconfirmed request.";
|
|
57
57
|
}];
|
|
58
58
|
readonly stop_conditions: readonly ["The required live capability is disabled or absent.", "The market is paused, unavailable, or has no reviewed operation path.", "Market, side, amount, decimals, tolerance, or signer authority is unavailable or ambiguous.", "The contract version is unsupported or a response contains unknown fields.", "A quote is expired or its market, side, amount, fee, minimum-output, or time binding is inconsistent.", "A requested operation exceeds the exposed tool, account, or policy scope.", "A user asks the agent to receive or expose wallet secrets, private keys, seed phrases, session keys, or production credentials."];
|
|
59
59
|
readonly safety_rules: readonly ["Never request or accept wallet secrets, private keys, seed phrases, session keys, or production credentials in a prompt.", "Never call undocumented endpoints or reconstruct private Sonar behavior.", "Never silently widen slippage, refresh changed economics, substitute a market, or retry a non-retryable failure.", "Treat capability removal, revocation, expiry, and emergency disable as immediate stop signals.", "Capability and action-graph availability are authoritative for Strata operations; permission and signer policy remain controlled by the external agent owner."];
|
|
@@ -273,7 +273,7 @@ export declare const STRATA_ACTION_GRAPH: {
|
|
|
273
273
|
}, {
|
|
274
274
|
readonly id: "request_order_challenge";
|
|
275
275
|
readonly kind: "prepare";
|
|
276
|
-
readonly summary: "Bind a product-level place, cancel,
|
|
276
|
+
readonly summary: "Bind a product-level place, cancel, bounded cancel-all, atomic replace, or atomic batch operation to canonical authorization bytes.";
|
|
277
277
|
readonly required_capabilities: readonly ["orders.prepare"];
|
|
278
278
|
readonly available: false;
|
|
279
279
|
readonly operation: {
|
|
@@ -321,6 +321,17 @@ export declare const STRATA_ACTION_GRAPH: {
|
|
|
321
321
|
readonly summary: "Receive the opaque order IDs, transaction signature, and submitted status.";
|
|
322
322
|
readonly required_capabilities: readonly [];
|
|
323
323
|
readonly available: true;
|
|
324
|
+
}, {
|
|
325
|
+
readonly id: "recover_order_status";
|
|
326
|
+
readonly kind: "read";
|
|
327
|
+
readonly summary: "Recover durable submitting, submitted, or failed status after a timeout or restart.";
|
|
328
|
+
readonly required_capabilities: readonly ["orders.submit"];
|
|
329
|
+
readonly available: false;
|
|
330
|
+
readonly operation: {
|
|
331
|
+
readonly method: "POST";
|
|
332
|
+
readonly path: "/v2/markets/{market_id}/orders/status";
|
|
333
|
+
readonly mcp_tool: "strata_order_status";
|
|
334
|
+
};
|
|
324
335
|
}];
|
|
325
336
|
readonly edges: readonly [{
|
|
326
337
|
readonly from: "discover_capabilities";
|
|
@@ -426,7 +437,15 @@ export declare const STRATA_ACTION_GRAPH: {
|
|
|
426
437
|
readonly from: "submit_order_control";
|
|
427
438
|
readonly to: "receive_order_receipt";
|
|
428
439
|
readonly condition: "the control ID and idempotency key match";
|
|
440
|
+
}, {
|
|
441
|
+
readonly from: "submit_order_control";
|
|
442
|
+
readonly to: "recover_order_status";
|
|
443
|
+
readonly condition: "the submission result is ambiguous or either process restarted";
|
|
444
|
+
}, {
|
|
445
|
+
readonly from: "recover_order_status";
|
|
446
|
+
readonly to: "receive_order_receipt";
|
|
447
|
+
readonly condition: "durable status is submitted";
|
|
429
448
|
}];
|
|
430
449
|
};
|
|
431
450
|
export declare const STRATA_ACTION_GRAPH_URI = "strata://action-graph/v1";
|
|
432
|
-
export declare const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata Agent Harness 1.0. Start every objective with strata_capabilities, then strata_action_graph, then strata_markets. Read strata://agent-harness/v1 and strata://action-graph/v1. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Resolve the market, side, exact input atoms, and tolerance before strata_quote. Treat amounts as unsigned base-10 token atoms; check quote bindings, labelled fees, minimum output, and expiry. To execute or control a resting order: request a challenge, verify its quote or exact opaque order bindings, sign canonical authorization bytes externally, prepare, verify and sign the returned transaction externally, then submit with idempotency.
|
|
451
|
+
export declare const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata Agent Harness 1.0. Start every objective with strata_capabilities, then strata_action_graph, then strata_markets. Read strata://agent-harness/v1 and strata://action-graph/v1. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Resolve the market, side, exact input atoms, and tolerance before strata_quote. Treat amounts as unsigned base-10 token atoms; check quote bindings, labelled fees, minimum output, and expiry. To execute or control a resting order: request a challenge, verify its quote or exact opaque order bindings, sign canonical authorization bytes externally, prepare, verify and sign the returned transaction externally, then submit with idempotency. If order submission is ambiguous, recover durable status with the same control ID and idempotency key. Order control supports place, cancel, bounded cancel-all, atomic replace, and atomic heterogeneous batches of up to six operations. Stop on ambiguity, unavailable capabilities, paused markets, unsupported contracts, inconsistent bindings, expiry, or missing signer authority.";
|
|
@@ -26,7 +26,8 @@ export const STRATA_AGENT_HARNESS = {
|
|
|
26
26
|
"strata_execution_submit",
|
|
27
27
|
"strata_order_challenge",
|
|
28
28
|
"strata_order_prepare",
|
|
29
|
-
"strata_order_submit"
|
|
29
|
+
"strata_order_submit",
|
|
30
|
+
"strata_order_status"
|
|
30
31
|
],
|
|
31
32
|
"terminal": [
|
|
32
33
|
"npx -y @stratabook/sdk capabilities --json",
|
|
@@ -78,11 +79,11 @@ export const STRATA_AGENT_HARNESS = {
|
|
|
78
79
|
},
|
|
79
80
|
{
|
|
80
81
|
"id": "authorize_writes",
|
|
81
|
-
"instruction": "When prepare and submit are exposed, keep signing external to Strata: request canonical authorization bytes, sign them with the owner-configured signer, verify the prepared transaction preserves the quote or exact opaque order set, then submit the externally signed transaction with idempotency. Resting-order control
|
|
82
|
+
"instruction": "When prepare and submit are exposed, keep signing external to Strata: request canonical authorization bytes, sign them with the owner-configured signer, verify the prepared transaction preserves the quote or exact opaque order set, then submit the externally signed transaction with idempotency. Resting-order control supports place, cancel, bounded cancel-all, atomic replace, and atomic heterogeneous batches of up to six operations."
|
|
82
83
|
},
|
|
83
84
|
{
|
|
84
85
|
"id": "monitor_outcome",
|
|
85
|
-
"instruction": "After an authorized submission, report the durable receipt or explicit failure. Never claim completion from preparation, signing, or an unconfirmed request."
|
|
86
|
+
"instruction": "After an authorized submission, report the durable receipt or explicit failure. If the request times out or either process restarts, recover it with the same control ID and idempotency key. Never claim completion from preparation, signing, or an unconfirmed request."
|
|
86
87
|
}
|
|
87
88
|
],
|
|
88
89
|
"stop_conditions": [
|
|
@@ -367,7 +368,7 @@ export const STRATA_ACTION_GRAPH = {
|
|
|
367
368
|
{
|
|
368
369
|
"id": "request_order_challenge",
|
|
369
370
|
"kind": "prepare",
|
|
370
|
-
"summary": "Bind a product-level place, cancel,
|
|
371
|
+
"summary": "Bind a product-level place, cancel, bounded cancel-all, atomic replace, or atomic batch operation to canonical authorization bytes.",
|
|
371
372
|
"required_capabilities": [
|
|
372
373
|
"orders.prepare"
|
|
373
374
|
],
|
|
@@ -426,6 +427,20 @@ export const STRATA_ACTION_GRAPH = {
|
|
|
426
427
|
"summary": "Receive the opaque order IDs, transaction signature, and submitted status.",
|
|
427
428
|
"required_capabilities": [],
|
|
428
429
|
"available": true
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"id": "recover_order_status",
|
|
433
|
+
"kind": "read",
|
|
434
|
+
"summary": "Recover durable submitting, submitted, or failed status after a timeout or restart.",
|
|
435
|
+
"required_capabilities": [
|
|
436
|
+
"orders.submit"
|
|
437
|
+
],
|
|
438
|
+
"available": false,
|
|
439
|
+
"operation": {
|
|
440
|
+
"method": "POST",
|
|
441
|
+
"path": "/v2/markets/{market_id}/orders/status",
|
|
442
|
+
"mcp_tool": "strata_order_status"
|
|
443
|
+
}
|
|
429
444
|
}
|
|
430
445
|
],
|
|
431
446
|
"edges": [
|
|
@@ -558,8 +573,18 @@ export const STRATA_ACTION_GRAPH = {
|
|
|
558
573
|
"from": "submit_order_control",
|
|
559
574
|
"to": "receive_order_receipt",
|
|
560
575
|
"condition": "the control ID and idempotency key match"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"from": "submit_order_control",
|
|
579
|
+
"to": "recover_order_status",
|
|
580
|
+
"condition": "the submission result is ambiguous or either process restarted"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"from": "recover_order_status",
|
|
584
|
+
"to": "receive_order_receipt",
|
|
585
|
+
"condition": "durable status is submitted"
|
|
561
586
|
}
|
|
562
587
|
]
|
|
563
588
|
};
|
|
564
589
|
export const STRATA_ACTION_GRAPH_URI = "strata://action-graph/v1";
|
|
565
|
-
export const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata Agent Harness 1.0. Start every objective with strata_capabilities, then strata_action_graph, then strata_markets. Read strata://agent-harness/v1 and strata://action-graph/v1. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Resolve the market, side, exact input atoms, and tolerance before strata_quote. Treat amounts as unsigned base-10 token atoms; check quote bindings, labelled fees, minimum output, and expiry. To execute or control a resting order: request a challenge, verify its quote or exact opaque order bindings, sign canonical authorization bytes externally, prepare, verify and sign the returned transaction externally, then submit with idempotency.
|
|
590
|
+
export const STRATA_AGENT_HARNESS_INSTRUCTIONS = "Strata Agent Harness 1.0. Start every objective with strata_capabilities, then strata_action_graph, then strata_markets. Read strata://agent-harness/v1 and strata://action-graph/v1. The external agent owner controls permission and signer authority. Strata accepts public keys, detached signatures, and signed transactions, never private keys or seed phrases. Resolve the market, side, exact input atoms, and tolerance before strata_quote. Treat amounts as unsigned base-10 token atoms; check quote bindings, labelled fees, minimum output, and expiry. To execute or control a resting order: request a challenge, verify its quote or exact opaque order bindings, sign canonical authorization bytes externally, prepare, verify and sign the returned transaction externally, then submit with idempotency. If order submission is ambiguous, recover durable status with the same control ID and idempotency key. Order control supports place, cancel, bounded cancel-all, atomic replace, and atomic heterogeneous batches of up to six operations. Stop on ambiguity, unavailable capabilities, paused markets, unsupported contracts, inconsistent bindings, expiry, or missing signer authority.";
|
package/dist/src/server.js
CHANGED
|
@@ -182,7 +182,7 @@ export async function createStrataMcpServer(options = {}) {
|
|
|
182
182
|
};
|
|
183
183
|
const response = await client.quote(request);
|
|
184
184
|
return toolResult(response, `Sonar ${response.side} quote: ${response.amount_in_consumed_atoms} input atoms `
|
|
185
|
-
+ `for ${response.amount_out_atoms} output atoms; minimum `
|
|
185
|
+
+ `for ${response.amount_out_atoms} user-net output atoms; user-net minimum `
|
|
186
186
|
+ `${response.minimum_output_atoms}; expires at ${response.expires_at_ms}.`);
|
|
187
187
|
}));
|
|
188
188
|
const executionChallenge = server.registerTool("strata_execution_challenge", {
|
|
@@ -291,10 +291,10 @@ export async function createStrataMcpServer(options = {}) {
|
|
|
291
291
|
}));
|
|
292
292
|
const orderChallenge = server.registerTool("strata_order_challenge", {
|
|
293
293
|
title: "Strata order challenge",
|
|
294
|
-
description: "Bind
|
|
294
|
+
description: "Bind an atomic place, cancel, cancel-all, replace, or bounded batch request to canonical bytes for the agent owner's external signer.",
|
|
295
295
|
inputSchema: {
|
|
296
296
|
marketId: z.string().regex(/^market_[0-9a-f]{32}$/),
|
|
297
|
-
action: z.enum(["place", "cancel", "cancel_all"]),
|
|
297
|
+
action: z.enum(["place", "cancel", "cancel_all", "replace", "batch"]),
|
|
298
298
|
ownerWallet: z.string().min(32).max(44),
|
|
299
299
|
sessionPublicKey: z.string().min(32).max(44),
|
|
300
300
|
accountSequence: z.string().regex(/^[0-9]+$/).max(20).optional(),
|
|
@@ -304,6 +304,16 @@ export async function createStrataMcpServer(options = {}) {
|
|
|
304
304
|
limitPriceAtoms: z.string().regex(/^[1-9][0-9]*$/).max(20).optional(),
|
|
305
305
|
sizeAtoms: z.string().regex(/^[1-9][0-9]*$/).max(20).optional(),
|
|
306
306
|
orderId: z.string().regex(/^order_[0-9a-f]{32}$/).optional(),
|
|
307
|
+
operations: z.array(z.object({
|
|
308
|
+
action: z.enum(["place", "cancel", "replace"]),
|
|
309
|
+
accountSequence: z.string().regex(/^[0-9]+$/).max(20).optional(),
|
|
310
|
+
clientOrderId: z.string().min(1).max(64).regex(/^[A-Za-z0-9._-]+$/).optional(),
|
|
311
|
+
side: z.enum(["buy", "sell"]).optional(),
|
|
312
|
+
orderType: z.enum(["good_until_cancelled", "post_only"]).optional(),
|
|
313
|
+
limitPriceAtoms: z.string().regex(/^[1-9][0-9]*$/).max(20).optional(),
|
|
314
|
+
sizeAtoms: z.string().regex(/^[1-9][0-9]*$/).max(20).optional(),
|
|
315
|
+
orderId: z.string().regex(/^order_[0-9a-f]{32}$/).optional(),
|
|
316
|
+
}).strict()).min(1).max(6).optional(),
|
|
307
317
|
},
|
|
308
318
|
annotations: {
|
|
309
319
|
readOnlyHint: false,
|
|
@@ -345,13 +355,77 @@ export async function createStrataMcpServer(options = {}) {
|
|
|
345
355
|
orderId: args.orderId,
|
|
346
356
|
};
|
|
347
357
|
}
|
|
348
|
-
else {
|
|
358
|
+
else if (args.action === "cancel_all") {
|
|
349
359
|
request = {
|
|
350
360
|
action: "cancel_all",
|
|
351
361
|
ownerWallet: args.ownerWallet,
|
|
352
362
|
sessionPublicKey: args.sessionPublicKey,
|
|
353
363
|
};
|
|
354
364
|
}
|
|
365
|
+
else if (args.action === "replace") {
|
|
366
|
+
if (args.orderId === undefined
|
|
367
|
+
|| args.accountSequence === undefined
|
|
368
|
+
|| args.clientOrderId === undefined
|
|
369
|
+
|| args.side === undefined
|
|
370
|
+
|| args.orderType === undefined
|
|
371
|
+
|| args.limitPriceAtoms === undefined
|
|
372
|
+
|| args.sizeAtoms === undefined) {
|
|
373
|
+
return toolError("invalid_request", "Replace requires orderId, accountSequence, clientOrderId, side, orderType, limitPriceAtoms, and sizeAtoms.", false);
|
|
374
|
+
}
|
|
375
|
+
request = {
|
|
376
|
+
action: "replace",
|
|
377
|
+
ownerWallet: args.ownerWallet,
|
|
378
|
+
sessionPublicKey: args.sessionPublicKey,
|
|
379
|
+
orderId: args.orderId,
|
|
380
|
+
accountSequence: args.accountSequence,
|
|
381
|
+
clientOrderId: args.clientOrderId,
|
|
382
|
+
side: args.side,
|
|
383
|
+
orderType: args.orderType,
|
|
384
|
+
limitPriceAtoms: args.limitPriceAtoms,
|
|
385
|
+
sizeAtoms: args.sizeAtoms,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
if (args.operations === undefined) {
|
|
390
|
+
return toolError("invalid_request", "Batch requires operations.", false);
|
|
391
|
+
}
|
|
392
|
+
const operations = [];
|
|
393
|
+
for (const operation of args.operations) {
|
|
394
|
+
if (operation.action === "cancel") {
|
|
395
|
+
if (operation.orderId === undefined) {
|
|
396
|
+
return toolError("invalid_request", "Batch cancel requires orderId.", false);
|
|
397
|
+
}
|
|
398
|
+
operations.push({ action: "cancel", orderId: operation.orderId });
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
if (operation.accountSequence === undefined
|
|
402
|
+
|| operation.clientOrderId === undefined
|
|
403
|
+
|| operation.side === undefined
|
|
404
|
+
|| operation.orderType === undefined
|
|
405
|
+
|| operation.limitPriceAtoms === undefined
|
|
406
|
+
|| operation.sizeAtoms === undefined
|
|
407
|
+
|| (operation.action === "replace" && operation.orderId === undefined)) {
|
|
408
|
+
return toolError("invalid_request", `Batch ${operation.action} has incomplete fields.`, false);
|
|
409
|
+
}
|
|
410
|
+
const place = {
|
|
411
|
+
accountSequence: operation.accountSequence,
|
|
412
|
+
clientOrderId: operation.clientOrderId,
|
|
413
|
+
side: operation.side,
|
|
414
|
+
orderType: operation.orderType,
|
|
415
|
+
limitPriceAtoms: operation.limitPriceAtoms,
|
|
416
|
+
sizeAtoms: operation.sizeAtoms,
|
|
417
|
+
};
|
|
418
|
+
operations.push(operation.action === "replace"
|
|
419
|
+
? { action: "replace", orderId: operation.orderId, ...place }
|
|
420
|
+
: { action: "place", ...place });
|
|
421
|
+
}
|
|
422
|
+
request = {
|
|
423
|
+
action: "batch",
|
|
424
|
+
ownerWallet: args.ownerWallet,
|
|
425
|
+
sessionPublicKey: args.sessionPublicKey,
|
|
426
|
+
operations,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
355
429
|
const response = await platformClient.orders.challenge(args.marketId, request);
|
|
356
430
|
return toolResult(response, `Order challenge ${response.challenge_id} binds ${response.order_ids.length} opaque order ID(s); expires at ${response.expires_at_ms}.`);
|
|
357
431
|
}));
|
|
@@ -407,6 +481,24 @@ export async function createStrataMcpServer(options = {}) {
|
|
|
407
481
|
});
|
|
408
482
|
return toolResult(response, `Submitted ${response.action} control ${response.order_control_id} as ${response.signature}.`);
|
|
409
483
|
}));
|
|
484
|
+
const orderStatus = server.registerTool("strata_order_status", {
|
|
485
|
+
title: "Read Strata order-control status",
|
|
486
|
+
description: "Recover the durable result for an externally signed order submission after a timeout or restart.",
|
|
487
|
+
inputSchema: {
|
|
488
|
+
marketId: z.string().regex(/^market_[0-9a-f]{32}$/),
|
|
489
|
+
orderControlId: z.string().regex(/^or_[0-9a-f]{32}$/),
|
|
490
|
+
idempotencyKey: z.string().min(1).max(64).regex(/^[A-Za-z0-9._-]+$/),
|
|
491
|
+
},
|
|
492
|
+
annotations: {
|
|
493
|
+
readOnlyHint: true,
|
|
494
|
+
destructiveHint: false,
|
|
495
|
+
idempotentHint: true,
|
|
496
|
+
openWorldHint: true,
|
|
497
|
+
},
|
|
498
|
+
}, async ({ marketId, orderControlId, idempotencyKey }) => guardedTool(client, "orders.submit", async () => {
|
|
499
|
+
const response = await platformClient.orders.status(marketId, { orderControlId, idempotencyKey });
|
|
500
|
+
return toolResult(response, `Order control ${response.order_control_id} is ${response.status}.`);
|
|
501
|
+
}));
|
|
410
502
|
const handles = {
|
|
411
503
|
markets,
|
|
412
504
|
quote,
|
|
@@ -416,6 +508,7 @@ export async function createStrataMcpServer(options = {}) {
|
|
|
416
508
|
orderChallenge,
|
|
417
509
|
orderPrepare,
|
|
418
510
|
orderSubmit,
|
|
511
|
+
orderStatus,
|
|
419
512
|
};
|
|
420
513
|
applyCapabilityCatalog(handles, initialCatalog);
|
|
421
514
|
let closed = false;
|
|
@@ -449,6 +542,7 @@ function applyCapabilityCatalog(handles, catalog) {
|
|
|
449
542
|
setToolEnabled(handles.orderChallenge, capabilityAvailable(catalog, "orders.prepare"));
|
|
450
543
|
setToolEnabled(handles.orderPrepare, capabilityAvailable(catalog, "orders.prepare"));
|
|
451
544
|
setToolEnabled(handles.orderSubmit, capabilityAvailable(catalog, "orders.submit"));
|
|
545
|
+
setToolEnabled(handles.orderStatus, capabilityAvailable(catalog, "orders.submit"));
|
|
452
546
|
}
|
|
453
547
|
function setToolEnabled(tool, enabled) {
|
|
454
548
|
if (enabled)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratabook/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
47
|
-
"@stratabook/sdk": "0.1.
|
|
47
|
+
"@stratabook/sdk": "0.1.7",
|
|
48
48
|
"zod": "^3.25.76"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|