@pgnio/helios-mcp 0.4.0 → 0.5.0
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 +1 -1
- package/dist/{chunk-5LIHYXEF.mjs → chunk-XM257Y63.mjs} +42 -9
- package/dist/cli.js +39 -9
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +45 -9
- package/dist/index.mjs +7 -1
- package/package.json +1 -1
- package/dist/chunk-LPDQG4WK.mjs +0 -4274
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ https://helios.pgn.io/?connect=ai.
|
|
|
20
20
|
| URL (hosted) | `HELIOS_MCP_PROFILE` (local) | Tools | For |
|
|
21
21
|
| --- | --- | --- | --- |
|
|
22
22
|
| `/mcp` | `lean` (default) | `sm_board`, `sm_moves`, `sm_coin`, `market`, `account`, `trades`, `trade`, `protect`, `candles` | Most agents, and small local models |
|
|
23
|
-
| `/mcp/signals` | `signals` | the
|
|
23
|
+
| `/mcp/signals` | `signals` | the same; `trade` and `protect` on the practice account only | Agents that watch or practice, never trade for real |
|
|
24
24
|
| `/mcp/full` | `full` | lean plus the full ~50-column snapshot, symbol detail with raw indicators, fills and the indicator docs | Strong models doing their own analysis |
|
|
25
25
|
|
|
26
26
|
Every lean answer is short text (a first line that answers, then one line per row) plus the same data as structured
|
|
@@ -578,7 +578,13 @@ var agentMarketRowSchema = z2.object({
|
|
|
578
578
|
volUsd: z2.number().nullable(),
|
|
579
579
|
fundAprPct: z2.number().nullable(),
|
|
580
580
|
oiUsd: z2.number().nullable(),
|
|
581
|
-
setup: agentSetupSchema.nullable()
|
|
581
|
+
setup: agentSetupSchema.nullable(),
|
|
582
|
+
/** Coin limits and the book; absent from older data-bridges. */
|
|
583
|
+
maxLev: z2.number().nullish(),
|
|
584
|
+
spreadBps: z2.number().nullish(),
|
|
585
|
+
slip10kBps: z2.number().nullish(),
|
|
586
|
+
slip100kBps: z2.number().nullish(),
|
|
587
|
+
depth1pctUsd: z2.number().nullish()
|
|
582
588
|
});
|
|
583
589
|
var agentMarketSchema = z2.object({
|
|
584
590
|
asOf: z2.string().nullable(),
|
|
@@ -2703,6 +2709,7 @@ function renderCoin(c, you, now = Date.now()) {
|
|
|
2703
2709
|
const vs = sm?.side ? entryText(sm.side, sm.edgePct) : null;
|
|
2704
2710
|
lines.push(`price | ${price(mk.px)}${vs ? ` (${vs})` : ""} \xB7 15m ${pct(mk.r15m)} \xB7 1h ${pct(mk.r1h)} \xB7 24h ${pct(mk.r24h)}`);
|
|
2705
2711
|
lines.push(`setup | ${mk.setup ?? "n/a"} \xB7 funding ${pct(mk.fundAprPct, 0)} APR \xB7 open interest ${usd(mk.oiUsd)} \xB7 vol ${usd(mk.volUsd)}`);
|
|
2712
|
+
lines.push(tradingLine(mk, now));
|
|
2706
2713
|
} else lines.push("price | no market data for this coin");
|
|
2707
2714
|
if (sm && sm.flow1hUsd !== 0) lines.push(`flow | ${usd(Math.abs(sm.flow1hUsd))} net toward ${sm.flow1hUsd > 0 ? "long" : "short"} in the last hour`);
|
|
2708
2715
|
if (sm?.pileIn) lines.push(`pile-in | ${pileText(sm.pileIn, now)}`);
|
|
@@ -2717,6 +2724,20 @@ function renderCoin(c, you, now = Date.now()) {
|
|
|
2717
2724
|
if (c.note) lines.push(c.note);
|
|
2718
2725
|
return lines.join("\n");
|
|
2719
2726
|
}
|
|
2727
|
+
var MIN_ORDER_USD = 10;
|
|
2728
|
+
var bps = (v) => v === null || v === void 0 || !Number.isFinite(v) ? "n/a" : `${trim(v, 2)} bps`;
|
|
2729
|
+
function tradingLine(mk, now = Date.now()) {
|
|
2730
|
+
const parts = [`max ${mk.maxLev ? `${trim(mk.maxLev, 0)}x` : "n/a"}`, `min order $${MIN_ORDER_USD}`];
|
|
2731
|
+
if (mk.spreadBps !== null && mk.spreadBps !== void 0) parts.push(`spread ${bps(mk.spreadBps)}`);
|
|
2732
|
+
if (mk.slip10kBps !== null && mk.slip10kBps !== void 0) parts.push(`$10k market order slips ${bps(mk.slip10kBps)}, $100k ${bps(mk.slip100kBps)}`);
|
|
2733
|
+
if (mk.depth1pctUsd !== null && mk.depth1pctUsd !== void 0) parts.push(`${usd(mk.depth1pctUsd)} within 1%`);
|
|
2734
|
+
if (mk.fundAprPct !== null) {
|
|
2735
|
+
const hourly = mk.fundAprPct / (24 * 365);
|
|
2736
|
+
const mins = Math.max(1, Math.ceil((36e5 - now % 36e5) / 6e4));
|
|
2737
|
+
parts.push(`funding ${hourly > 0 ? "+" : ""}${hourly.toFixed(4)}%/h (${hourly >= 0 ? "longs pay" : "shorts pay"}), next in ${mins}m`);
|
|
2738
|
+
}
|
|
2739
|
+
return `trading | ${parts.join(" \xB7 ")}`;
|
|
2740
|
+
}
|
|
2720
2741
|
function renderAccount(p, orders, summary) {
|
|
2721
2742
|
const lines = [
|
|
2722
2743
|
`account \xB7 value ${usd(p.totalBalance)} \xB7 free ${usd(p.availableBalance)} \xB7 margin used ${usd(p.totalMargin)} \xB7 open PnL ${usd(p.unrealizedPnl, true)}`
|
|
@@ -3252,13 +3273,15 @@ function createLeanToolDefinitions(services) {
|
|
|
3252
3273
|
}
|
|
3253
3274
|
async function protectionFor(input) {
|
|
3254
3275
|
if (input.side === "short" && (input.tp_pct ?? 0) >= 100) throw new Error("A short can gain at most 100%: tp_pct must be under 100");
|
|
3276
|
+
const m = await withSession(auth, READ, (token) => dataBridge.getAgentMarket(token, { coins: [input.coin], limit: 1 })).catch(() => null);
|
|
3277
|
+
if (m && !m.ok) return { pending: m.pending };
|
|
3278
|
+
const row = m?.value?.rows?.find((r) => sameCoinName(r.coin, input.coin)) ?? null;
|
|
3279
|
+
if (row?.maxLev && input.leverage && input.leverage > row.maxLev)
|
|
3280
|
+
throw new Error(`${input.coin} allows at most ${row.maxLev}x on Hyperliquid: lower leverage. Nothing was sent.`);
|
|
3281
|
+
if (input.leverage && input.margin_usd && input.margin_usd * input.leverage < MIN_ORDER_USD)
|
|
3282
|
+
throw new Error(`Order value $${(input.margin_usd * input.leverage).toFixed(2)} is under Hyperliquid's $${MIN_ORDER_USD} minimum (margin x leverage). Nothing was sent.`);
|
|
3255
3283
|
if (!input.sl_pct && !input.tp_pct) return { value: void 0 };
|
|
3256
|
-
|
|
3257
|
-
if (ref === null) {
|
|
3258
|
-
const m = await withSession(auth, READ, (token) => dataBridge.getAgentMarket(token, { coins: [input.coin], limit: 1 }));
|
|
3259
|
-
if (!m.ok) return { pending: m.pending };
|
|
3260
|
-
ref = m.value.rows[0]?.px ?? null;
|
|
3261
|
-
}
|
|
3284
|
+
const ref = input.limit_px ?? row?.px ?? null;
|
|
3262
3285
|
if (ref === null) throw new Error(`No price for ${input.coin} to place the stop from; trade without sl_pct/tp_pct, then use protect`);
|
|
3263
3286
|
const long = input.side === "long";
|
|
3264
3287
|
const at = (p, away) => Number((p * (1 + away / 100)).toPrecision(6));
|
|
@@ -3271,9 +3294,16 @@ function createLeanToolDefinitions(services) {
|
|
|
3271
3294
|
}
|
|
3272
3295
|
return { smBoard, smMoves, smCoin, market, account, trade, protect, trades, candles };
|
|
3273
3296
|
}
|
|
3297
|
+
function practiceOnly(tool) {
|
|
3298
|
+
return {
|
|
3299
|
+
...tool,
|
|
3300
|
+
description: `Practice account only on this link (no real money). ${tool.description}`,
|
|
3301
|
+
execute: (input) => tool.execute({ ...input, paper: true })
|
|
3302
|
+
};
|
|
3303
|
+
}
|
|
3274
3304
|
function leanToolsFor(tools, profile) {
|
|
3275
3305
|
const reads = [tools.smBoard, tools.smMoves, tools.smCoin, tools.market];
|
|
3276
|
-
const list = profile === "signals" ? [...reads, tools.account, tools.trades, tools.candles] : [...reads, tools.account, tools.trades, tools.trade, tools.protect, tools.candles];
|
|
3306
|
+
const list = profile === "signals" ? [...reads, tools.account, tools.trades, practiceOnly(tools.trade), practiceOnly(tools.protect), tools.candles] : [...reads, tools.account, tools.trades, tools.trade, tools.protect, tools.candles];
|
|
3277
3307
|
return list;
|
|
3278
3308
|
}
|
|
3279
3309
|
|
|
@@ -4083,7 +4113,7 @@ async function createHeliosAgentMcpServer(options) {
|
|
|
4083
4113
|
const server = new McpServer(
|
|
4084
4114
|
{
|
|
4085
4115
|
name: "helios",
|
|
4086
|
-
version: "0.
|
|
4116
|
+
version: "0.5.0"
|
|
4087
4117
|
},
|
|
4088
4118
|
// Caps the array elements plus object keys one tools/call may carry (GHSA-46jr-4wx8-v453: without it, one request
|
|
4089
4119
|
// under the body size limit could run the hosted server out of memory while validating). The largest real input is
|
|
@@ -4241,6 +4271,8 @@ export {
|
|
|
4241
4271
|
renderBoard,
|
|
4242
4272
|
renderMoves,
|
|
4243
4273
|
renderCoin,
|
|
4274
|
+
MIN_ORDER_USD,
|
|
4275
|
+
tradingLine,
|
|
4244
4276
|
renderAccount,
|
|
4245
4277
|
positionLine,
|
|
4246
4278
|
renderTrades,
|
|
@@ -4258,6 +4290,7 @@ export {
|
|
|
4258
4290
|
candlesInputSchema,
|
|
4259
4291
|
wrongSideTpSl,
|
|
4260
4292
|
createLeanToolDefinitions,
|
|
4293
|
+
practiceOnly,
|
|
4261
4294
|
leanToolsFor,
|
|
4262
4295
|
createHeliosDocsToolDefinitions,
|
|
4263
4296
|
createHeliosAuthToolDefinitions,
|
package/dist/cli.js
CHANGED
|
@@ -594,7 +594,13 @@ var agentMarketRowSchema = import_zod3.z.object({
|
|
|
594
594
|
volUsd: import_zod3.z.number().nullable(),
|
|
595
595
|
fundAprPct: import_zod3.z.number().nullable(),
|
|
596
596
|
oiUsd: import_zod3.z.number().nullable(),
|
|
597
|
-
setup: agentSetupSchema.nullable()
|
|
597
|
+
setup: agentSetupSchema.nullable(),
|
|
598
|
+
/** Coin limits and the book; absent from older data-bridges. */
|
|
599
|
+
maxLev: import_zod3.z.number().nullish(),
|
|
600
|
+
spreadBps: import_zod3.z.number().nullish(),
|
|
601
|
+
slip10kBps: import_zod3.z.number().nullish(),
|
|
602
|
+
slip100kBps: import_zod3.z.number().nullish(),
|
|
603
|
+
depth1pctUsd: import_zod3.z.number().nullish()
|
|
598
604
|
});
|
|
599
605
|
var agentMarketSchema = import_zod3.z.object({
|
|
600
606
|
asOf: import_zod3.z.string().nullable(),
|
|
@@ -2689,6 +2695,7 @@ function renderCoin(c, you, now = Date.now()) {
|
|
|
2689
2695
|
const vs = sm?.side ? entryText(sm.side, sm.edgePct) : null;
|
|
2690
2696
|
lines.push(`price | ${price(mk.px)}${vs ? ` (${vs})` : ""} \xB7 15m ${pct(mk.r15m)} \xB7 1h ${pct(mk.r1h)} \xB7 24h ${pct(mk.r24h)}`);
|
|
2691
2697
|
lines.push(`setup | ${mk.setup ?? "n/a"} \xB7 funding ${pct(mk.fundAprPct, 0)} APR \xB7 open interest ${usd(mk.oiUsd)} \xB7 vol ${usd(mk.volUsd)}`);
|
|
2698
|
+
lines.push(tradingLine(mk, now));
|
|
2692
2699
|
} else lines.push("price | no market data for this coin");
|
|
2693
2700
|
if (sm && sm.flow1hUsd !== 0) lines.push(`flow | ${usd(Math.abs(sm.flow1hUsd))} net toward ${sm.flow1hUsd > 0 ? "long" : "short"} in the last hour`);
|
|
2694
2701
|
if (sm?.pileIn) lines.push(`pile-in | ${pileText(sm.pileIn, now)}`);
|
|
@@ -2703,6 +2710,20 @@ function renderCoin(c, you, now = Date.now()) {
|
|
|
2703
2710
|
if (c.note) lines.push(c.note);
|
|
2704
2711
|
return lines.join("\n");
|
|
2705
2712
|
}
|
|
2713
|
+
var MIN_ORDER_USD = 10;
|
|
2714
|
+
var bps = (v) => v === null || v === void 0 || !Number.isFinite(v) ? "n/a" : `${trim(v, 2)} bps`;
|
|
2715
|
+
function tradingLine(mk, now = Date.now()) {
|
|
2716
|
+
const parts = [`max ${mk.maxLev ? `${trim(mk.maxLev, 0)}x` : "n/a"}`, `min order $${MIN_ORDER_USD}`];
|
|
2717
|
+
if (mk.spreadBps !== null && mk.spreadBps !== void 0) parts.push(`spread ${bps(mk.spreadBps)}`);
|
|
2718
|
+
if (mk.slip10kBps !== null && mk.slip10kBps !== void 0) parts.push(`$10k market order slips ${bps(mk.slip10kBps)}, $100k ${bps(mk.slip100kBps)}`);
|
|
2719
|
+
if (mk.depth1pctUsd !== null && mk.depth1pctUsd !== void 0) parts.push(`${usd(mk.depth1pctUsd)} within 1%`);
|
|
2720
|
+
if (mk.fundAprPct !== null) {
|
|
2721
|
+
const hourly = mk.fundAprPct / (24 * 365);
|
|
2722
|
+
const mins = Math.max(1, Math.ceil((36e5 - now % 36e5) / 6e4));
|
|
2723
|
+
parts.push(`funding ${hourly > 0 ? "+" : ""}${hourly.toFixed(4)}%/h (${hourly >= 0 ? "longs pay" : "shorts pay"}), next in ${mins}m`);
|
|
2724
|
+
}
|
|
2725
|
+
return `trading | ${parts.join(" \xB7 ")}`;
|
|
2726
|
+
}
|
|
2706
2727
|
function renderAccount(p, orders, summary) {
|
|
2707
2728
|
const lines = [
|
|
2708
2729
|
`account \xB7 value ${usd(p.totalBalance)} \xB7 free ${usd(p.availableBalance)} \xB7 margin used ${usd(p.totalMargin)} \xB7 open PnL ${usd(p.unrealizedPnl, true)}`
|
|
@@ -3236,13 +3257,15 @@ function createLeanToolDefinitions(services) {
|
|
|
3236
3257
|
}
|
|
3237
3258
|
async function protectionFor(input) {
|
|
3238
3259
|
if (input.side === "short" && (input.tp_pct ?? 0) >= 100) throw new Error("A short can gain at most 100%: tp_pct must be under 100");
|
|
3260
|
+
const m = await withSession(auth, READ, (token) => dataBridge.getAgentMarket(token, { coins: [input.coin], limit: 1 })).catch(() => null);
|
|
3261
|
+
if (m && !m.ok) return { pending: m.pending };
|
|
3262
|
+
const row = m?.value?.rows?.find((r) => sameCoinName(r.coin, input.coin)) ?? null;
|
|
3263
|
+
if (row?.maxLev && input.leverage && input.leverage > row.maxLev)
|
|
3264
|
+
throw new Error(`${input.coin} allows at most ${row.maxLev}x on Hyperliquid: lower leverage. Nothing was sent.`);
|
|
3265
|
+
if (input.leverage && input.margin_usd && input.margin_usd * input.leverage < MIN_ORDER_USD)
|
|
3266
|
+
throw new Error(`Order value $${(input.margin_usd * input.leverage).toFixed(2)} is under Hyperliquid's $${MIN_ORDER_USD} minimum (margin x leverage). Nothing was sent.`);
|
|
3239
3267
|
if (!input.sl_pct && !input.tp_pct) return { value: void 0 };
|
|
3240
|
-
|
|
3241
|
-
if (ref === null) {
|
|
3242
|
-
const m = await withSession(auth, READ, (token) => dataBridge.getAgentMarket(token, { coins: [input.coin], limit: 1 }));
|
|
3243
|
-
if (!m.ok) return { pending: m.pending };
|
|
3244
|
-
ref = m.value.rows[0]?.px ?? null;
|
|
3245
|
-
}
|
|
3268
|
+
const ref = input.limit_px ?? row?.px ?? null;
|
|
3246
3269
|
if (ref === null) throw new Error(`No price for ${input.coin} to place the stop from; trade without sl_pct/tp_pct, then use protect`);
|
|
3247
3270
|
const long = input.side === "long";
|
|
3248
3271
|
const at = (p, away) => Number((p * (1 + away / 100)).toPrecision(6));
|
|
@@ -3255,9 +3278,16 @@ function createLeanToolDefinitions(services) {
|
|
|
3255
3278
|
}
|
|
3256
3279
|
return { smBoard, smMoves, smCoin, market, account, trade, protect, trades, candles };
|
|
3257
3280
|
}
|
|
3281
|
+
function practiceOnly(tool) {
|
|
3282
|
+
return {
|
|
3283
|
+
...tool,
|
|
3284
|
+
description: `Practice account only on this link (no real money). ${tool.description}`,
|
|
3285
|
+
execute: (input) => tool.execute({ ...input, paper: true })
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
3258
3288
|
function leanToolsFor(tools, profile) {
|
|
3259
3289
|
const reads = [tools.smBoard, tools.smMoves, tools.smCoin, tools.market];
|
|
3260
|
-
const list = profile === "signals" ? [...reads, tools.account, tools.trades, tools.candles] : [...reads, tools.account, tools.trades, tools.trade, tools.protect, tools.candles];
|
|
3290
|
+
const list = profile === "signals" ? [...reads, tools.account, tools.trades, practiceOnly(tools.trade), practiceOnly(tools.protect), tools.candles] : [...reads, tools.account, tools.trades, tools.trade, tools.protect, tools.candles];
|
|
3261
3291
|
return list;
|
|
3262
3292
|
}
|
|
3263
3293
|
|
|
@@ -3804,7 +3834,7 @@ async function createHeliosAgentMcpServer(options) {
|
|
|
3804
3834
|
const server = new McpServer(
|
|
3805
3835
|
{
|
|
3806
3836
|
name: "helios",
|
|
3807
|
-
version: "0.
|
|
3837
|
+
version: "0.5.0"
|
|
3808
3838
|
},
|
|
3809
3839
|
// Caps the array elements plus object keys one tools/call may carry (GHSA-46jr-4wx8-v453: without it, one request
|
|
3810
3840
|
// under the body size limit could run the hosted server out of memory while validating). The largest real input is
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -675,6 +675,11 @@ declare const agentMarketSchema: z.ZodObject<{
|
|
|
675
675
|
"stretched down": "stretched down";
|
|
676
676
|
neutral: "neutral";
|
|
677
677
|
}>>;
|
|
678
|
+
maxLev: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
679
|
+
spreadBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
680
|
+
slip10kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
681
|
+
slip100kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
682
|
+
depth1pctUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
678
683
|
sm: z.ZodNullable<z.ZodObject<{
|
|
679
684
|
side: z.ZodNullable<z.ZodEnum<{
|
|
680
685
|
long: "long";
|
|
@@ -901,6 +906,11 @@ declare const smartMoneyCoinSchema: z.ZodObject<{
|
|
|
901
906
|
"stretched down": "stretched down";
|
|
902
907
|
neutral: "neutral";
|
|
903
908
|
}>>;
|
|
909
|
+
maxLev: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
910
|
+
spreadBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
911
|
+
slip10kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
912
|
+
slip100kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
913
|
+
depth1pctUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
904
914
|
}, z.core.$strip>>;
|
|
905
915
|
moves: z.ZodArray<z.ZodObject<{
|
|
906
916
|
id: z.ZodString;
|
|
@@ -1646,7 +1656,7 @@ declare class HeliosAgentMcpTradingService {
|
|
|
1646
1656
|
* Which tools a server lists (Mario 2026-10-26, the lean MCP):
|
|
1647
1657
|
* - lean: the 9 smart-money-first tools (reads, your trades, trade, protect, candles) with short text answers, for small models (Qwen 27B
|
|
1648
1658
|
* at 32k) and most agents;
|
|
1649
|
-
* - signals: the reads of lean
|
|
1659
|
+
* - signals: the reads of lean, with trade and protect on the practice account only, for agents that watch or practice;
|
|
1650
1660
|
* - full: lean plus the depth reads (the ~50-column snapshot, symbol detail with raw indicators, fills, the
|
|
1651
1661
|
* indicator docs), for strong models that do their own analysis.
|
|
1652
1662
|
*/
|
|
@@ -2838,6 +2848,13 @@ interface CoinYou {
|
|
|
2838
2848
|
availableBalance: number;
|
|
2839
2849
|
}
|
|
2840
2850
|
declare function renderCoin(c: SmartMoneyCoin, you: CoinYou | null, now?: number): string;
|
|
2851
|
+
/** Minimum order value on Hyperliquid (notional = margin x leverage). */
|
|
2852
|
+
declare const MIN_ORDER_USD = 10;
|
|
2853
|
+
/**
|
|
2854
|
+
* What it costs to trade the coin now: max leverage, spread, the slippage of a $10k and $100k market order (worse
|
|
2855
|
+
* side), USD resting within 1% (thinner side), and the next funding payment (Hyperliquid pays every hour on the hour).
|
|
2856
|
+
*/
|
|
2857
|
+
declare function tradingLine(mk: SmartMoneyCoin['market'] & object, now?: number): string;
|
|
2841
2858
|
declare function renderAccount(p: PortfolioSnapshot, orders: OpenOrder[] | null, summary: LedgerSummary | null): string;
|
|
2842
2859
|
/** "long 0.5 BTC @ 67,420 · mark 67,900 · open PnL +$240 · 10x · liquidation 61,200". */
|
|
2843
2860
|
declare function positionLine(pos: PortfolioSnapshot['positions'][number]): string;
|
|
@@ -3063,6 +3080,14 @@ declare function createLeanToolDefinitions(services: LeanServices): {
|
|
|
3063
3080
|
};
|
|
3064
3081
|
type LeanTools = ReturnType<typeof createLeanToolDefinitions>;
|
|
3065
3082
|
/** The tool sets per profile, in the order they are listed (smart money first, so it is what a model reaches for). */
|
|
3083
|
+
/**
|
|
3084
|
+
* A write tool for Watch only links (Mario 2026-11-08: they may paper trade): the same tool on the practice account
|
|
3085
|
+
* only, whatever `paper` says. data-bridge holds the same line (paper.ts paperWriter): a watch-only token may change
|
|
3086
|
+
* the agent practice account and nothing else.
|
|
3087
|
+
*/
|
|
3088
|
+
declare function practiceOnly<T extends {
|
|
3089
|
+
paper?: boolean;
|
|
3090
|
+
}>(tool: LeanToolDefinition<T>): LeanToolDefinition<T>;
|
|
3066
3091
|
declare function leanToolsFor(tools: LeanTools, profile: 'lean' | 'signals' | 'full'): LeanToolDefinition<never>[];
|
|
3067
3092
|
|
|
3068
|
-
export { type ActiveProviderView, type AgentMcpSessionStore, type CancelOrderToolResult, type ClosePositionToolResult, type CoinYou, type CreateHeliosAgentMcpServerOptions, DEFAULT_HELIOS_BASE_URL, DEFAULT_HELIOS_SESSION_ISSUER, DEFAULT_SNAPSHOT_FIELDS, DEFAULT_SNAPSHOT_TOP, type DeleteTpSlToolResult, type EnsureLoginOptions, type EnsureLoginResult, FileAgentSessionStore, type FileAgentSessionStoreOptions, type GetHeliosAgentMcpDocumentInput, HOSTED_RECONNECT_MESSAGE, HeliosAgentMcpAccountService, type HeliosAgentMcpAccountServiceOptions, HeliosAgentMcpAuthService, type HeliosAgentMcpAuthServiceOptions, type HeliosAgentMcpDocsIndex, type HeliosAgentMcpDocsIndexEntry, HeliosAgentMcpDocsService, type HeliosAgentMcpDocsServiceOptions, type HeliosAgentMcpDocument, HeliosAgentMcpLedgerService, type HeliosAgentMcpLedgerServiceOptions, HeliosAgentMcpMarketService, type HeliosAgentMcpMarketServiceOptions, HeliosAgentMcpProviderService, type HeliosAgentMcpProviderServiceOptions, HeliosAgentMcpTradingService, type HeliosAgentMcpTradingServiceOptions, type HeliosMcpToolDefinition, type HeliosMcpToolResult, type LeanServices, type LeanToolDefinition, type LeanToolResult, type LeanTools, type LedgerFillsResult, type LedgerSummaryResult, MAX_TOOL_INPUT_ELEMENTS, MCP_PROFILES, type MarketSnapshotChunkResult, type MarketSnapshotResult, type MarketSymbolDetailResult, type McpProfile, MemoryAgentMcpSessionStore, type OpenOrdersToolResult, type OpenPositionsResult, type PendingAgentLogin, type PendingLoginResult, type PollLoginResult, type PortfolioResult, type SetTpSlToolResult, type StartLoginResult, TRADE_KEY_WINDOW_SECONDS, type TradeIntentAction, type TradeIntentActionInput, type TradeIntentActionResult, type WalletStateResult, accountInputSchema, ago, assertHeliosBaseUrl, candlesInputSchema, compactSymbolDetail, createHeliosAccountToolDefinitions, createHeliosAgentMcpServer, createHeliosAuthToolDefinitions, createHeliosDocsToolDefinitions, createHeliosLedgerToolDefinitions, createHeliosMarketToolDefinitions, createHeliosProviderToolDefinitions, createHeliosTradingToolDefinitions, createLeanToolDefinitions, entryText, formatHeliosLoginPrompt, getDefaultHeliosAgentMcpDocsRoot, getDefaultHeliosAgentMcpSessionPath, isSameHeliosIssuer, leanToolsFor, marketInputSchema, moveText, pct, pendingAgentLoginSchema, positionLine, price, protectInputSchema, renderAccount, renderBoard, renderCandles, renderCoin, renderMarket, renderMoves, renderTrades, retryAfterUnauthorizedRefresh, smBoardInputSchema, smCoinInputSchema, smMovesInputSchema, toolAnnotations, topOfSnapshot, tradeInputSchema, tradeKeyFor, trader, tradesInputSchema, usd, withDataText, withSnapshotDefaults, wrongSideTpSl };
|
|
3093
|
+
export { type ActiveProviderView, type AgentMcpSessionStore, type CancelOrderToolResult, type ClosePositionToolResult, type CoinYou, type CreateHeliosAgentMcpServerOptions, DEFAULT_HELIOS_BASE_URL, DEFAULT_HELIOS_SESSION_ISSUER, DEFAULT_SNAPSHOT_FIELDS, DEFAULT_SNAPSHOT_TOP, type DeleteTpSlToolResult, type EnsureLoginOptions, type EnsureLoginResult, FileAgentSessionStore, type FileAgentSessionStoreOptions, type GetHeliosAgentMcpDocumentInput, HOSTED_RECONNECT_MESSAGE, HeliosAgentMcpAccountService, type HeliosAgentMcpAccountServiceOptions, HeliosAgentMcpAuthService, type HeliosAgentMcpAuthServiceOptions, type HeliosAgentMcpDocsIndex, type HeliosAgentMcpDocsIndexEntry, HeliosAgentMcpDocsService, type HeliosAgentMcpDocsServiceOptions, type HeliosAgentMcpDocument, HeliosAgentMcpLedgerService, type HeliosAgentMcpLedgerServiceOptions, HeliosAgentMcpMarketService, type HeliosAgentMcpMarketServiceOptions, HeliosAgentMcpProviderService, type HeliosAgentMcpProviderServiceOptions, HeliosAgentMcpTradingService, type HeliosAgentMcpTradingServiceOptions, type HeliosMcpToolDefinition, type HeliosMcpToolResult, type LeanServices, type LeanToolDefinition, type LeanToolResult, type LeanTools, type LedgerFillsResult, type LedgerSummaryResult, MAX_TOOL_INPUT_ELEMENTS, MCP_PROFILES, MIN_ORDER_USD, type MarketSnapshotChunkResult, type MarketSnapshotResult, type MarketSymbolDetailResult, type McpProfile, MemoryAgentMcpSessionStore, type OpenOrdersToolResult, type OpenPositionsResult, type PendingAgentLogin, type PendingLoginResult, type PollLoginResult, type PortfolioResult, type SetTpSlToolResult, type StartLoginResult, TRADE_KEY_WINDOW_SECONDS, type TradeIntentAction, type TradeIntentActionInput, type TradeIntentActionResult, type WalletStateResult, accountInputSchema, ago, assertHeliosBaseUrl, candlesInputSchema, compactSymbolDetail, createHeliosAccountToolDefinitions, createHeliosAgentMcpServer, createHeliosAuthToolDefinitions, createHeliosDocsToolDefinitions, createHeliosLedgerToolDefinitions, createHeliosMarketToolDefinitions, createHeliosProviderToolDefinitions, createHeliosTradingToolDefinitions, createLeanToolDefinitions, entryText, formatHeliosLoginPrompt, getDefaultHeliosAgentMcpDocsRoot, getDefaultHeliosAgentMcpSessionPath, isSameHeliosIssuer, leanToolsFor, marketInputSchema, moveText, pct, pendingAgentLoginSchema, positionLine, practiceOnly, price, protectInputSchema, renderAccount, renderBoard, renderCandles, renderCoin, renderMarket, renderMoves, renderTrades, retryAfterUnauthorizedRefresh, smBoardInputSchema, smCoinInputSchema, smMovesInputSchema, toolAnnotations, topOfSnapshot, tradeInputSchema, tradeKeyFor, trader, tradesInputSchema, tradingLine, usd, withDataText, withSnapshotDefaults, wrongSideTpSl };
|
package/dist/index.d.ts
CHANGED
|
@@ -675,6 +675,11 @@ declare const agentMarketSchema: z.ZodObject<{
|
|
|
675
675
|
"stretched down": "stretched down";
|
|
676
676
|
neutral: "neutral";
|
|
677
677
|
}>>;
|
|
678
|
+
maxLev: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
679
|
+
spreadBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
680
|
+
slip10kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
681
|
+
slip100kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
682
|
+
depth1pctUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
678
683
|
sm: z.ZodNullable<z.ZodObject<{
|
|
679
684
|
side: z.ZodNullable<z.ZodEnum<{
|
|
680
685
|
long: "long";
|
|
@@ -901,6 +906,11 @@ declare const smartMoneyCoinSchema: z.ZodObject<{
|
|
|
901
906
|
"stretched down": "stretched down";
|
|
902
907
|
neutral: "neutral";
|
|
903
908
|
}>>;
|
|
909
|
+
maxLev: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
910
|
+
spreadBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
911
|
+
slip10kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
912
|
+
slip100kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
913
|
+
depth1pctUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
904
914
|
}, z.core.$strip>>;
|
|
905
915
|
moves: z.ZodArray<z.ZodObject<{
|
|
906
916
|
id: z.ZodString;
|
|
@@ -1646,7 +1656,7 @@ declare class HeliosAgentMcpTradingService {
|
|
|
1646
1656
|
* Which tools a server lists (Mario 2026-10-26, the lean MCP):
|
|
1647
1657
|
* - lean: the 9 smart-money-first tools (reads, your trades, trade, protect, candles) with short text answers, for small models (Qwen 27B
|
|
1648
1658
|
* at 32k) and most agents;
|
|
1649
|
-
* - signals: the reads of lean
|
|
1659
|
+
* - signals: the reads of lean, with trade and protect on the practice account only, for agents that watch or practice;
|
|
1650
1660
|
* - full: lean plus the depth reads (the ~50-column snapshot, symbol detail with raw indicators, fills, the
|
|
1651
1661
|
* indicator docs), for strong models that do their own analysis.
|
|
1652
1662
|
*/
|
|
@@ -2838,6 +2848,13 @@ interface CoinYou {
|
|
|
2838
2848
|
availableBalance: number;
|
|
2839
2849
|
}
|
|
2840
2850
|
declare function renderCoin(c: SmartMoneyCoin, you: CoinYou | null, now?: number): string;
|
|
2851
|
+
/** Minimum order value on Hyperliquid (notional = margin x leverage). */
|
|
2852
|
+
declare const MIN_ORDER_USD = 10;
|
|
2853
|
+
/**
|
|
2854
|
+
* What it costs to trade the coin now: max leverage, spread, the slippage of a $10k and $100k market order (worse
|
|
2855
|
+
* side), USD resting within 1% (thinner side), and the next funding payment (Hyperliquid pays every hour on the hour).
|
|
2856
|
+
*/
|
|
2857
|
+
declare function tradingLine(mk: SmartMoneyCoin['market'] & object, now?: number): string;
|
|
2841
2858
|
declare function renderAccount(p: PortfolioSnapshot, orders: OpenOrder[] | null, summary: LedgerSummary | null): string;
|
|
2842
2859
|
/** "long 0.5 BTC @ 67,420 · mark 67,900 · open PnL +$240 · 10x · liquidation 61,200". */
|
|
2843
2860
|
declare function positionLine(pos: PortfolioSnapshot['positions'][number]): string;
|
|
@@ -3063,6 +3080,14 @@ declare function createLeanToolDefinitions(services: LeanServices): {
|
|
|
3063
3080
|
};
|
|
3064
3081
|
type LeanTools = ReturnType<typeof createLeanToolDefinitions>;
|
|
3065
3082
|
/** The tool sets per profile, in the order they are listed (smart money first, so it is what a model reaches for). */
|
|
3083
|
+
/**
|
|
3084
|
+
* A write tool for Watch only links (Mario 2026-11-08: they may paper trade): the same tool on the practice account
|
|
3085
|
+
* only, whatever `paper` says. data-bridge holds the same line (paper.ts paperWriter): a watch-only token may change
|
|
3086
|
+
* the agent practice account and nothing else.
|
|
3087
|
+
*/
|
|
3088
|
+
declare function practiceOnly<T extends {
|
|
3089
|
+
paper?: boolean;
|
|
3090
|
+
}>(tool: LeanToolDefinition<T>): LeanToolDefinition<T>;
|
|
3066
3091
|
declare function leanToolsFor(tools: LeanTools, profile: 'lean' | 'signals' | 'full'): LeanToolDefinition<never>[];
|
|
3067
3092
|
|
|
3068
|
-
export { type ActiveProviderView, type AgentMcpSessionStore, type CancelOrderToolResult, type ClosePositionToolResult, type CoinYou, type CreateHeliosAgentMcpServerOptions, DEFAULT_HELIOS_BASE_URL, DEFAULT_HELIOS_SESSION_ISSUER, DEFAULT_SNAPSHOT_FIELDS, DEFAULT_SNAPSHOT_TOP, type DeleteTpSlToolResult, type EnsureLoginOptions, type EnsureLoginResult, FileAgentSessionStore, type FileAgentSessionStoreOptions, type GetHeliosAgentMcpDocumentInput, HOSTED_RECONNECT_MESSAGE, HeliosAgentMcpAccountService, type HeliosAgentMcpAccountServiceOptions, HeliosAgentMcpAuthService, type HeliosAgentMcpAuthServiceOptions, type HeliosAgentMcpDocsIndex, type HeliosAgentMcpDocsIndexEntry, HeliosAgentMcpDocsService, type HeliosAgentMcpDocsServiceOptions, type HeliosAgentMcpDocument, HeliosAgentMcpLedgerService, type HeliosAgentMcpLedgerServiceOptions, HeliosAgentMcpMarketService, type HeliosAgentMcpMarketServiceOptions, HeliosAgentMcpProviderService, type HeliosAgentMcpProviderServiceOptions, HeliosAgentMcpTradingService, type HeliosAgentMcpTradingServiceOptions, type HeliosMcpToolDefinition, type HeliosMcpToolResult, type LeanServices, type LeanToolDefinition, type LeanToolResult, type LeanTools, type LedgerFillsResult, type LedgerSummaryResult, MAX_TOOL_INPUT_ELEMENTS, MCP_PROFILES, type MarketSnapshotChunkResult, type MarketSnapshotResult, type MarketSymbolDetailResult, type McpProfile, MemoryAgentMcpSessionStore, type OpenOrdersToolResult, type OpenPositionsResult, type PendingAgentLogin, type PendingLoginResult, type PollLoginResult, type PortfolioResult, type SetTpSlToolResult, type StartLoginResult, TRADE_KEY_WINDOW_SECONDS, type TradeIntentAction, type TradeIntentActionInput, type TradeIntentActionResult, type WalletStateResult, accountInputSchema, ago, assertHeliosBaseUrl, candlesInputSchema, compactSymbolDetail, createHeliosAccountToolDefinitions, createHeliosAgentMcpServer, createHeliosAuthToolDefinitions, createHeliosDocsToolDefinitions, createHeliosLedgerToolDefinitions, createHeliosMarketToolDefinitions, createHeliosProviderToolDefinitions, createHeliosTradingToolDefinitions, createLeanToolDefinitions, entryText, formatHeliosLoginPrompt, getDefaultHeliosAgentMcpDocsRoot, getDefaultHeliosAgentMcpSessionPath, isSameHeliosIssuer, leanToolsFor, marketInputSchema, moveText, pct, pendingAgentLoginSchema, positionLine, price, protectInputSchema, renderAccount, renderBoard, renderCandles, renderCoin, renderMarket, renderMoves, renderTrades, retryAfterUnauthorizedRefresh, smBoardInputSchema, smCoinInputSchema, smMovesInputSchema, toolAnnotations, topOfSnapshot, tradeInputSchema, tradeKeyFor, trader, tradesInputSchema, usd, withDataText, withSnapshotDefaults, wrongSideTpSl };
|
|
3093
|
+
export { type ActiveProviderView, type AgentMcpSessionStore, type CancelOrderToolResult, type ClosePositionToolResult, type CoinYou, type CreateHeliosAgentMcpServerOptions, DEFAULT_HELIOS_BASE_URL, DEFAULT_HELIOS_SESSION_ISSUER, DEFAULT_SNAPSHOT_FIELDS, DEFAULT_SNAPSHOT_TOP, type DeleteTpSlToolResult, type EnsureLoginOptions, type EnsureLoginResult, FileAgentSessionStore, type FileAgentSessionStoreOptions, type GetHeliosAgentMcpDocumentInput, HOSTED_RECONNECT_MESSAGE, HeliosAgentMcpAccountService, type HeliosAgentMcpAccountServiceOptions, HeliosAgentMcpAuthService, type HeliosAgentMcpAuthServiceOptions, type HeliosAgentMcpDocsIndex, type HeliosAgentMcpDocsIndexEntry, HeliosAgentMcpDocsService, type HeliosAgentMcpDocsServiceOptions, type HeliosAgentMcpDocument, HeliosAgentMcpLedgerService, type HeliosAgentMcpLedgerServiceOptions, HeliosAgentMcpMarketService, type HeliosAgentMcpMarketServiceOptions, HeliosAgentMcpProviderService, type HeliosAgentMcpProviderServiceOptions, HeliosAgentMcpTradingService, type HeliosAgentMcpTradingServiceOptions, type HeliosMcpToolDefinition, type HeliosMcpToolResult, type LeanServices, type LeanToolDefinition, type LeanToolResult, type LeanTools, type LedgerFillsResult, type LedgerSummaryResult, MAX_TOOL_INPUT_ELEMENTS, MCP_PROFILES, MIN_ORDER_USD, type MarketSnapshotChunkResult, type MarketSnapshotResult, type MarketSymbolDetailResult, type McpProfile, MemoryAgentMcpSessionStore, type OpenOrdersToolResult, type OpenPositionsResult, type PendingAgentLogin, type PendingLoginResult, type PollLoginResult, type PortfolioResult, type SetTpSlToolResult, type StartLoginResult, TRADE_KEY_WINDOW_SECONDS, type TradeIntentAction, type TradeIntentActionInput, type TradeIntentActionResult, type WalletStateResult, accountInputSchema, ago, assertHeliosBaseUrl, candlesInputSchema, compactSymbolDetail, createHeliosAccountToolDefinitions, createHeliosAgentMcpServer, createHeliosAuthToolDefinitions, createHeliosDocsToolDefinitions, createHeliosLedgerToolDefinitions, createHeliosMarketToolDefinitions, createHeliosProviderToolDefinitions, createHeliosTradingToolDefinitions, createLeanToolDefinitions, entryText, formatHeliosLoginPrompt, getDefaultHeliosAgentMcpDocsRoot, getDefaultHeliosAgentMcpSessionPath, isSameHeliosIssuer, leanToolsFor, marketInputSchema, moveText, pct, pendingAgentLoginSchema, positionLine, practiceOnly, price, protectInputSchema, renderAccount, renderBoard, renderCandles, renderCoin, renderMarket, renderMoves, renderTrades, retryAfterUnauthorizedRefresh, smBoardInputSchema, smCoinInputSchema, smMovesInputSchema, toolAnnotations, topOfSnapshot, tradeInputSchema, tradeKeyFor, trader, tradesInputSchema, tradingLine, usd, withDataText, withSnapshotDefaults, wrongSideTpSl };
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ __export(index_exports, {
|
|
|
47
47
|
HeliosAgentMcpTradingService: () => HeliosAgentMcpTradingService,
|
|
48
48
|
MAX_TOOL_INPUT_ELEMENTS: () => MAX_TOOL_INPUT_ELEMENTS,
|
|
49
49
|
MCP_PROFILES: () => MCP_PROFILES,
|
|
50
|
+
MIN_ORDER_USD: () => MIN_ORDER_USD,
|
|
50
51
|
MemoryAgentMcpSessionStore: () => MemoryAgentMcpSessionStore,
|
|
51
52
|
TRADE_KEY_WINDOW_SECONDS: () => TRADE_KEY_WINDOW_SECONDS,
|
|
52
53
|
accountInputSchema: () => accountInputSchema,
|
|
@@ -74,6 +75,7 @@ __export(index_exports, {
|
|
|
74
75
|
pct: () => pct,
|
|
75
76
|
pendingAgentLoginSchema: () => pendingAgentLoginSchema2,
|
|
76
77
|
positionLine: () => positionLine,
|
|
78
|
+
practiceOnly: () => practiceOnly,
|
|
77
79
|
price: () => price,
|
|
78
80
|
protectInputSchema: () => protectInputSchema,
|
|
79
81
|
renderAccount: () => renderAccount,
|
|
@@ -93,6 +95,7 @@ __export(index_exports, {
|
|
|
93
95
|
tradeKeyFor: () => tradeKeyFor,
|
|
94
96
|
trader: () => trader,
|
|
95
97
|
tradesInputSchema: () => tradesInputSchema,
|
|
98
|
+
tradingLine: () => tradingLine,
|
|
96
99
|
usd: () => usd,
|
|
97
100
|
withDataText: () => withDataText,
|
|
98
101
|
withSnapshotDefaults: () => withSnapshotDefaults,
|
|
@@ -634,7 +637,13 @@ var agentMarketRowSchema = import_zod3.z.object({
|
|
|
634
637
|
volUsd: import_zod3.z.number().nullable(),
|
|
635
638
|
fundAprPct: import_zod3.z.number().nullable(),
|
|
636
639
|
oiUsd: import_zod3.z.number().nullable(),
|
|
637
|
-
setup: agentSetupSchema.nullable()
|
|
640
|
+
setup: agentSetupSchema.nullable(),
|
|
641
|
+
/** Coin limits and the book; absent from older data-bridges. */
|
|
642
|
+
maxLev: import_zod3.z.number().nullish(),
|
|
643
|
+
spreadBps: import_zod3.z.number().nullish(),
|
|
644
|
+
slip10kBps: import_zod3.z.number().nullish(),
|
|
645
|
+
slip100kBps: import_zod3.z.number().nullish(),
|
|
646
|
+
depth1pctUsd: import_zod3.z.number().nullish()
|
|
638
647
|
});
|
|
639
648
|
var agentMarketSchema = import_zod3.z.object({
|
|
640
649
|
asOf: import_zod3.z.string().nullable(),
|
|
@@ -2798,6 +2807,7 @@ function renderCoin(c, you, now = Date.now()) {
|
|
|
2798
2807
|
const vs = sm?.side ? entryText(sm.side, sm.edgePct) : null;
|
|
2799
2808
|
lines.push(`price | ${price(mk.px)}${vs ? ` (${vs})` : ""} \xB7 15m ${pct(mk.r15m)} \xB7 1h ${pct(mk.r1h)} \xB7 24h ${pct(mk.r24h)}`);
|
|
2800
2809
|
lines.push(`setup | ${mk.setup ?? "n/a"} \xB7 funding ${pct(mk.fundAprPct, 0)} APR \xB7 open interest ${usd(mk.oiUsd)} \xB7 vol ${usd(mk.volUsd)}`);
|
|
2810
|
+
lines.push(tradingLine(mk, now));
|
|
2801
2811
|
} else lines.push("price | no market data for this coin");
|
|
2802
2812
|
if (sm && sm.flow1hUsd !== 0) lines.push(`flow | ${usd(Math.abs(sm.flow1hUsd))} net toward ${sm.flow1hUsd > 0 ? "long" : "short"} in the last hour`);
|
|
2803
2813
|
if (sm?.pileIn) lines.push(`pile-in | ${pileText(sm.pileIn, now)}`);
|
|
@@ -2812,6 +2822,20 @@ function renderCoin(c, you, now = Date.now()) {
|
|
|
2812
2822
|
if (c.note) lines.push(c.note);
|
|
2813
2823
|
return lines.join("\n");
|
|
2814
2824
|
}
|
|
2825
|
+
var MIN_ORDER_USD = 10;
|
|
2826
|
+
var bps = (v) => v === null || v === void 0 || !Number.isFinite(v) ? "n/a" : `${trim(v, 2)} bps`;
|
|
2827
|
+
function tradingLine(mk, now = Date.now()) {
|
|
2828
|
+
const parts = [`max ${mk.maxLev ? `${trim(mk.maxLev, 0)}x` : "n/a"}`, `min order $${MIN_ORDER_USD}`];
|
|
2829
|
+
if (mk.spreadBps !== null && mk.spreadBps !== void 0) parts.push(`spread ${bps(mk.spreadBps)}`);
|
|
2830
|
+
if (mk.slip10kBps !== null && mk.slip10kBps !== void 0) parts.push(`$10k market order slips ${bps(mk.slip10kBps)}, $100k ${bps(mk.slip100kBps)}`);
|
|
2831
|
+
if (mk.depth1pctUsd !== null && mk.depth1pctUsd !== void 0) parts.push(`${usd(mk.depth1pctUsd)} within 1%`);
|
|
2832
|
+
if (mk.fundAprPct !== null) {
|
|
2833
|
+
const hourly = mk.fundAprPct / (24 * 365);
|
|
2834
|
+
const mins = Math.max(1, Math.ceil((36e5 - now % 36e5) / 6e4));
|
|
2835
|
+
parts.push(`funding ${hourly > 0 ? "+" : ""}${hourly.toFixed(4)}%/h (${hourly >= 0 ? "longs pay" : "shorts pay"}), next in ${mins}m`);
|
|
2836
|
+
}
|
|
2837
|
+
return `trading | ${parts.join(" \xB7 ")}`;
|
|
2838
|
+
}
|
|
2815
2839
|
function renderAccount(p, orders, summary) {
|
|
2816
2840
|
const lines = [
|
|
2817
2841
|
`account \xB7 value ${usd(p.totalBalance)} \xB7 free ${usd(p.availableBalance)} \xB7 margin used ${usd(p.totalMargin)} \xB7 open PnL ${usd(p.unrealizedPnl, true)}`
|
|
@@ -3345,13 +3369,15 @@ function createLeanToolDefinitions(services) {
|
|
|
3345
3369
|
}
|
|
3346
3370
|
async function protectionFor(input) {
|
|
3347
3371
|
if (input.side === "short" && (input.tp_pct ?? 0) >= 100) throw new Error("A short can gain at most 100%: tp_pct must be under 100");
|
|
3372
|
+
const m = await withSession(auth, READ, (token) => dataBridge.getAgentMarket(token, { coins: [input.coin], limit: 1 })).catch(() => null);
|
|
3373
|
+
if (m && !m.ok) return { pending: m.pending };
|
|
3374
|
+
const row = m?.value?.rows?.find((r) => sameCoinName(r.coin, input.coin)) ?? null;
|
|
3375
|
+
if (row?.maxLev && input.leverage && input.leverage > row.maxLev)
|
|
3376
|
+
throw new Error(`${input.coin} allows at most ${row.maxLev}x on Hyperliquid: lower leverage. Nothing was sent.`);
|
|
3377
|
+
if (input.leverage && input.margin_usd && input.margin_usd * input.leverage < MIN_ORDER_USD)
|
|
3378
|
+
throw new Error(`Order value $${(input.margin_usd * input.leverage).toFixed(2)} is under Hyperliquid's $${MIN_ORDER_USD} minimum (margin x leverage). Nothing was sent.`);
|
|
3348
3379
|
if (!input.sl_pct && !input.tp_pct) return { value: void 0 };
|
|
3349
|
-
|
|
3350
|
-
if (ref === null) {
|
|
3351
|
-
const m = await withSession(auth, READ, (token) => dataBridge.getAgentMarket(token, { coins: [input.coin], limit: 1 }));
|
|
3352
|
-
if (!m.ok) return { pending: m.pending };
|
|
3353
|
-
ref = m.value.rows[0]?.px ?? null;
|
|
3354
|
-
}
|
|
3380
|
+
const ref = input.limit_px ?? row?.px ?? null;
|
|
3355
3381
|
if (ref === null) throw new Error(`No price for ${input.coin} to place the stop from; trade without sl_pct/tp_pct, then use protect`);
|
|
3356
3382
|
const long = input.side === "long";
|
|
3357
3383
|
const at = (p, away) => Number((p * (1 + away / 100)).toPrecision(6));
|
|
@@ -3364,9 +3390,16 @@ function createLeanToolDefinitions(services) {
|
|
|
3364
3390
|
}
|
|
3365
3391
|
return { smBoard, smMoves, smCoin, market, account, trade, protect, trades, candles };
|
|
3366
3392
|
}
|
|
3393
|
+
function practiceOnly(tool) {
|
|
3394
|
+
return {
|
|
3395
|
+
...tool,
|
|
3396
|
+
description: `Practice account only on this link (no real money). ${tool.description}`,
|
|
3397
|
+
execute: (input) => tool.execute({ ...input, paper: true })
|
|
3398
|
+
};
|
|
3399
|
+
}
|
|
3367
3400
|
function leanToolsFor(tools, profile) {
|
|
3368
3401
|
const reads = [tools.smBoard, tools.smMoves, tools.smCoin, tools.market];
|
|
3369
|
-
const list = profile === "signals" ? [...reads, tools.account, tools.trades, tools.candles] : [...reads, tools.account, tools.trades, tools.trade, tools.protect, tools.candles];
|
|
3402
|
+
const list = profile === "signals" ? [...reads, tools.account, tools.trades, practiceOnly(tools.trade), practiceOnly(tools.protect), tools.candles] : [...reads, tools.account, tools.trades, tools.trade, tools.protect, tools.candles];
|
|
3370
3403
|
return list;
|
|
3371
3404
|
}
|
|
3372
3405
|
|
|
@@ -4176,7 +4209,7 @@ async function createHeliosAgentMcpServer(options) {
|
|
|
4176
4209
|
const server = new McpServer(
|
|
4177
4210
|
{
|
|
4178
4211
|
name: "helios",
|
|
4179
|
-
version: "0.
|
|
4212
|
+
version: "0.5.0"
|
|
4180
4213
|
},
|
|
4181
4214
|
// Caps the array elements plus object keys one tools/call may carry (GHSA-46jr-4wx8-v453: without it, one request
|
|
4182
4215
|
// under the body size limit could run the hosted server out of memory while validating). The largest real input is
|
|
@@ -4314,6 +4347,7 @@ function registerTool(server, tool) {
|
|
|
4314
4347
|
HeliosAgentMcpTradingService,
|
|
4315
4348
|
MAX_TOOL_INPUT_ELEMENTS,
|
|
4316
4349
|
MCP_PROFILES,
|
|
4350
|
+
MIN_ORDER_USD,
|
|
4317
4351
|
MemoryAgentMcpSessionStore,
|
|
4318
4352
|
TRADE_KEY_WINDOW_SECONDS,
|
|
4319
4353
|
accountInputSchema,
|
|
@@ -4341,6 +4375,7 @@ function registerTool(server, tool) {
|
|
|
4341
4375
|
pct,
|
|
4342
4376
|
pendingAgentLoginSchema,
|
|
4343
4377
|
positionLine,
|
|
4378
|
+
practiceOnly,
|
|
4344
4379
|
price,
|
|
4345
4380
|
protectInputSchema,
|
|
4346
4381
|
renderAccount,
|
|
@@ -4360,6 +4395,7 @@ function registerTool(server, tool) {
|
|
|
4360
4395
|
tradeKeyFor,
|
|
4361
4396
|
trader,
|
|
4362
4397
|
tradesInputSchema,
|
|
4398
|
+
tradingLine,
|
|
4363
4399
|
usd,
|
|
4364
4400
|
withDataText,
|
|
4365
4401
|
withSnapshotDefaults,
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
HeliosAgentMcpTradingService,
|
|
15
15
|
MAX_TOOL_INPUT_ELEMENTS,
|
|
16
16
|
MCP_PROFILES,
|
|
17
|
+
MIN_ORDER_USD,
|
|
17
18
|
MemoryAgentMcpSessionStore,
|
|
18
19
|
TRADE_KEY_WINDOW_SECONDS,
|
|
19
20
|
accountInputSchema,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
pct,
|
|
42
43
|
pendingAgentLoginSchema,
|
|
43
44
|
positionLine,
|
|
45
|
+
practiceOnly,
|
|
44
46
|
price,
|
|
45
47
|
protectInputSchema,
|
|
46
48
|
renderAccount,
|
|
@@ -60,11 +62,12 @@ import {
|
|
|
60
62
|
tradeKeyFor,
|
|
61
63
|
trader,
|
|
62
64
|
tradesInputSchema,
|
|
65
|
+
tradingLine,
|
|
63
66
|
usd,
|
|
64
67
|
withDataText,
|
|
65
68
|
withSnapshotDefaults,
|
|
66
69
|
wrongSideTpSl
|
|
67
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-XM257Y63.mjs";
|
|
68
71
|
export {
|
|
69
72
|
DEFAULT_HELIOS_BASE_URL,
|
|
70
73
|
DEFAULT_HELIOS_SESSION_ISSUER,
|
|
@@ -81,6 +84,7 @@ export {
|
|
|
81
84
|
HeliosAgentMcpTradingService,
|
|
82
85
|
MAX_TOOL_INPUT_ELEMENTS,
|
|
83
86
|
MCP_PROFILES,
|
|
87
|
+
MIN_ORDER_USD,
|
|
84
88
|
MemoryAgentMcpSessionStore,
|
|
85
89
|
TRADE_KEY_WINDOW_SECONDS,
|
|
86
90
|
accountInputSchema,
|
|
@@ -108,6 +112,7 @@ export {
|
|
|
108
112
|
pct,
|
|
109
113
|
pendingAgentLoginSchema,
|
|
110
114
|
positionLine,
|
|
115
|
+
practiceOnly,
|
|
111
116
|
price,
|
|
112
117
|
protectInputSchema,
|
|
113
118
|
renderAccount,
|
|
@@ -127,6 +132,7 @@ export {
|
|
|
127
132
|
tradeKeyFor,
|
|
128
133
|
trader,
|
|
129
134
|
tradesInputSchema,
|
|
135
|
+
tradingLine,
|
|
130
136
|
usd,
|
|
131
137
|
withDataText,
|
|
132
138
|
withSnapshotDefaults,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgnio/helios-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Helios MCP server: connect an AI agent to your Helios account to follow the top Hyperliquid traders, read markets and your portfolio, and trade. Most apps can use the hosted URL https://helios.pgn.io/mcp instead.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://helios.pgn.io/?connect=ai",
|