flash-trade-mcp 0.3.4 → 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 -15
- 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.",
|
|
@@ -56956,7 +56959,7 @@ function registerTriggerOrderTools(server, client) {
|
|
|
56956
56959
|
side: exports_external.enum(["LONG", "SHORT"]).describe("Position side"),
|
|
56957
56960
|
trigger_price: exports_external.string().max(32).describe('Trigger price in UI format, e.g. "160.00"'),
|
|
56958
56961
|
size_amount: exports_external.string().max(32).describe('Size in target token to close when triggered, e.g. "0.5"'),
|
|
56959
|
-
is_stop_loss:
|
|
56962
|
+
is_stop_loss: zBool.describe("true = stop-loss, false = take-profit"),
|
|
56960
56963
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey (must own the position)")
|
|
56961
56964
|
}
|
|
56962
56965
|
}, async (params) => {
|
|
@@ -56993,7 +56996,7 @@ Transaction (base64, unsigned — sign with wallet):`);
|
|
|
56993
56996
|
order_id: exports_external.coerce.number().describe("Index of the trigger order to edit (0-7)"),
|
|
56994
56997
|
trigger_price: exports_external.string().max(32).describe("New trigger price in UI format"),
|
|
56995
56998
|
size_amount: exports_external.string().max(32).describe("New size in target token"),
|
|
56996
|
-
is_stop_loss:
|
|
56999
|
+
is_stop_loss: zBool.describe("true = stop-loss, false = take-profit"),
|
|
56997
57000
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey (must be original order owner)")
|
|
56998
57001
|
}
|
|
56999
57002
|
}, async (params) => {
|
|
@@ -57029,7 +57032,7 @@ Transaction (base64, unsigned — sign with wallet):`);
|
|
|
57029
57032
|
market_symbol: exports_external.string().max(16).describe('Market symbol, e.g. "SOL", "BTC", "ETH"'),
|
|
57030
57033
|
side: exports_external.enum(["LONG", "SHORT"]).describe("Position side"),
|
|
57031
57034
|
order_id: exports_external.coerce.number().describe("Index of the trigger order to cancel (0-7)"),
|
|
57032
|
-
is_stop_loss:
|
|
57035
|
+
is_stop_loss: zBool.describe("true = stop-loss, false = take-profit"),
|
|
57033
57036
|
owner: exports_external.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).describe("Wallet pubkey (must own the order)")
|
|
57034
57037
|
}
|
|
57035
57038
|
}, async (params) => {
|
|
@@ -57178,7 +57181,7 @@ try {
|
|
|
57178
57181
|
const client = new FlashApiClient(config2);
|
|
57179
57182
|
const server = new McpServer({
|
|
57180
57183
|
name: "flash-trade",
|
|
57181
|
-
version: "0.3.
|
|
57184
|
+
version: "0.3.5"
|
|
57182
57185
|
}, {
|
|
57183
57186
|
capabilities: {
|
|
57184
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",
|