@buildaureon/mcp 0.1.1 → 0.1.7
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 +399 -399
- package/dist/index.js +330 -8
- package/dist/index.js.map +1 -1
- package/docs/agent-guide.md +186 -2
- package/docs/auth.md +2 -2
- package/docs/setup.md +3 -3
- package/docs/tools.md +219 -7
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import { DEFAULT_API_BASE_URL, createSessionTokenProvider, createAureonClient, isAureonError } from '@buildaureon/sdk';
|
|
4
|
+
import { DEFAULT_API_BASE_URL, createSessionTokenProvider, createAureonClient, validateExecutionReceipt, isAureonError } from '@buildaureon/sdk';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
function loadConfig() {
|
|
@@ -68,6 +68,18 @@ function registerReadTools(server, client) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
|
+
server.tool(
|
|
72
|
+
"aureon_get_allocation_vs_target",
|
|
73
|
+
"Objective vs actual portfolio \u2014 current weight vs policy target per objective, plus green-book/off-plan paradox flag",
|
|
74
|
+
{},
|
|
75
|
+
async () => {
|
|
76
|
+
try {
|
|
77
|
+
return ok(await client.getAllocationVsTarget());
|
|
78
|
+
} catch (err) {
|
|
79
|
+
return fail(err);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
71
83
|
server.tool(
|
|
72
84
|
"aureon_get_portfolio",
|
|
73
85
|
"Current capital book snapshot \u2014 positions, marks, weights",
|
|
@@ -151,7 +163,7 @@ function registerCompassTools(server, client) {
|
|
|
151
163
|
);
|
|
152
164
|
server.tool(
|
|
153
165
|
"aureon_run_execution",
|
|
154
|
-
"Run restorative execution for an objective
|
|
166
|
+
"Run restorative execution for an objective outside policy. Read receipt.settlement and receipt.verifiedOnChain \u2014 staged = never on-chain; vault + verifiedOnChain = chain-observed; vault without verified = submitted but not yet observed.",
|
|
155
167
|
{ objectiveId: z.string().describe("The objective ID") },
|
|
156
168
|
async ({ objectiveId }) => {
|
|
157
169
|
try {
|
|
@@ -163,7 +175,7 @@ function registerCompassTools(server, client) {
|
|
|
163
175
|
);
|
|
164
176
|
server.tool(
|
|
165
177
|
"aureon_restore_objective",
|
|
166
|
-
"Run
|
|
178
|
+
"Run restorative execution for an objective outside policy. Not always vault-backed: read settlement and verifiedOnChain. staged is never on-chain. vault without verifiedOnChain is submitted, not proven. Returns ExecutionReceipt.",
|
|
167
179
|
{ objectiveId: z.string().describe("The objective ID") },
|
|
168
180
|
async ({ objectiveId }) => {
|
|
169
181
|
try {
|
|
@@ -175,7 +187,7 @@ function registerCompassTools(server, client) {
|
|
|
175
187
|
);
|
|
176
188
|
server.tool(
|
|
177
189
|
"aureon_list_executions",
|
|
178
|
-
"Recent execution receipts \u2014
|
|
190
|
+
"Recent execution receipts \u2014 read settlement, verifiedOnChain, settlementRecord, explorerUrl, registryRef.",
|
|
179
191
|
{ objectiveId: z.string().optional().describe("Filter by objective ID (omit for all)") },
|
|
180
192
|
async ({ objectiveId }) => {
|
|
181
193
|
try {
|
|
@@ -327,6 +339,176 @@ var objectiveKind = z.enum([
|
|
|
327
339
|
"reward_reinvestment"
|
|
328
340
|
]);
|
|
329
341
|
var objectivePriority = z.enum(["low", "medium", "high", "critical"]);
|
|
342
|
+
function registerIntentTools(server, client) {
|
|
343
|
+
server.tool(
|
|
344
|
+
"aureon_apply_financial_intent",
|
|
345
|
+
"Register user/agent intent as an Automatic objective and return AI \u2192 objective \u2192 portfolio flow",
|
|
346
|
+
{
|
|
347
|
+
brief: z.string().describe("What the user wants their money to do \u2014 agent-extracted wording"),
|
|
348
|
+
kind: objectiveKind.describe("Objective kind"),
|
|
349
|
+
targetWeight: z.number().describe("Target portfolio weight (0\u20131)"),
|
|
350
|
+
tolerance: z.number().describe("Allowed drift band (0\u20131)"),
|
|
351
|
+
targetSymbol: z.string().optional().describe("Asset symbol for balanced_portfolio (required for that kind)"),
|
|
352
|
+
name: z.string().optional().describe("Objective display name override"),
|
|
353
|
+
priority: objectivePriority.optional().describe("Evaluation priority")
|
|
354
|
+
},
|
|
355
|
+
async (input) => {
|
|
356
|
+
try {
|
|
357
|
+
return ok(await client.applyFinancialIntent(input));
|
|
358
|
+
} catch (err) {
|
|
359
|
+
return fail(err);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
server.tool(
|
|
364
|
+
"aureon_get_objective_portfolio_flow",
|
|
365
|
+
"Read AI \u2192 objective \u2192 portfolio flow for active objectives",
|
|
366
|
+
{
|
|
367
|
+
objectiveId: z.string().optional().describe("Filter to one objective (omit for all active)")
|
|
368
|
+
},
|
|
369
|
+
async ({ objectiveId }) => {
|
|
370
|
+
try {
|
|
371
|
+
return ok(await client.getObjectivePortfolioFlow(objectiveId));
|
|
372
|
+
} catch (err) {
|
|
373
|
+
return fail(err);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
function registerDriftRestoreTools(server, client) {
|
|
379
|
+
server.tool(
|
|
380
|
+
"aureon_run_drift_restore_demo",
|
|
381
|
+
"Run drift \u2192 detection \u2192 restore demo (seed book, break rule, manual restore)",
|
|
382
|
+
{},
|
|
383
|
+
async () => {
|
|
384
|
+
try {
|
|
385
|
+
return ok(await client.runDriftRestoreDemo());
|
|
386
|
+
} catch (err) {
|
|
387
|
+
return fail(err);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
server.tool(
|
|
392
|
+
"aureon_get_drift_restore_flow",
|
|
393
|
+
"Read drift \u2192 detection \u2192 restore flow for active objectives",
|
|
394
|
+
{
|
|
395
|
+
objectiveId: z.string().optional().describe("Filter to one objective (omit for all active)")
|
|
396
|
+
},
|
|
397
|
+
async ({ objectiveId }) => {
|
|
398
|
+
try {
|
|
399
|
+
return ok(await client.getDriftRestoreFlow(objectiveId));
|
|
400
|
+
} catch (err) {
|
|
401
|
+
return fail(err);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
function registerReceiptVerificationTools(server, client) {
|
|
407
|
+
server.tool(
|
|
408
|
+
"aureon_run_receipt_verification_demo",
|
|
409
|
+
"Run receipt \u2192 verification demo (restore + validate receipt + settlement lookup)",
|
|
410
|
+
{},
|
|
411
|
+
async () => {
|
|
412
|
+
try {
|
|
413
|
+
return ok(await client.runReceiptVerificationDemo());
|
|
414
|
+
} catch (err) {
|
|
415
|
+
return fail(err);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
server.tool(
|
|
420
|
+
"aureon_get_receipt_verification_flow",
|
|
421
|
+
"Read receipt \u2192 verification flow for execution receipts",
|
|
422
|
+
{
|
|
423
|
+
executionId: z.string().optional().describe("Filter to one execution id (omit for five most recent)")
|
|
424
|
+
},
|
|
425
|
+
async ({ executionId }) => {
|
|
426
|
+
try {
|
|
427
|
+
return ok(await client.getReceiptVerificationFlow(executionId));
|
|
428
|
+
} catch (err) {
|
|
429
|
+
return fail(err);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
var agentHost = z.enum(["cursor", "claude", "mcp"]);
|
|
435
|
+
function registerPortfolioWatchTools(server, client) {
|
|
436
|
+
server.tool(
|
|
437
|
+
"aureon_run_portfolio_watch_demo",
|
|
438
|
+
"Run portfolio watch demo (brief \u2192 Automatic objective \u2192 while-away event \u2192 return briefing)",
|
|
439
|
+
{
|
|
440
|
+
brief: z.string().optional().describe(
|
|
441
|
+
"User wording \u2014 default: Watch my portfolio while I'm away \u2014 keep about 20% in stable assets."
|
|
442
|
+
),
|
|
443
|
+
host: agentHost.optional().describe("Agent host label for briefing (cursor | claude | mcp)")
|
|
444
|
+
},
|
|
445
|
+
async ({ brief, host }) => {
|
|
446
|
+
try {
|
|
447
|
+
return ok(await client.runPortfolioWatchDemo({ brief, host }));
|
|
448
|
+
} catch (err) {
|
|
449
|
+
return fail(err);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
);
|
|
453
|
+
server.tool(
|
|
454
|
+
"aureon_get_portfolio_watch_flow",
|
|
455
|
+
"Read portfolio watch briefing for Automatic objectives",
|
|
456
|
+
{
|
|
457
|
+
objectiveId: z.string().optional().describe("Filter to one objective (omit for all Automatic)"),
|
|
458
|
+
brief: z.string().optional().describe("User brief for briefing lines"),
|
|
459
|
+
host: agentHost.optional().describe("Agent host label")
|
|
460
|
+
},
|
|
461
|
+
async ({ objectiveId, brief, host }) => {
|
|
462
|
+
try {
|
|
463
|
+
return ok(
|
|
464
|
+
await client.getPortfolioWatchFlow({ objectiveId, brief, host })
|
|
465
|
+
);
|
|
466
|
+
} catch (err) {
|
|
467
|
+
return fail(err);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
function registerFullAureonLoopTools(server, client) {
|
|
473
|
+
server.tool(
|
|
474
|
+
"aureon_run_full_aureon_loop_demo",
|
|
475
|
+
"Run Content Arc full AUREON loop (intent \u2192 plan check \u2192 restore \u2192 receipt verification)",
|
|
476
|
+
{
|
|
477
|
+
brief: z.string().optional().describe(
|
|
478
|
+
"User wording \u2014 default: Keep about 20% in stable assets \u2014 grow the book without abandoning the plan."
|
|
479
|
+
)
|
|
480
|
+
},
|
|
481
|
+
async ({ brief }) => {
|
|
482
|
+
try {
|
|
483
|
+
return ok(await client.runFullAureonLoopDemo({ brief }));
|
|
484
|
+
} catch (err) {
|
|
485
|
+
return fail(err);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
);
|
|
489
|
+
server.tool(
|
|
490
|
+
"aureon_get_full_aureon_loop_flow",
|
|
491
|
+
"Read full AUREON loop for active objectives with a latest execution receipt",
|
|
492
|
+
{
|
|
493
|
+
objectiveId: z.string().optional().describe("Filter to one objective (omit for all active with receipts)"),
|
|
494
|
+
brief: z.string().optional().describe("User brief for teaching shape")
|
|
495
|
+
},
|
|
496
|
+
async ({ objectiveId, brief }) => {
|
|
497
|
+
try {
|
|
498
|
+
return ok(await client.getFullAureonLoopFlow({ objectiveId, brief }));
|
|
499
|
+
} catch (err) {
|
|
500
|
+
return fail(err);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
var objectiveKind2 = z.enum([
|
|
506
|
+
"stable_allocation",
|
|
507
|
+
"balanced_portfolio",
|
|
508
|
+
"risk_ceiling",
|
|
509
|
+
"reward_reinvestment"
|
|
510
|
+
]);
|
|
511
|
+
var objectivePriority2 = z.enum(["low", "medium", "high", "critical"]);
|
|
330
512
|
var automationMode = z.enum(["auto", "manual"]);
|
|
331
513
|
function registerObjectiveTools(server, client) {
|
|
332
514
|
server.tool(
|
|
@@ -334,10 +516,10 @@ function registerObjectiveTools(server, client) {
|
|
|
334
516
|
"Create a Financial Compass Objective. targetSymbol and automationMode are locked after create \u2014 recreate to change them. Defaults to automationMode auto.",
|
|
335
517
|
{
|
|
336
518
|
name: z.string().describe("Objective display name"),
|
|
337
|
-
kind:
|
|
519
|
+
kind: objectiveKind2.describe("Objective kind"),
|
|
338
520
|
targetWeight: z.number().describe("Target portfolio weight (0\u20131)"),
|
|
339
521
|
tolerance: z.number().describe("Allowed drift band (0\u20131)"),
|
|
340
|
-
priority:
|
|
522
|
+
priority: objectivePriority2.optional().describe("Evaluation priority"),
|
|
341
523
|
maxRiskScore: z.number().optional().describe("Max risk score ceiling"),
|
|
342
524
|
reinvestRatio: z.number().optional().describe("Reinvest ratio for reward objectives"),
|
|
343
525
|
targetSymbol: z.string().nullable().optional().describe("Asset symbol to track (locked after create)"),
|
|
@@ -357,7 +539,7 @@ function registerObjectiveTools(server, client) {
|
|
|
357
539
|
{
|
|
358
540
|
objectiveId: z.string().describe("Objective ID"),
|
|
359
541
|
name: z.string().optional(),
|
|
360
|
-
priority:
|
|
542
|
+
priority: objectivePriority2.optional(),
|
|
361
543
|
targetWeight: z.number().optional(),
|
|
362
544
|
tolerance: z.number().optional(),
|
|
363
545
|
maxRiskScore: z.number().optional(),
|
|
@@ -452,7 +634,7 @@ function registerMarketTools(server, client) {
|
|
|
452
634
|
priceChangeRatio: z.number().describe("Fractional price change (e.g. -0.15 = -15%)"),
|
|
453
635
|
name: z.string().optional().describe("Event label"),
|
|
454
636
|
description: z.string().optional().describe("Event description"),
|
|
455
|
-
autoRestore: z.boolean().optional().describe("
|
|
637
|
+
autoRestore: z.boolean().optional().describe("Opt in to run restore if objectives breach. Omit or false = drift only. Automatic still 409s if the vault cannot execute.")
|
|
456
638
|
},
|
|
457
639
|
async (input) => {
|
|
458
640
|
try {
|
|
@@ -520,6 +702,137 @@ function registerDeveloperTools(server, client) {
|
|
|
520
702
|
}
|
|
521
703
|
);
|
|
522
704
|
}
|
|
705
|
+
function registerRegistryTools(server, client) {
|
|
706
|
+
server.tool(
|
|
707
|
+
"aureon_registry_status",
|
|
708
|
+
"Returns Phase 2 ObjectiveRegistry deployment status (testnet contract address when configured).",
|
|
709
|
+
{},
|
|
710
|
+
async () => {
|
|
711
|
+
try {
|
|
712
|
+
return ok(await client.getRegistryStatus());
|
|
713
|
+
} catch (err) {
|
|
714
|
+
return fail(err);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
server.tool(
|
|
719
|
+
"aureon_get_objective_registry",
|
|
720
|
+
"Returns the on-chain registry record for an objective when registered.",
|
|
721
|
+
{
|
|
722
|
+
objectiveId: z.string().describe("Objective id")
|
|
723
|
+
},
|
|
724
|
+
async ({ objectiveId }) => {
|
|
725
|
+
try {
|
|
726
|
+
return ok(await client.getObjectiveRegistry(objectiveId));
|
|
727
|
+
} catch (err) {
|
|
728
|
+
return fail(err);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
);
|
|
732
|
+
server.tool(
|
|
733
|
+
"aureon_prepare_objective_registry",
|
|
734
|
+
"Prepares wallet-signed calldata to register an objective on ObjectiveRegistry. The host wallet must broadcast the tx, then call confirm via SDK.",
|
|
735
|
+
{
|
|
736
|
+
objectiveId: z.string().describe("Objective id to register on-chain")
|
|
737
|
+
},
|
|
738
|
+
async ({ objectiveId }) => {
|
|
739
|
+
try {
|
|
740
|
+
return ok(await client.prepareObjectiveRegistry(objectiveId));
|
|
741
|
+
} catch (err) {
|
|
742
|
+
return fail(err);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
);
|
|
746
|
+
server.tool(
|
|
747
|
+
"aureon_confirm_objective_registry",
|
|
748
|
+
"Confirms an on-chain ObjectiveRegistry registration after the host wallet broadcast the prepare tx. Pass the transaction hash. The API verifies the receipt on chain and stores the registry link.",
|
|
749
|
+
{
|
|
750
|
+
objectiveId: z.string().describe("Objective id that was registered"),
|
|
751
|
+
transactionHash: z.string().describe("0x transaction hash from the wallet broadcast")
|
|
752
|
+
},
|
|
753
|
+
async ({ objectiveId, transactionHash }) => {
|
|
754
|
+
try {
|
|
755
|
+
return ok(await client.confirmObjectiveRegistry(objectiveId, transactionHash));
|
|
756
|
+
} catch (err) {
|
|
757
|
+
return fail(err);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
function registerSettlementTools(server, client) {
|
|
763
|
+
server.tool(
|
|
764
|
+
"aureon_get_execution_settlement",
|
|
765
|
+
"Returns the chain-verified settlement record for a vault execution when the listener has observed an on-chain Rebalanced event. Staged executions never have settlement records \u2014 do not claim on-chain proof without this.",
|
|
766
|
+
{
|
|
767
|
+
executionId: z.string().describe("Execution receipt id")
|
|
768
|
+
},
|
|
769
|
+
async ({ executionId }) => {
|
|
770
|
+
try {
|
|
771
|
+
return ok(await client.getExecutionSettlement(executionId));
|
|
772
|
+
} catch (err) {
|
|
773
|
+
return fail(err);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
);
|
|
777
|
+
server.tool(
|
|
778
|
+
"aureon_list_settlements",
|
|
779
|
+
"Lists settlement records for the authenticated wallet. May include orphans (observed vault Rebalanced events not yet bound to an execution). Optional objectiveId filter. Read status and executionId before claiming proof.",
|
|
780
|
+
{
|
|
781
|
+
objectiveId: z.string().optional().describe("Filter by objective id")
|
|
782
|
+
},
|
|
783
|
+
async ({ objectiveId }) => {
|
|
784
|
+
try {
|
|
785
|
+
return ok({ settlements: await client.listSettlements(objectiveId) });
|
|
786
|
+
} catch (err) {
|
|
787
|
+
return fail(err);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
);
|
|
791
|
+
server.tool(
|
|
792
|
+
"aureon_confirm_execution_settlement",
|
|
793
|
+
"Manual backfill: verify a vault Rebalanced transaction on chain and attach a settlement record to an execution. Use when the listener missed the event. Staged executions cannot be confirmed this way.",
|
|
794
|
+
{
|
|
795
|
+
executionId: z.string().describe("Execution receipt id"),
|
|
796
|
+
transactionHash: z.string().describe("0x vault Rebalanced transaction hash")
|
|
797
|
+
},
|
|
798
|
+
async ({ executionId, transactionHash }) => {
|
|
799
|
+
try {
|
|
800
|
+
return ok(await client.confirmExecutionSettlement(executionId, transactionHash));
|
|
801
|
+
} catch (err) {
|
|
802
|
+
return fail(err);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
function registerReceiptTools(server) {
|
|
808
|
+
server.tool(
|
|
809
|
+
"aureon_validate_receipt",
|
|
810
|
+
"Validates an execution receipt locally (schema + settlement honesty). No API call. Returns { valid, issues }. Do not trust or summarize a receipt as on-chain when validation fails.",
|
|
811
|
+
{
|
|
812
|
+
receipt: z.record(z.unknown()).describe("ExecutionReceipt JSON from restore, listExecutions, or API")
|
|
813
|
+
},
|
|
814
|
+
async ({ receipt }) => {
|
|
815
|
+
const result = validateExecutionReceipt(receipt);
|
|
816
|
+
return ok(result);
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
function registerAuditTrailTools(server, client) {
|
|
821
|
+
server.tool(
|
|
822
|
+
"aureon_get_audit_trail",
|
|
823
|
+
"Export the financial audit trail for one objective: registry, receipts, settlements, timeline. Missing proof is labeled. Never invent on-chain claims.",
|
|
824
|
+
{
|
|
825
|
+
objectiveId: z.string().describe("Objective id to export")
|
|
826
|
+
},
|
|
827
|
+
async ({ objectiveId }) => {
|
|
828
|
+
try {
|
|
829
|
+
return ok(await client.getAuditTrail(objectiveId));
|
|
830
|
+
} catch (err) {
|
|
831
|
+
return fail(err);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
);
|
|
835
|
+
}
|
|
523
836
|
|
|
524
837
|
// src/tools/index.ts
|
|
525
838
|
function registerTools(server, client, session) {
|
|
@@ -528,9 +841,18 @@ function registerTools(server, client, session) {
|
|
|
528
841
|
registerVaultTools(server, client);
|
|
529
842
|
registerAuthTools(server, client, session);
|
|
530
843
|
registerObjectiveTools(server, client);
|
|
844
|
+
registerIntentTools(server, client);
|
|
845
|
+
registerDriftRestoreTools(server, client);
|
|
846
|
+
registerReceiptVerificationTools(server, client);
|
|
847
|
+
registerPortfolioWatchTools(server, client);
|
|
848
|
+
registerFullAureonLoopTools(server, client);
|
|
531
849
|
registerPortfolioTools(server, client);
|
|
532
850
|
registerMarketTools(server, client);
|
|
533
851
|
registerDeveloperTools(server, client);
|
|
852
|
+
registerRegistryTools(server, client);
|
|
853
|
+
registerSettlementTools(server, client);
|
|
854
|
+
registerReceiptTools(server);
|
|
855
|
+
registerAuditTrailTools(server, client);
|
|
534
856
|
}
|
|
535
857
|
|
|
536
858
|
// src/server.ts
|