@dritan/mcp 0.6.1 → 0.7.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 +3 -0
- package/dist/index.js +54 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,7 @@ npm run build && npm start
|
|
|
72
72
|
- `ths_get_score`
|
|
73
73
|
- `ths_get_score_tokens_get`
|
|
74
74
|
- `ths_get_score_tokens_post`
|
|
75
|
+
- `ths_get_top_wallets`
|
|
75
76
|
- `swap_build`
|
|
76
77
|
- `swap_sign_and_broadcast`
|
|
77
78
|
- `swap_build_sign_and_broadcast`
|
|
@@ -82,12 +83,14 @@ npm run build && npm start
|
|
|
82
83
|
- Private keys never leave local files; only public address/signature are returned.
|
|
83
84
|
- `swap_sign_and_broadcast` signs locally, then broadcasts via Dritan.
|
|
84
85
|
- `auth_set_api_key` activates a key for the running MCP process without restart.
|
|
86
|
+
- `auth_set_api_key` and successful `x402_create_api_key` responses include a capability summary so agents can immediately guide users to next actions.
|
|
85
87
|
- Agent onboarding without `DRITAN_API_KEY` should present two options:
|
|
86
88
|
- Option 1: paid x402 flow (`x402_get_pricing` -> `x402_create_api_key_quote` -> user funds agent wallet -> `wallet_transfer_sol` -> `x402_create_api_key`).
|
|
87
89
|
- Option 2: user gets a free key at `https://dritan.dev`.
|
|
88
90
|
- `x402_create_api_key` auto-activates returned keys for the current MCP session.
|
|
89
91
|
- `token_get_ohlcv_chart` returns a shareable chart URL plus a ready-to-send markdown image snippet.
|
|
90
92
|
- `token_get_ohlcv_chart` supports `chartType: "line-volume" | "candlestick"` (default is `candlestick`).
|
|
93
|
+
- `ths_get_top_wallets` returns a paginated leaderboard of THS-ranked wallets (`page`, `limit`) for smart-wallet discovery workflows.
|
|
91
94
|
- Ticker workflow for chart requests: `token_search` -> extract mint -> `token_get_ohlcv` or `token_get_ohlcv_chart`.
|
|
92
95
|
- If users ask for `$WIF` style symbols, always resolve mint with `token_search` first.
|
|
93
96
|
- If Solana CLI is missing, run `system_check_prereqs` and follow returned install steps.
|
package/dist/index.js
CHANGED
|
@@ -86,6 +86,19 @@ function missingApiKeyError() {
|
|
|
86
86
|
"You can activate a key immediately with auth_set_api_key without restarting MCP.",
|
|
87
87
|
].join(" "));
|
|
88
88
|
}
|
|
89
|
+
const postAuthCapabilities = [
|
|
90
|
+
"Token intelligence: token search, price, metadata, risk, first buyers, deployer stats.",
|
|
91
|
+
"Charts: OHLCV data and shareable line-volume/candlestick chart URLs.",
|
|
92
|
+
"Wallet analytics: summary, holdings, trade history, performance, and portfolio charts.",
|
|
93
|
+
"Trader discovery: Meteora THS wallet score lookups plus top-wallet leaderboard.",
|
|
94
|
+
"Execution: build/sign/broadcast swaps and monitor wallet/DEX streams.",
|
|
95
|
+
];
|
|
96
|
+
function buildPostAuthGuidance() {
|
|
97
|
+
return {
|
|
98
|
+
capabilities: postAuthCapabilities,
|
|
99
|
+
suggestedNextPrompt: "Tell me your goal and I can proceed: token research, smart-wallet discovery, chart generation, or swap execution.",
|
|
100
|
+
};
|
|
101
|
+
}
|
|
89
102
|
function getDritanClient() {
|
|
90
103
|
const apiKey = getActiveApiKey();
|
|
91
104
|
if (!apiKey) {
|
|
@@ -112,6 +125,24 @@ function getThsClient() {
|
|
|
112
125
|
baseUrl: process.env.METEORA_THS_BASE_URL,
|
|
113
126
|
});
|
|
114
127
|
}
|
|
128
|
+
async function getThsTopWallets(ths, options = {}) {
|
|
129
|
+
const sdkMethod = ths.getTopWalletsByScore;
|
|
130
|
+
if (typeof sdkMethod === "function") {
|
|
131
|
+
return await sdkMethod.call(ths, options);
|
|
132
|
+
}
|
|
133
|
+
const baseUrl = ths.baseUrl ?? "https://ths.dritan.dev";
|
|
134
|
+
const url = new URL("/ths/top-wallets", baseUrl);
|
|
135
|
+
if (options.page !== undefined)
|
|
136
|
+
url.searchParams.set("page", String(options.page));
|
|
137
|
+
if (options.limit !== undefined)
|
|
138
|
+
url.searchParams.set("limit", String(options.limit));
|
|
139
|
+
const res = await fetch(url.toString(), { method: "GET" });
|
|
140
|
+
if (!res.ok) {
|
|
141
|
+
const text = await res.text().catch(() => "");
|
|
142
|
+
throw new Error(`Meteora THS request failed (${res.status}): ${text || res.statusText}`);
|
|
143
|
+
}
|
|
144
|
+
return (await res.json());
|
|
145
|
+
}
|
|
115
146
|
async function searchTokens(client, query, options) {
|
|
116
147
|
const sdkSearch = client.searchTokens;
|
|
117
148
|
if (typeof sdkSearch === "function") {
|
|
@@ -558,6 +589,10 @@ const thsScoreSchema = z.object({
|
|
|
558
589
|
const thsScoreTokensSchema = thsScoreSchema.extend({
|
|
559
590
|
tokenMints: z.array(z.string().min(1)).min(1).max(200),
|
|
560
591
|
});
|
|
592
|
+
const thsTopWalletsSchema = z.object({
|
|
593
|
+
page: z.number().int().min(1).optional(),
|
|
594
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
595
|
+
});
|
|
561
596
|
const swapBuildSchema = z.object({
|
|
562
597
|
walletPath: z.string().min(1).optional(),
|
|
563
598
|
userPublicKey: z.string().min(1).optional(),
|
|
@@ -988,6 +1023,17 @@ const tools = [
|
|
|
988
1023
|
},
|
|
989
1024
|
},
|
|
990
1025
|
},
|
|
1026
|
+
{
|
|
1027
|
+
name: "ths_get_top_wallets",
|
|
1028
|
+
description: "Fetch paginated top wallets ranked by THS score.",
|
|
1029
|
+
inputSchema: {
|
|
1030
|
+
type: "object",
|
|
1031
|
+
properties: {
|
|
1032
|
+
page: { type: "number" },
|
|
1033
|
+
limit: { type: "number" },
|
|
1034
|
+
},
|
|
1035
|
+
},
|
|
1036
|
+
},
|
|
991
1037
|
{
|
|
992
1038
|
name: "swap_build",
|
|
993
1039
|
description: "Build an unsigned swap transaction with Dritan.",
|
|
@@ -1082,6 +1128,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1082
1128
|
"Option 1 (paid x402): create wallet -> receive user SOL -> x402 quote -> transfer -> claim key.",
|
|
1083
1129
|
"Option 2 (free): create key at https://dritan.dev and set it with auth_set_api_key.",
|
|
1084
1130
|
],
|
|
1131
|
+
...(activeApiKey ? buildPostAuthGuidance() : {}),
|
|
1085
1132
|
});
|
|
1086
1133
|
}
|
|
1087
1134
|
case "auth_set_api_key": {
|
|
@@ -1092,6 +1139,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1092
1139
|
message: "API key activated for this MCP session without restart.",
|
|
1093
1140
|
source: runtimeApiKeySource,
|
|
1094
1141
|
preview: apiKeyPreview(activated),
|
|
1142
|
+
...buildPostAuthGuidance(),
|
|
1095
1143
|
});
|
|
1096
1144
|
}
|
|
1097
1145
|
case "dritan_health": {
|
|
@@ -1206,6 +1254,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1206
1254
|
preview: apiKeyPreview(activated),
|
|
1207
1255
|
message: "x402-created API key is active for this MCP session (no restart needed).",
|
|
1208
1256
|
};
|
|
1257
|
+
Object.assign(payload, buildPostAuthGuidance());
|
|
1209
1258
|
}
|
|
1210
1259
|
return ok(payload);
|
|
1211
1260
|
}
|
|
@@ -1433,6 +1482,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1433
1482
|
breakdown: input.breakdown,
|
|
1434
1483
|
}));
|
|
1435
1484
|
}
|
|
1485
|
+
case "ths_get_top_wallets": {
|
|
1486
|
+
const input = thsTopWalletsSchema.parse(args);
|
|
1487
|
+
const ths = getThsClient();
|
|
1488
|
+
return ok(await getThsTopWallets(ths, input));
|
|
1489
|
+
}
|
|
1436
1490
|
case "swap_build": {
|
|
1437
1491
|
const input = swapBuildSchema.parse(args);
|
|
1438
1492
|
const client = getDritanClient();
|