flash-trade-mcp 0.3.3 → 0.3.5
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/dist/index.js +18 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49544,6 +49544,17 @@ Use get_pool_data with pool_pubkey for full custody stats.`);
|
|
|
49544
49544
|
});
|
|
49545
49545
|
}
|
|
49546
49546
|
|
|
49547
|
+
// src/sanitize.ts
|
|
49548
|
+
var zBool = exports_external.preprocess((v) => {
|
|
49549
|
+
if (typeof v === "string")
|
|
49550
|
+
return v === "true";
|
|
49551
|
+
return v;
|
|
49552
|
+
}, exports_external.boolean());
|
|
49553
|
+
function sanitizeError(e) {
|
|
49554
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
49555
|
+
return msg.replace(/\[[\d,\s]{20,}\]/g, "[REDACTED]").replace(/[0-9a-fA-F]{40,}/g, "[REDACTED]").replace(/[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{40,}/g, "[REDACTED]").replace(/[A-Za-z0-9+/]{40,}={0,2}/g, "[REDACTED]");
|
|
49556
|
+
}
|
|
49557
|
+
|
|
49547
49558
|
// src/tools/open-position.ts
|
|
49548
49559
|
function formatOpenPreview(req, res) {
|
|
49549
49560
|
const lines = [
|
|
@@ -49601,7 +49612,7 @@ function registerOpenPositionTool(server, client) {
|
|
|
49601
49612
|
slippage_percentage: exports_external.string().max(8).optional().describe('Default: "0.5" (0.5%)'),
|
|
49602
49613
|
take_profit: exports_external.string().max(32).optional().describe("TP trigger price in UI format"),
|
|
49603
49614
|
stop_loss: exports_external.string().max(32).optional().describe("SL trigger price in UI format"),
|
|
49604
|
-
degen_mode:
|
|
49615
|
+
degen_mode: zBool.optional().describe("Enable degen mode (higher leverage limits)")
|
|
49605
49616
|
}
|
|
49606
49617
|
}, async (params) => {
|
|
49607
49618
|
const res = await client.openPosition({
|
|
@@ -49675,7 +49686,7 @@ function registerClosePositionTool(server, client) {
|
|
|
49675
49686
|
position_key: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Position account pubkey to close"),
|
|
49676
49687
|
input_usd: exports_external.string().max(32).describe('USD amount to close, e.g. "500.00" for full or "250.00" for partial'),
|
|
49677
49688
|
withdraw_token_symbol: exports_external.string().max(16).describe('Token to receive: "USDC", "SOL", etc.'),
|
|
49678
|
-
keep_leverage_same:
|
|
49689
|
+
keep_leverage_same: zBool.optional().describe("Keep leverage constant during partial close"),
|
|
49679
49690
|
slippage_percentage: exports_external.string().max(8).optional().describe('Default: "0.5" (0.5%)')
|
|
49680
49691
|
}
|
|
49681
49692
|
}, async (params) => {
|
|
@@ -49809,7 +49820,7 @@ function registerReversePositionTool(server, client) {
|
|
|
49809
49820
|
position_key: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Position account pubkey to reverse"),
|
|
49810
49821
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey"),
|
|
49811
49822
|
slippage_percentage: exports_external.string().max(8).optional().describe('Default: "0.5" (0.5%)'),
|
|
49812
|
-
degen_mode:
|
|
49823
|
+
degen_mode: zBool.optional().describe("Enable degen mode for the new position")
|
|
49813
49824
|
}
|
|
49814
49825
|
}, async (params) => {
|
|
49815
49826
|
const res = await client.reversePosition({
|
|
@@ -56859,14 +56870,6 @@ var $VersionedTransaction = VersionedTransaction;
|
|
|
56859
56870
|
|
|
56860
56871
|
// src/tools/sign-and-send.ts
|
|
56861
56872
|
import fs from "node:fs";
|
|
56862
|
-
|
|
56863
|
-
// src/sanitize.ts
|
|
56864
|
-
function sanitizeError(e) {
|
|
56865
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
56866
|
-
return msg.replace(/\[[\d,\s]{20,}\]/g, "[REDACTED]").replace(/[0-9a-fA-F]{40,}/g, "[REDACTED]").replace(/[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{40,}/g, "[REDACTED]").replace(/[A-Za-z0-9+/]{40,}={0,2}/g, "[REDACTED]");
|
|
56867
|
-
}
|
|
56868
|
-
|
|
56869
|
-
// src/tools/sign-and-send.ts
|
|
56870
56873
|
function registerSignAndSendTool(server) {
|
|
56871
56874
|
server.registerTool("sign_and_send", {
|
|
56872
56875
|
description: "Sign and submit a base64-encoded unsigned Solana transaction using the locally configured keypair. " + "Call this AFTER a transaction tool (open_position, close_position, add_collateral, remove_collateral, reverse_position) " + "returns a transactionBase64 string AND the user has reviewed and approved the preview. " + "The keypair is read from KEYPAIR_PATH (default: ~/.config/solana/id.json). " + "Returns the confirmed transaction signature and a Solscan link. " + "IMPORTANT: Always show the transaction preview to the user and get their approval BEFORE calling this tool. " + "This tool signs with the local keypair and submits to Solana mainnet — the action is IRREVERSIBLE. " + "NOTE: This tool never exposes private key material in its output.",
|
|
@@ -56953,17 +56956,15 @@ function registerTriggerOrderTools(server, client) {
|
|
|
56953
56956
|
description: "Place a take-profit (TP) or stop-loss (SL) trigger order on an existing position. The trigger order will automatically close part or all of the position when the price hits the trigger level. Requires an open position for the given market/side. Returns an unsigned transaction. Up to 5 trigger orders per position.",
|
|
56954
56957
|
inputSchema: {
|
|
56955
56958
|
market_symbol: exports_external.string().max(16).describe('Market symbol, e.g. "SOL", "BTC", "ETH"'),
|
|
56956
|
-
collateral_symbol: exports_external.string().max(16).describe('Collateral token, e.g. "USDC", "JITOSOL"'),
|
|
56957
56959
|
side: exports_external.enum(["LONG", "SHORT"]).describe("Position side"),
|
|
56958
56960
|
trigger_price: exports_external.string().max(32).describe('Trigger price in UI format, e.g. "160.00"'),
|
|
56959
56961
|
size_amount: exports_external.string().max(32).describe('Size in target token to close when triggered, e.g. "0.5"'),
|
|
56960
|
-
is_stop_loss:
|
|
56962
|
+
is_stop_loss: zBool.describe("true = stop-loss, false = take-profit"),
|
|
56961
56963
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey (must own the position)")
|
|
56962
56964
|
}
|
|
56963
56965
|
}, async (params) => {
|
|
56964
56966
|
const res = await client.placeTriggerOrder({
|
|
56965
56967
|
marketSymbol: params.market_symbol,
|
|
56966
|
-
collateralSymbol: params.collateral_symbol,
|
|
56967
56968
|
side: params.side,
|
|
56968
56969
|
triggerPriceUi: params.trigger_price,
|
|
56969
56970
|
sizeAmountUi: params.size_amount,
|
|
@@ -56991,18 +56992,16 @@ Transaction (base64, unsigned — sign with wallet):`);
|
|
|
56991
56992
|
description: "Edit an existing take-profit or stop-loss trigger order. Change the trigger price, size, or order type without canceling and re-placing. Requires the order_id (0-7) from get_orders. Returns an unsigned transaction.",
|
|
56992
56993
|
inputSchema: {
|
|
56993
56994
|
market_symbol: exports_external.string().max(16).describe('Market symbol, e.g. "SOL", "BTC", "ETH"'),
|
|
56994
|
-
collateral_symbol: exports_external.string().max(16).describe('Collateral token, e.g. "USDC", "JITOSOL"'),
|
|
56995
56995
|
side: exports_external.enum(["LONG", "SHORT"]).describe("Position side"),
|
|
56996
56996
|
order_id: exports_external.coerce.number().describe("Index of the trigger order to edit (0-7)"),
|
|
56997
56997
|
trigger_price: exports_external.string().max(32).describe("New trigger price in UI format"),
|
|
56998
56998
|
size_amount: exports_external.string().max(32).describe("New size in target token"),
|
|
56999
|
-
is_stop_loss:
|
|
56999
|
+
is_stop_loss: zBool.describe("true = stop-loss, false = take-profit"),
|
|
57000
57000
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey (must be original order owner)")
|
|
57001
57001
|
}
|
|
57002
57002
|
}, async (params) => {
|
|
57003
57003
|
const res = await client.editTriggerOrder({
|
|
57004
57004
|
marketSymbol: params.market_symbol,
|
|
57005
|
-
collateralSymbol: params.collateral_symbol,
|
|
57006
57005
|
side: params.side,
|
|
57007
57006
|
orderId: params.order_id,
|
|
57008
57007
|
triggerPriceUi: params.trigger_price,
|
|
@@ -57031,16 +57030,14 @@ Transaction (base64, unsigned — sign with wallet):`);
|
|
|
57031
57030
|
description: "Cancel a single take-profit or stop-loss trigger order. Requires the order_id (0-7) from get_orders. Returns an unsigned transaction.",
|
|
57032
57031
|
inputSchema: {
|
|
57033
57032
|
market_symbol: exports_external.string().max(16).describe('Market symbol, e.g. "SOL", "BTC", "ETH"'),
|
|
57034
|
-
collateral_symbol: exports_external.string().max(16).describe('Collateral token, e.g. "USDC", "JITOSOL"'),
|
|
57035
57033
|
side: exports_external.enum(["LONG", "SHORT"]).describe("Position side"),
|
|
57036
57034
|
order_id: exports_external.coerce.number().describe("Index of the trigger order to cancel (0-7)"),
|
|
57037
|
-
is_stop_loss:
|
|
57035
|
+
is_stop_loss: zBool.describe("true = stop-loss, false = take-profit"),
|
|
57038
57036
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey (must own the order)")
|
|
57039
57037
|
}
|
|
57040
57038
|
}, async (params) => {
|
|
57041
57039
|
const res = await client.cancelTriggerOrder({
|
|
57042
57040
|
marketSymbol: params.market_symbol,
|
|
57043
|
-
collateralSymbol: params.collateral_symbol,
|
|
57044
57041
|
side: params.side,
|
|
57045
57042
|
orderId: params.order_id,
|
|
57046
57043
|
isStopLoss: params.is_stop_loss,
|
|
@@ -57065,14 +57062,12 @@ Transaction (base64, unsigned — sign with wallet):`);
|
|
|
57065
57062
|
description: "Cancel ALL take-profit and stop-loss trigger orders for a market+side. Removes all TP and SL orders in one transaction. Returns an unsigned transaction.",
|
|
57066
57063
|
inputSchema: {
|
|
57067
57064
|
market_symbol: exports_external.string().max(16).describe('Market symbol, e.g. "SOL", "BTC", "ETH"'),
|
|
57068
|
-
collateral_symbol: exports_external.string().max(16).describe('Collateral token, e.g. "USDC", "JITOSOL"'),
|
|
57069
57065
|
side: exports_external.enum(["LONG", "SHORT"]).describe("Position side"),
|
|
57070
57066
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey (must own the orders)")
|
|
57071
57067
|
}
|
|
57072
57068
|
}, async (params) => {
|
|
57073
57069
|
const res = await client.cancelAllTriggerOrders({
|
|
57074
57070
|
marketSymbol: params.market_symbol,
|
|
57075
|
-
collateralSymbol: params.collateral_symbol,
|
|
57076
57071
|
side: params.side,
|
|
57077
57072
|
owner: params.owner
|
|
57078
57073
|
});
|
|
@@ -57186,7 +57181,7 @@ try {
|
|
|
57186
57181
|
const client = new FlashApiClient(config2);
|
|
57187
57182
|
const server = new McpServer({
|
|
57188
57183
|
name: "flash-trade",
|
|
57189
|
-
version: "0.3.
|
|
57184
|
+
version: "0.3.5"
|
|
57190
57185
|
}, {
|
|
57191
57186
|
capabilities: {
|
|
57192
57187
|
tools: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flash-trade-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "MCP server for Flash Trade — perpetual futures DEX on Solana. Provides AI agents with typed tools for trading, position management, and market data.",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|