@0xinsider/mcp 1.0.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 +133 -0
- package/dist/cli-lib.d.ts +12 -0
- package/dist/cli-lib.d.ts.map +1 -0
- package/dist/cli-lib.js +207 -0
- package/dist/cli-lib.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +70 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +12 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +84 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +4 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +131 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +52 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/get-insider-radar.d.ts +4 -0
- package/dist/tools/get-insider-radar.d.ts.map +1 -0
- package/dist/tools/get-insider-radar.js +62 -0
- package/dist/tools/get-insider-radar.js.map +1 -0
- package/dist/tools/get-leaderboard.d.ts +4 -0
- package/dist/tools/get-leaderboard.d.ts.map +1 -0
- package/dist/tools/get-leaderboard.js +56 -0
- package/dist/tools/get-leaderboard.js.map +1 -0
- package/dist/tools/get-market-intel.d.ts +4 -0
- package/dist/tools/get-market-intel.d.ts.map +1 -0
- package/dist/tools/get-market-intel.js +42 -0
- package/dist/tools/get-market-intel.js.map +1 -0
- package/dist/tools/get-trader.d.ts +4 -0
- package/dist/tools/get-trader.d.ts.map +1 -0
- package/dist/tools/get-trader.js +52 -0
- package/dist/tools/get-trader.js.map +1 -0
- package/dist/tools/get-whale-trades.d.ts +4 -0
- package/dist/tools/get-whale-trades.d.ts.map +1 -0
- package/dist/tools/get-whale-trades.js +60 -0
- package/dist/tools/get-whale-trades.js.map +1 -0
- package/dist/tools/search-markets.d.ts +4 -0
- package/dist/tools/search-markets.d.ts.map +1 -0
- package/dist/tools/search-markets.js +51 -0
- package/dist/tools/search-markets.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerPrompts(server) {
|
|
3
|
+
server.registerPrompt("analyze_trader", {
|
|
4
|
+
title: "Analyze Trader",
|
|
5
|
+
description: "Deep analysis of a prediction market trader — performance, strategy, risk profile, and actionable insights",
|
|
6
|
+
argsSchema: {
|
|
7
|
+
address: z.string().describe("Ethereum wallet address (0x...)"),
|
|
8
|
+
},
|
|
9
|
+
}, ({ address }) => ({
|
|
10
|
+
messages: [{
|
|
11
|
+
role: "user",
|
|
12
|
+
content: {
|
|
13
|
+
type: "text",
|
|
14
|
+
text: `Analyze the prediction market trader at address ${address}. Use the get_trader tool with all expand fields (strategy, categories, quant_metrics) to get comprehensive data.
|
|
15
|
+
|
|
16
|
+
Provide:
|
|
17
|
+
1. **Overview** — Grade, score, rank, and what tier they fall in
|
|
18
|
+
2. **P&L Analysis** — Total, realized vs unrealized, recent trends (7d/30d)
|
|
19
|
+
3. **Strategy** — What type of trader they are and how they operate
|
|
20
|
+
4. **Risk Profile** — Sharpe ratio, max drawdown, Sortino ratio interpretation
|
|
21
|
+
5. **Category Strengths** — Where they perform best/worst
|
|
22
|
+
6. **Key Takeaway** — One-paragraph summary of whether this trader is worth following and why`,
|
|
23
|
+
},
|
|
24
|
+
}],
|
|
25
|
+
}));
|
|
26
|
+
server.registerPrompt("market_report", {
|
|
27
|
+
title: "Market Report",
|
|
28
|
+
description: "Smart money flow report for a prediction market — who's buying, who's selling, and what it means",
|
|
29
|
+
argsSchema: {
|
|
30
|
+
query: z.string().describe("Market name or topic to search for"),
|
|
31
|
+
},
|
|
32
|
+
}, ({ query }) => ({
|
|
33
|
+
messages: [{
|
|
34
|
+
role: "user",
|
|
35
|
+
content: {
|
|
36
|
+
type: "text",
|
|
37
|
+
text: `Generate a smart money report for prediction markets matching "${query}".
|
|
38
|
+
|
|
39
|
+
Steps:
|
|
40
|
+
1. Use search_markets to find relevant markets
|
|
41
|
+
2. For the top 1-3 active markets, use get_market_intel to get flow data
|
|
42
|
+
3. Check get_whale_trades filtered to relevant categories
|
|
43
|
+
|
|
44
|
+
Report should include:
|
|
45
|
+
- **Market Overview** — What markets exist for this topic
|
|
46
|
+
- **Smart Money Flow** — Net direction (YES/NO), volume breakdown
|
|
47
|
+
- **Key Whale Trades** — Notable recent large trades
|
|
48
|
+
- **Top Positioned Traders** — Highest-grade traders with positions
|
|
49
|
+
- **Signal Summary** — What the smart money is telling us`,
|
|
50
|
+
},
|
|
51
|
+
}],
|
|
52
|
+
}));
|
|
53
|
+
server.registerPrompt("trading_signals", {
|
|
54
|
+
title: "Trading Signals",
|
|
55
|
+
description: "Scan for high-conviction trading signals across prediction markets",
|
|
56
|
+
argsSchema: {
|
|
57
|
+
category: z.string().optional().describe("Optional category filter (e.g., 'Politics', 'Crypto', 'Sports')"),
|
|
58
|
+
},
|
|
59
|
+
}, ({ category }) => {
|
|
60
|
+
const categoryFilter = category ? ` focused on the "${category}" category` : "";
|
|
61
|
+
return {
|
|
62
|
+
messages: [{
|
|
63
|
+
role: "user",
|
|
64
|
+
content: {
|
|
65
|
+
type: "text",
|
|
66
|
+
text: `Scan for high-conviction prediction market trading signals${categoryFilter}.
|
|
67
|
+
|
|
68
|
+
Steps:
|
|
69
|
+
1. Check get_whale_trades with min_grade "A" to find what top traders are buying/selling
|
|
70
|
+
2. Use get_leaderboard to see who the top traders are${category ? ` in the ${category} category` : ""}
|
|
71
|
+
3. Check get_insider_radar for any suspicious activity flags
|
|
72
|
+
4. For markets with concentrated smart money flow, use get_market_intel for deeper analysis
|
|
73
|
+
|
|
74
|
+
Present findings as:
|
|
75
|
+
- **Strong Signals** — Markets where multiple A/S-grade traders are positioned the same way
|
|
76
|
+
- **Emerging Patterns** — New whale activity or unusual volume
|
|
77
|
+
- **Risk Flags** — Any insider radar flags or suspicious patterns to be aware of
|
|
78
|
+
- **Actionable Summary** — Top 3 most interesting opportunities with conviction level`,
|
|
79
|
+
},
|
|
80
|
+
}],
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,cAAc,CACnB,gBAAgB,EAChB;QACE,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,4GAA4G;QACzH,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;SAChE;KACF,EACD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAChB,QAAQ,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,mDAAmD,OAAO;;;;;;;;8FAQoB;iBACrF;aACF,CAAC;KACH,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,cAAc,CACnB,eAAe,EACf;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,kGAAkG;QAC/G,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAo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 +1,131 @@
|
|
|
1
|
+
import { ApiError } from "../client.js";
|
|
2
|
+
import { SITE_URL } from "../constants.js";
|
|
3
|
+
export function registerResources(server, client) {
|
|
4
|
+
// API documentation resource
|
|
5
|
+
server.registerResource("api-docs", "oxinsider://docs/api", {
|
|
6
|
+
description: "Complete 0xinsider API reference — endpoints, authentication, rate limits, response format",
|
|
7
|
+
mimeType: "text/markdown",
|
|
8
|
+
}, async () => {
|
|
9
|
+
try {
|
|
10
|
+
const response = await fetch(`${SITE_URL}/llms-full.txt`);
|
|
11
|
+
if (!response.ok) {
|
|
12
|
+
console.error(`api-docs fetch returned HTTP ${response.status}`);
|
|
13
|
+
return {
|
|
14
|
+
contents: [{
|
|
15
|
+
uri: "oxinsider://docs/api",
|
|
16
|
+
mimeType: "text/plain",
|
|
17
|
+
text: `Error: failed to fetch API docs (HTTP ${response.status})`,
|
|
18
|
+
}],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const text = await response.text();
|
|
22
|
+
return {
|
|
23
|
+
contents: [{
|
|
24
|
+
uri: "oxinsider://docs/api",
|
|
25
|
+
mimeType: "text/markdown",
|
|
26
|
+
text,
|
|
27
|
+
}],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error("api-docs fetch error:", error);
|
|
32
|
+
return {
|
|
33
|
+
contents: [{
|
|
34
|
+
uri: "oxinsider://docs/api",
|
|
35
|
+
mimeType: "text/plain",
|
|
36
|
+
text: `Error: ${error}`,
|
|
37
|
+
}],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
// Agent instructions resource
|
|
42
|
+
server.registerResource("agent-instructions", "oxinsider://docs/agents", {
|
|
43
|
+
description: "Decision tree and best practices for AI agents using the 0xinsider API",
|
|
44
|
+
mimeType: "text/markdown",
|
|
45
|
+
}, async () => {
|
|
46
|
+
try {
|
|
47
|
+
const response = await fetch(`${SITE_URL}/agents.md`);
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
console.error(`agent-instructions fetch returned HTTP ${response.status}`);
|
|
50
|
+
return {
|
|
51
|
+
contents: [{
|
|
52
|
+
uri: "oxinsider://docs/agents",
|
|
53
|
+
mimeType: "text/plain",
|
|
54
|
+
text: `Error: failed to fetch agent instructions (HTTP ${response.status})`,
|
|
55
|
+
}],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const text = await response.text();
|
|
59
|
+
return {
|
|
60
|
+
contents: [{
|
|
61
|
+
uri: "oxinsider://docs/agents",
|
|
62
|
+
mimeType: "text/markdown",
|
|
63
|
+
text,
|
|
64
|
+
}],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error("agent-instructions fetch error:", error);
|
|
69
|
+
return {
|
|
70
|
+
contents: [{
|
|
71
|
+
uri: "oxinsider://docs/agents",
|
|
72
|
+
mimeType: "text/plain",
|
|
73
|
+
text: `Error: ${error}`,
|
|
74
|
+
}],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// Leaderboard resource
|
|
79
|
+
server.registerResource("leaderboard", "oxinsider://data/leaderboard", {
|
|
80
|
+
description: "Current top 20 prediction market traders by composite score (grades S/A/B)",
|
|
81
|
+
mimeType: "application/json",
|
|
82
|
+
}, async () => {
|
|
83
|
+
try {
|
|
84
|
+
const response = await client.request("/api/v1/leaderboard", { limit: 20 });
|
|
85
|
+
return {
|
|
86
|
+
contents: [{
|
|
87
|
+
uri: "oxinsider://data/leaderboard",
|
|
88
|
+
mimeType: "application/json",
|
|
89
|
+
text: JSON.stringify(response.data, null, 2),
|
|
90
|
+
}],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
const message = error instanceof ApiError ? error.message : `Error: ${error}`;
|
|
95
|
+
return {
|
|
96
|
+
contents: [{
|
|
97
|
+
uri: "oxinsider://data/leaderboard",
|
|
98
|
+
mimeType: "text/plain",
|
|
99
|
+
text: message,
|
|
100
|
+
}],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
// Recent whale trades resource
|
|
105
|
+
server.registerResource("whale-trades", "oxinsider://data/whale-trades", {
|
|
106
|
+
description: "Latest 20 whale trades (>$5000) from graded prediction market traders",
|
|
107
|
+
mimeType: "application/json",
|
|
108
|
+
}, async () => {
|
|
109
|
+
try {
|
|
110
|
+
const response = await client.request("/api/v1/whale-trades", { limit: 20 });
|
|
111
|
+
return {
|
|
112
|
+
contents: [{
|
|
113
|
+
uri: "oxinsider://data/whale-trades",
|
|
114
|
+
mimeType: "application/json",
|
|
115
|
+
text: JSON.stringify(response.data, null, 2),
|
|
116
|
+
}],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
const message = error instanceof ApiError ? error.message : `Error: ${error}`;
|
|
121
|
+
return {
|
|
122
|
+
contents: [{
|
|
123
|
+
uri: "oxinsider://data/whale-trades",
|
|
124
|
+
mimeType: "text/plain",
|
|
125
|
+
text: message,
|
|
126
|
+
}],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAiB;IACpE,6BAA6B;IAC7B,MAAM,CAAC,gBAAgB,CACrB,UAAU,EACV,sBAAsB,EACtB;QACE,WAAW,EAAE,4FAA4F;QACzG,QAAQ,EAAE,eAAe;KAC1B,EACD,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG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,CAAC;AAmCpE,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAmBvF;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAY/C"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { ApiClient } from "./client.js";
|
|
4
|
+
import { registerGetTrader } from "./tools/get-trader.js";
|
|
5
|
+
import { registerGetWhaleTrades } from "./tools/get-whale-trades.js";
|
|
6
|
+
import { registerGetLeaderboard } from "./tools/get-leaderboard.js";
|
|
7
|
+
import { registerSearchMarkets } from "./tools/search-markets.js";
|
|
8
|
+
import { registerGetMarketIntel } from "./tools/get-market-intel.js";
|
|
9
|
+
import { registerGetInsiderRadar } from "./tools/get-insider-radar.js";
|
|
10
|
+
import { registerResources } from "./resources/index.js";
|
|
11
|
+
import { registerPrompts } from "./prompts/index.js";
|
|
12
|
+
import { API_KEY_ENV_VAR, API_URL_ENV_VAR, DEVELOPERS_URL, SERVER_NAME, SITE_URL, VERSION, } from "./constants.js";
|
|
13
|
+
async function fetchInstructions() {
|
|
14
|
+
try {
|
|
15
|
+
const response = await fetch(`${SITE_URL}/agents.md`);
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
console.error(`Warning: agents.md fetch returned HTTP ${response.status}`);
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return await response.text();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
// Non-fatal. The server can still function without extra instructions.
|
|
24
|
+
console.error(`Warning: Could not fetch agent instructions from ${SITE_URL}/agents.md:`, error);
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function createServer(apiKey, baseUrl) {
|
|
29
|
+
const client = new ApiClient(apiKey, baseUrl);
|
|
30
|
+
const instructions = await fetchInstructions();
|
|
31
|
+
const server = new McpServer({ name: SERVER_NAME, version: VERSION }, { instructions });
|
|
32
|
+
registerGetTrader(server, client);
|
|
33
|
+
registerGetWhaleTrades(server, client);
|
|
34
|
+
registerGetLeaderboard(server, client);
|
|
35
|
+
registerSearchMarkets(server, client);
|
|
36
|
+
registerGetMarketIntel(server, client);
|
|
37
|
+
registerGetInsiderRadar(server, client);
|
|
38
|
+
registerResources(server, client);
|
|
39
|
+
registerPrompts(server);
|
|
40
|
+
return server;
|
|
41
|
+
}
|
|
42
|
+
export async function runServer() {
|
|
43
|
+
const apiKey = process.env[API_KEY_ENV_VAR];
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
throw new Error(`${API_KEY_ENV_VAR} environment variable is required. Get your API key at ${DEVELOPERS_URL}`);
|
|
46
|
+
}
|
|
47
|
+
const server = await createServer(apiKey, process.env[API_URL_ENV_VAR]);
|
|
48
|
+
const transport = new StdioServerTransport();
|
|
49
|
+
await server.connect(transport);
|
|
50
|
+
console.error(`${SERVER_NAME} MCP server running via stdio`);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACl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,CAAC;IACvC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,GAAG,eAAe,0DAA0D,cAAc,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;IACxE,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,+BAA+B,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-insider-radar.d.ts","sourceRoot":"","sources":["../../src/tools/get-insider-radar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAEnD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CA+DlF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ApiError } from "../client.js";
|
|
3
|
+
export function registerGetInsiderRadar(server, client) {
|
|
4
|
+
server.registerTool("get_insider_radar", {
|
|
5
|
+
title: "Get Insider Radar Flags",
|
|
6
|
+
description: `Suspicious trading pattern detection — pre-resolution accumulation, coordinated wallets, unusual timing. Cursor-paginated by suspicion score (highest first).
|
|
7
|
+
|
|
8
|
+
Each flag includes:
|
|
9
|
+
- suspicion_score (0-100)
|
|
10
|
+
- severity (flag or watch)
|
|
11
|
+
- Sub-scores: timing, edge, size, fresh_wallet
|
|
12
|
+
- Evidence JSON with details
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
- limit (number, 1-100, default 20): Max results per page
|
|
16
|
+
- cursor (string, optional): Pagination cursor from previous response
|
|
17
|
+
- min_suspicion (number, 0-100, default 0): Minimum suspicion score
|
|
18
|
+
- severity (string, optional): Filter by severity: "flag" or "watch"
|
|
19
|
+
|
|
20
|
+
Returns: List of radar flags with trader, market, scores, and evidence.`,
|
|
21
|
+
inputSchema: {
|
|
22
|
+
limit: z.number().int().min(1).max(100).default(20)
|
|
23
|
+
.describe("Max results (1-100, default 20)"),
|
|
24
|
+
cursor: z.string().optional()
|
|
25
|
+
.describe("Pagination cursor from previous response"),
|
|
26
|
+
min_suspicion: z.number().min(0).max(100).default(0)
|
|
27
|
+
.describe("Minimum suspicion score (0-100)"),
|
|
28
|
+
severity: z.enum(["flag", "watch"]).optional()
|
|
29
|
+
.describe("Filter by severity level"),
|
|
30
|
+
},
|
|
31
|
+
annotations: {
|
|
32
|
+
readOnlyHint: true,
|
|
33
|
+
destructiveHint: false,
|
|
34
|
+
idempotentHint: true,
|
|
35
|
+
openWorldHint: false,
|
|
36
|
+
},
|
|
37
|
+
}, async ({ limit, cursor, min_suspicion, severity }) => {
|
|
38
|
+
try {
|
|
39
|
+
const response = await client.request("/api/v1/insider-radar", {
|
|
40
|
+
limit,
|
|
41
|
+
cursor,
|
|
42
|
+
min_suspicion,
|
|
43
|
+
severity,
|
|
44
|
+
});
|
|
45
|
+
const result = {
|
|
46
|
+
data: response.data,
|
|
47
|
+
has_more: response.has_more,
|
|
48
|
+
next_cursor: response.next_cursor,
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return {
|
|
56
|
+
isError: true,
|
|
57
|
+
content: [{ type: "text", text: error instanceof ApiError ? error.message : `Unexpected error: ${error}` }],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=get-insider-radar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-insider-radar.js","sourceRoot":"","sources":["../../src/tools/get-insider-radar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,MAAiB;IAC1E,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE;;;;;;;;;;;;;;wEAcqD;QAClE,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;iBAChD,QAAQ,CAAC,iCAAiC,CAAC;YAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;iBAC1B,QAAQ,CAAC,0CAA0C,CAAC;YACvD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;iBACjD,QAAQ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../../src/tools/get-leaderboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAEnD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAyDjF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ApiError } from "../client.js";
|
|
3
|
+
export function registerGetLeaderboard(server, client) {
|
|
4
|
+
server.registerTool("get_leaderboard", {
|
|
5
|
+
title: "Get Trader Leaderboard",
|
|
6
|
+
description: `Get the top-ranked prediction market traders (grades S, A, B only). Sorted by composite score descending. Supports cursor pagination and optional filters.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
- limit (number, 1-100, default 20): Max results per page
|
|
10
|
+
- cursor (string, optional): Pagination cursor from previous response
|
|
11
|
+
- category (string, optional): Filter by category slug
|
|
12
|
+
- strategy (string, optional): Filter by strategy type
|
|
13
|
+
|
|
14
|
+
Returns: Ranked list of traders with grade, score, P&L, volume, win rate, and strategy.`,
|
|
15
|
+
inputSchema: {
|
|
16
|
+
limit: z.number().int().min(1).max(100).default(20)
|
|
17
|
+
.describe("Max results (1-100, default 20)"),
|
|
18
|
+
cursor: z.string().optional()
|
|
19
|
+
.describe("Pagination cursor from previous response"),
|
|
20
|
+
category: z.string().optional()
|
|
21
|
+
.describe("Filter by category slug"),
|
|
22
|
+
strategy: z.string().optional()
|
|
23
|
+
.describe("Filter by strategy type"),
|
|
24
|
+
},
|
|
25
|
+
annotations: {
|
|
26
|
+
readOnlyHint: true,
|
|
27
|
+
destructiveHint: false,
|
|
28
|
+
idempotentHint: true,
|
|
29
|
+
openWorldHint: false,
|
|
30
|
+
},
|
|
31
|
+
}, async ({ limit, cursor, category, strategy }) => {
|
|
32
|
+
try {
|
|
33
|
+
const response = await client.request("/api/v1/leaderboard", {
|
|
34
|
+
limit,
|
|
35
|
+
cursor,
|
|
36
|
+
category,
|
|
37
|
+
strategy,
|
|
38
|
+
});
|
|
39
|
+
const result = {
|
|
40
|
+
data: response.data,
|
|
41
|
+
has_more: response.has_more,
|
|
42
|
+
next_cursor: response.next_cursor,
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return {
|
|
50
|
+
isError: true,
|
|
51
|
+
content: [{ type: "text", text: error instanceof ApiError ? error.message : `Unexpected error: ${error}` }],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=get-leaderboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-leaderboard.js","sourceRoot":"","sources":["../../src/tools/get-leaderboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,MAAiB;IACzE,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE;;;;;;;;wFAQqE;QAClF,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;iBAChD,QAAQ,CAAC,iCAAiC,CAAC;YAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;iBAC1B,QAAQ,CAAC,0CAA0C,CAAC;YACvD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;i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"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAEnD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CA6CjF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ApiError } from "../client.js";
|
|
3
|
+
export function registerGetMarketIntel(server, client) {
|
|
4
|
+
server.registerTool("get_market_intel", {
|
|
5
|
+
title: "Get Market Intelligence",
|
|
6
|
+
description: `Smart money flow analysis for a specific prediction market. Shows net flow direction, whale trade count, buy/sell volumes, and top graded trader positions.
|
|
7
|
+
|
|
8
|
+
Use search_markets first to find the condition_id for a market.
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
- condition_id (string, required): Market condition ID (from search_markets results)
|
|
12
|
+
- timeframe (string, optional): Lookback window: "1h", "4h", "24h", "7d" (default "24h")
|
|
13
|
+
|
|
14
|
+
Returns: Market info, smart money flow (net_flow_usd, direction YES/NO, volumes), and top 5 trader positions.`,
|
|
15
|
+
inputSchema: {
|
|
16
|
+
condition_id: z.string()
|
|
17
|
+
.describe("Market condition ID"),
|
|
18
|
+
timeframe: z.enum(["1h", "4h", "24h", "7d"]).default("24h")
|
|
19
|
+
.describe("Lookback window (default 24h)"),
|
|
20
|
+
},
|
|
21
|
+
annotations: {
|
|
22
|
+
readOnlyHint: true,
|
|
23
|
+
destructiveHint: false,
|
|
24
|
+
idempotentHint: true,
|
|
25
|
+
openWorldHint: false,
|
|
26
|
+
},
|
|
27
|
+
}, async ({ condition_id, timeframe }) => {
|
|
28
|
+
try {
|
|
29
|
+
const response = await client.request(`/api/v1/market/${encodeURIComponent(condition_id)}/intel`, { timeframe });
|
|
30
|
+
return {
|
|
31
|
+
content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
isError: true,
|
|
37
|
+
content: [{ type: "text", text: error instanceof ApiError ? error.message : `Unexpected error: ${error}` }],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=get-market-intel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-market-intel.js","sourceRoot":"","sources":["../../src/tools/get-market-intel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,MAAiB;IACzE,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE;;;;;;;;8GAQ2F;QACxG,WAAW,EAAE;YACX,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;iBACrB,QAAQ,CAAC,qBAAqB,CAAC;YAClC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;iBACxD,QAAQ,CAAC,+BAA+B,CAAC;SAC7C;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,kBAAkB,kBAAkB,CAAC,YAAY,CAAC,QAAQ,EAC1D,EAAE,SAAS,EAAE,CACd,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACnF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,YAAY,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,KAAK,EAAE,EAAE,CAAC;aACrH,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-trader.d.ts","sourceRoot":"","sources":["../../src/tools/get-trader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAY,MAAM,cAAc,CAAC;AAEnD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAyD5E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ApiError } from "../client.js";
|
|
3
|
+
export function registerGetTrader(server, client) {
|
|
4
|
+
server.registerTool("get_trader", {
|
|
5
|
+
title: "Get Trader Intelligence",
|
|
6
|
+
description: `Look up a prediction market trader by wallet address. Returns grade (S through F), P&L breakdown, win rate, and volume.
|
|
7
|
+
|
|
8
|
+
Optional expand fields for heavier data:
|
|
9
|
+
- strategy: Trading strategy classification
|
|
10
|
+
- categories: Per-category performance breakdown
|
|
11
|
+
- quant_metrics: Sharpe ratio, Sortino, max drawdown, profit factor, Kelly fraction
|
|
12
|
+
|
|
13
|
+
Unknown addresses return sync_status "unknown" (not an error).
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
- address (string, required): Ethereum wallet address (0x...)
|
|
17
|
+
- expand (string[], optional): Heavy fields to include: "strategy", "categories", "quant_metrics"
|
|
18
|
+
|
|
19
|
+
Returns: Trader profile with grade, P&L, stats, and optional expanded fields.`,
|
|
20
|
+
inputSchema: {
|
|
21
|
+
address: z.string()
|
|
22
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Must be a valid Ethereum address (0x + 40 hex chars)")
|
|
23
|
+
.describe("Ethereum wallet address (0x...)"),
|
|
24
|
+
expand: z.array(z.enum(["strategy", "categories", "quant_metrics"]))
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Optional heavy fields to include"),
|
|
27
|
+
},
|
|
28
|
+
annotations: {
|
|
29
|
+
readOnlyHint: true,
|
|
30
|
+
destructiveHint: false,
|
|
31
|
+
idempotentHint: true,
|
|
32
|
+
openWorldHint: false,
|
|
33
|
+
},
|
|
34
|
+
}, async ({ address, expand }) => {
|
|
35
|
+
try {
|
|
36
|
+
const repeatedParams = expand && expand.length > 0
|
|
37
|
+
? { "expand[]": expand }
|
|
38
|
+
: undefined;
|
|
39
|
+
const response = await client.request(`/api/v1/trader/${encodeURIComponent(address)}`, undefined, repeatedParams);
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return {
|
|
46
|
+
isError: true,
|
|
47
|
+
content: [{ type: "text", text: error instanceof ApiError ? error.message : `Unexpected error: ${error}` }],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=get-trader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-trader.js","sourceRoot":"","sources":["../../src/tools/get-trader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAa,QAAQ,EAA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