helius-mcp 1.2.0 → 2.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/CHANGELOG.md +27 -0
- package/README.md +42 -30
- package/dist/http.d.ts +1 -1
- package/dist/index.js +2 -56
- package/dist/results/store.d.ts +8 -0
- package/dist/results/store.js +72 -0
- package/dist/results/types.d.ts +47 -0
- package/dist/results/types.js +1 -0
- package/dist/router/action-groups.d.ts +6 -0
- package/dist/router/action-groups.js +32 -0
- package/dist/router/action-handlers.d.ts +20 -0
- package/dist/router/action-handlers.js +125 -0
- package/dist/router/actions.d.ts +12 -0
- package/dist/router/actions.js +123 -0
- package/dist/router/catalog.d.ts +6 -0
- package/dist/router/catalog.js +388 -0
- package/dist/router/context.d.ts +5 -0
- package/dist/router/context.js +10 -0
- package/dist/router/dispatch.d.ts +4 -0
- package/dist/router/dispatch.js +276 -0
- package/dist/router/instructions.d.ts +1 -0
- package/dist/router/instructions.js +25 -0
- package/dist/router/register.d.ts +2 -0
- package/dist/router/register.js +15 -0
- package/dist/router/required-params.d.ts +9 -0
- package/dist/router/required-params.js +66 -0
- package/dist/router/responses.d.ts +29 -0
- package/dist/router/responses.js +186 -0
- package/dist/router/schemas.d.ts +216 -0
- package/dist/router/schemas.js +195 -0
- package/dist/router/telemetry.d.ts +27 -0
- package/dist/router/telemetry.js +52 -0
- package/dist/router/types.d.ts +46 -0
- package/dist/router/types.js +1 -0
- package/dist/scripts/validate-catalog.d.ts +2 -2
- package/dist/scripts/validate-catalog.js +10 -10
- package/dist/tools/accounts.js +5 -5
- package/dist/tools/assets.js +5 -5
- package/dist/tools/auth.js +392 -288
- package/dist/tools/config.js +3 -3
- package/dist/tools/das-extras.js +6 -6
- package/dist/tools/docs.js +55 -41
- package/dist/tools/enhanced-websockets.js +13 -13
- package/dist/tools/fees.js +3 -3
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +2 -80
- package/dist/tools/laserstream.js +20 -23
- package/dist/tools/network.js +41 -2
- package/dist/tools/plans.d.ts +0 -5
- package/dist/tools/plans.js +167 -12
- package/dist/tools/product-catalog.d.ts +1 -0
- package/dist/tools/product-catalog.js +51 -16
- package/dist/tools/recommend.d.ts +0 -1
- package/dist/tools/recommend.js +9 -28
- package/dist/tools/shared.d.ts +1 -0
- package/dist/tools/shared.js +10 -2
- package/dist/tools/solana-knowledge.js +23 -7
- package/dist/tools/staking.d.ts +2 -0
- package/dist/tools/staking.js +268 -0
- package/dist/tools/transactions.js +167 -3
- package/dist/tools/transfers.js +38 -43
- package/dist/tools/wallet.js +27 -16
- package/dist/tools/webhooks.js +3 -3
- package/dist/tools/zk-compression.d.ts +2 -0
- package/dist/tools/zk-compression.js +781 -0
- package/dist/utils/config.d.ts +2 -2
- package/dist/utils/config.js +68 -6
- package/dist/utils/errors.d.ts +10 -1
- package/dist/utils/errors.js +46 -12
- package/dist/utils/feedback.js +1 -4
- package/dist/utils/helius.js +2 -1
- package/dist/utils/ows.d.ts +74 -0
- package/dist/utils/ows.js +155 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/system-prompts/helius/claude.system.md +56 -25
- package/system-prompts/helius/full.md +474 -130
- package/system-prompts/helius/openai.developer.md +56 -25
- package/system-prompts/helius-dflow/claude.system.md +41 -6
- package/system-prompts/helius-dflow/full.md +581 -92
- package/system-prompts/helius-dflow/openai.developer.md +41 -6
- package/system-prompts/helius-jupiter/claude.system.md +333 -0
- package/system-prompts/helius-jupiter/full.md +5109 -0
- package/system-prompts/helius-jupiter/openai.developer.md +333 -0
- package/system-prompts/helius-okx/claude.system.md +182 -0
- package/system-prompts/helius-okx/full.md +584 -0
- package/system-prompts/helius-okx/openai.developer.md +182 -0
- package/system-prompts/helius-phantom/claude.system.md +15 -2
- package/system-prompts/helius-phantom/full.md +254 -101
- package/system-prompts/helius-phantom/openai.developer.md +15 -2
- package/system-prompts/svm/claude.system.md +1 -0
- package/system-prompts/svm/full.md +1 -0
- package/system-prompts/svm/openai.developer.md +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
9
9
|
|
|
10
|
+
## [helius-mcp@1.3.0](https://github.com/helius-labs/core-ai/compare/helius-mcp@1.2.0...helius-mcp@1.3.0) - 2026-03-12
|
|
11
|
+
|
|
12
|
+
### Merged
|
|
13
|
+
|
|
14
|
+
- feat(skills): Add Skill Versioning [`#61`](https://github.com/helius-labs/core-ai/pull/61)
|
|
15
|
+
- fix(mcp): Add Escalating Retry Guidance For Agents [`#60`](https://github.com/helius-labs/core-ai/pull/60)
|
|
16
|
+
- feat(cli): Unify Error Handling Across Commands [`#57`](https://github.com/helius-labs/core-ai/pull/57)
|
|
17
|
+
- feat(cli): Add `helius plans` Command [`#58`](https://github.com/helius-labs/core-ai/pull/58)
|
|
18
|
+
- feat(cli): Add `status` Command [`#56`](https://github.com/helius-labs/core-ai/pull/56)
|
|
19
|
+
- feat(cli): Add Client-Side Input Validation For Signup, Upgrade, and Webhooks [`#55`](https://github.com/helius-labs/core-ai/pull/55)
|
|
20
|
+
- feat(MCP): Add TPS to `getNetworkStatus` [`#53`](https://github.com/helius-labs/core-ai/pull/53)
|
|
21
|
+
- fix(cli): Silent Exit in non-JSON Mode [`#54`](https://github.com/helius-labs/core-ai/pull/54)
|
|
22
|
+
- feat(cli): Improve Messaging For Interrupted Signups [`#52`](https://github.com/helius-labs/core-ai/pull/52)
|
|
23
|
+
- feat(cli): Implement Better Error Handling With Custom Catch Block [`#51`](https://github.com/helius-labs/core-ai/pull/51)
|
|
24
|
+
- feat(cli): Add `--wait` Flag to `helius signup` [`#50`](https://github.com/helius-labs/core-ai/pull/50)
|
|
25
|
+
- chore: update CHANGELOG.md for helius-mcp@1.2.0 [`#49`](https://github.com/helius-labs/core-ai/pull/49)
|
|
26
|
+
|
|
27
|
+
## [helius-mcp@1.2.0](https://github.com/helius-labs/core-ai/compare/helius-mcp@1.0.0...helius-mcp@1.2.0) - 2026-03-08
|
|
28
|
+
|
|
29
|
+
### Merged
|
|
30
|
+
|
|
31
|
+
- Bump helius-mcp and helius-cli to 1.2.0 [`#48`](https://github.com/helius-labs/core-ai/pull/48)
|
|
32
|
+
- feat: agentic feedback loop [`#47`](https://github.com/helius-labs/core-ai/pull/47)
|
|
33
|
+
- feat(plugin): Add Temp Claude Marketplace Workaround [`#46`](https://github.com/helius-labs/core-ai/pull/46)
|
|
34
|
+
- feat(plugin): Make Helius Cursor Plugin [`#45`](https://github.com/helius-labs/core-ai/pull/45)
|
|
35
|
+
- chore: update CHANGELOG.md for helius-mcp@1.0.0 [`#44`](https://github.com/helius-labs/core-ai/pull/44)
|
|
36
|
+
|
|
10
37
|
## helius-mcp@1.0.0 - 2026-03-03
|
|
11
38
|
|
|
12
39
|
### Merged
|
package/README.md
CHANGED
|
@@ -41,21 +41,24 @@ Or set it from your AI assistant by calling the `setHeliusApiKey` tool.
|
|
|
41
41
|
|
|
42
42
|
**If you need a new account:**
|
|
43
43
|
|
|
44
|
-
The MCP includes a
|
|
44
|
+
The MCP includes a `signup` tool with three modes:
|
|
45
45
|
|
|
46
46
|
1. Call the `generateKeypair` tool — it creates a Solana wallet and returns the address
|
|
47
|
-
2.
|
|
48
|
-
3.
|
|
49
|
-
4.
|
|
47
|
+
2. Call `signup` with `mode: "link"` — returns a `paymentUrl` (e.g. `https://dashboard.helius.dev/pay/<id>`) you open in any browser to pay with any wallet
|
|
48
|
+
3. After paying in the browser, call `signup` with `mode: "resume"` — finalizes provisioning and configures the API key automatically
|
|
49
|
+
4. Or skip the browser: call `signup` with `mode: "autopay"` to pay USDC from the local keypair (wallet must hold ~0.001 SOL + the plan amount in USDC)
|
|
50
50
|
|
|
51
|
-
> **
|
|
51
|
+
> **All paid plans:** `signup` and `upgradePlan` require `email`, `firstName`, and `lastName` for new signups (every plan, including Agent).
|
|
52
52
|
|
|
53
53
|
Or do the same from the terminal:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
npx helius-cli@latest keygen
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
npx helius-cli@latest keygen # Generate keypair
|
|
57
|
+
npx helius-cli@latest signup --plan agent # Print hosted payment link
|
|
58
|
+
# (pay in browser, then:)
|
|
59
|
+
npx helius-cli@latest signup --resume # Finalize account
|
|
60
|
+
# Or autopay USDC from the local keypair:
|
|
61
|
+
npx helius-cli@latest signup --plan agent --pay
|
|
59
62
|
```
|
|
60
63
|
|
|
61
64
|
### 3. Start using tools
|
|
@@ -67,35 +70,44 @@ Ask questions in plain English — the right tool is selected automatically:
|
|
|
67
70
|
- "Get the balance of Gh9ZwEm..."
|
|
68
71
|
- "Create a webhook for \<address\>"
|
|
69
72
|
|
|
70
|
-
##
|
|
73
|
+
## Public Tool Surface
|
|
71
74
|
|
|
72
|
-
|
|
75
|
+
Helius MCP exposes 10 public tools total: 9 routed domain tools plus `expandResult`.
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
- `heliusAccount` — account setup, auth, plans, billing
|
|
78
|
+
- `heliusWallet` — wallet balances, holdings, wallet history, identity
|
|
79
|
+
- `heliusAsset` — assets, NFTs, collections, token holders
|
|
80
|
+
- `heliusTransaction` — transaction parsing and wallet transaction history
|
|
81
|
+
- `heliusChain` — chain state, token accounts, blocks, network status, stake reads
|
|
82
|
+
- `heliusStreaming` — webhook CRUD and subscription config
|
|
83
|
+
- `heliusKnowledge` — docs, guides, pricing, troubleshooting, source, blog, SIMDs
|
|
84
|
+
- `heliusWrite` — transfers and staking mutations
|
|
85
|
+
- `heliusCompression` — compressed account, balance, proof, and history actions
|
|
86
|
+
- `expandResult` — expand summary-first outputs by `resultId`
|
|
75
87
|
|
|
76
|
-
|
|
88
|
+
The 9 routed domain tools share a common shape:
|
|
77
89
|
|
|
78
|
-
|
|
90
|
+
- `action` — the Helius action name to run, such as `getBalance` or `createWebhook`
|
|
91
|
+
- domain-specific params — for example `address`, `signatures`, or `webhookURL`
|
|
92
|
+
- optional `detail` — `summary`, `standard`, or `full`
|
|
93
|
+
- telemetry fields — `_feedback`, `_feedbackTool`, `_model`
|
|
79
94
|
|
|
80
|
-
|
|
95
|
+
Each routed tool takes an `action` field with the Helius action name:
|
|
81
96
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
**Plans & Billing (5):** getHeliusPlanInfo, compareHeliusPlans, previewUpgrade, upgradePlan, payRenewal
|
|
95
|
-
|
|
96
|
-
**Docs & Guides (10):** lookupHeliusDocs, listHeliusDocTopics, getHeliusCreditsInfo, getRateLimitInfo, troubleshootError, getSenderInfo, getWebhookGuide, getLatencyComparison, getPumpFunGuide, recommendStack
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"name": "heliusWallet",
|
|
100
|
+
"arguments": {
|
|
101
|
+
"action": "getBalance",
|
|
102
|
+
"address": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
|
103
|
+
"_feedback": "initial balance check",
|
|
104
|
+
"_feedbackTool": "heliusWallet.getBalance",
|
|
105
|
+
"_model": "your-model-id"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
97
109
|
|
|
98
|
-
|
|
110
|
+
Heavy responses are summary-first. Routed tools return a compact summary plus `resultId` when the full response would be large or when `detail: "summary"` is requested. Use `expandResult` with that `resultId` to fetch a specific section, range, page, or continuation slice on demand.
|
|
99
111
|
|
|
100
112
|
## System Prompts
|
|
101
113
|
|
package/dist/http.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MCP_USER_AGENT = "helius-mcp/
|
|
1
|
+
export declare const MCP_USER_AGENT = "helius-mcp/2.0.0";
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { registerTools } from './tools/index.js';
|
|
5
|
+
import { ROUTER_INSTRUCTIONS } from './router/instructions.js';
|
|
5
6
|
import { setApiKey, setSessionSecretKey, setSessionWalletAddress } from './utils/helius.js';
|
|
6
7
|
import { getSharedApiKey, loadKeypairFromDisk } from './utils/config.js';
|
|
7
8
|
import { captureClientInfo, captureWalletAddress } from './utils/feedback.js';
|
|
@@ -12,62 +13,7 @@ const server = new McpServer({
|
|
|
12
13
|
name: 'helius-mcp',
|
|
13
14
|
version
|
|
14
15
|
}, {
|
|
15
|
-
instructions:
|
|
16
|
-
|
|
17
|
-
## Tool Routing
|
|
18
|
-
|
|
19
|
-
| Intent | Tool | Credits |
|
|
20
|
-
|--------|------|---------|
|
|
21
|
-
| SOL balance | getBalance | 1 |
|
|
22
|
-
| token balances by wallet | getTokenBalances | 10/pg |
|
|
23
|
-
| full portfolio + USD | getWalletBalances | 100 |
|
|
24
|
-
| parse tx by signature | parseTransactions | 100 |
|
|
25
|
-
| wallet transaction history | getTransactionHistory | ~110 |
|
|
26
|
-
| balance deltas/tx | getWalletHistory | 100 |
|
|
27
|
-
| sends/receives | getWalletTransfers | 100 |
|
|
28
|
-
| asset by mint (single or batch) | getAsset | 10 |
|
|
29
|
-
| wallet NFTs | getAssetsByOwner | 10 |
|
|
30
|
-
| filtered asset search / by creator or authority | searchAssets | 10 |
|
|
31
|
-
| collection NFTs | getAssetsByGroup | 10 |
|
|
32
|
-
| asset tx history (by mint) | getSignaturesForAsset | 10 |
|
|
33
|
-
| edition prints of master NFT | getNftEditions | 10 |
|
|
34
|
-
| cNFT Merkle proof (single or batch) | getAssetProof, getAssetProofBatch | 10 |
|
|
35
|
-
| raw account inspection (single or batch) | getAccountInfo | 1 |
|
|
36
|
-
| token holders by mint | getTokenHolders | ~20 |
|
|
37
|
-
| token accounts by mint or owner | getTokenAccounts | 10 |
|
|
38
|
-
| program accounts / protocol state | getProgramAccounts | 10 |
|
|
39
|
-
| network status / epoch / block height | getNetworkStatus | 3 |
|
|
40
|
-
| block data by slot | getBlock | 1 |
|
|
41
|
-
| plans/pricing | getHeliusPlanInfo | 0 |
|
|
42
|
-
| plan comparison | compareHeliusPlans | 0 |
|
|
43
|
-
| plan upgrade / billing | previewUpgrade, upgradePlan, payRenewal | 0 |
|
|
44
|
-
| rate limits/credits | getRateLimitInfo | 0 |
|
|
45
|
-
| API docs by topic | lookupHeliusDocs | 0 |
|
|
46
|
-
| error diagnosis | troubleshootError | 0 |
|
|
47
|
-
| tx sending / Jito / SWQoS | getSenderInfo | 0 |
|
|
48
|
-
| webhook setup guide | getWebhookGuide | 0 |
|
|
49
|
-
| streaming latency | getLatencyComparison | 0 |
|
|
50
|
-
| pump.fun tokens | getPumpFunGuide | 0 |
|
|
51
|
-
| project architecture / stack selection | recommendStack | 0 |
|
|
52
|
-
| Solana SIMDs / protocol proposals | getSIMD, listSIMDs | 0 |
|
|
53
|
-
| Solana source / docs search | searchSolanaDocs, readSolanaSourceFile | 0 |
|
|
54
|
-
| Helius blog posts | fetchHeliusBlog | 0 |
|
|
55
|
-
| wallet identity | getWalletIdentity | 100 |
|
|
56
|
-
| batch wallet identity | batchWalletIdentity | 100 |
|
|
57
|
-
| funding source | getWalletFundedBy | 100 |
|
|
58
|
-
| event notifications (any plan) | createWebhook | 100 |
|
|
59
|
-
| live streaming (WS, Business+) | transactionSubscribe, accountSubscribe | — |
|
|
60
|
-
| production streaming (gRPC, Pro) | laserstreamSubscribe | — |
|
|
61
|
-
| Account setup | getStarted → generateKeypair → agenticSignup | — |
|
|
62
|
-
|
|
63
|
-
Rules:
|
|
64
|
-
- For pricing, start with getHeliusPlanInfo — NOT lookupHeliusDocs.
|
|
65
|
-
- For errors, use troubleshootError first.
|
|
66
|
-
- When a user describes ANY project they want to build ("I want to build/make/create...", "help me build...", "I need a..."), call recommendStack immediately with their description — do not ask clarifying questions first. After recommendations, use getHeliusPlanInfo for pricing and lookupHeliusDocs for API details.
|
|
67
|
-
- "send SOL" / "transfer SOL" → transferSol (~3 credits). "send tokens" / "transfer USDC/BONK/etc" → transferToken (~13 credits). Both require a configured keypair (generateKeypair) and use Helius Sender.
|
|
68
|
-
|
|
69
|
-
## Feedback
|
|
70
|
-
Every tool accepts \`_feedback\` and \`_model\` params. Always include \`_model\` with your LLM model identifier (e.g. "claude-sonnet-4-20250514", "gpt-4o"). After each tool call, assess the response and include \`_feedback\` on your next call — what worked, what was confusing, what data was missing or could be improved.`
|
|
16
|
+
instructions: ROUTER_INSTRUCTIONS
|
|
71
17
|
});
|
|
72
18
|
registerTools(server);
|
|
73
19
|
// Capture MCP client identity (Cursor, Claude Code, etc.) after handshake
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoredResult } from './types.js';
|
|
2
|
+
export declare function putStoredResult(input: Omit<StoredResult, 'resultId' | 'createdAt' | 'expiresAt' | 'payloadSize'>): StoredResult;
|
|
3
|
+
export declare function getStoredResult(resultId: string, ownerSessionKey: string): StoredResult | null;
|
|
4
|
+
export declare function clearStoredResults(): void;
|
|
5
|
+
export declare function getStoredResultStats(): {
|
|
6
|
+
count: number;
|
|
7
|
+
totalPayloadBytes: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
const MAX_RESULTS = 10;
|
|
3
|
+
const MAX_TOTAL_PAYLOAD_BYTES = 250 * 1024;
|
|
4
|
+
const RESULT_TTL_MS = 5 * 60 * 1000;
|
|
5
|
+
const results = new Map();
|
|
6
|
+
function estimateBytes(value) {
|
|
7
|
+
return Buffer.byteLength(JSON.stringify(value), 'utf8');
|
|
8
|
+
}
|
|
9
|
+
function sweepExpired(now = Date.now()) {
|
|
10
|
+
for (const [resultId, result] of results) {
|
|
11
|
+
if (result.expiresAt <= now) {
|
|
12
|
+
results.delete(resultId);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function currentTotalBytes() {
|
|
17
|
+
let total = 0;
|
|
18
|
+
for (const result of results.values()) {
|
|
19
|
+
total += result.payloadSize;
|
|
20
|
+
}
|
|
21
|
+
return total;
|
|
22
|
+
}
|
|
23
|
+
function touch(resultId, result) {
|
|
24
|
+
results.delete(resultId);
|
|
25
|
+
results.set(resultId, result);
|
|
26
|
+
}
|
|
27
|
+
function evictToFit() {
|
|
28
|
+
sweepExpired();
|
|
29
|
+
while (results.size > MAX_RESULTS || currentTotalBytes() > MAX_TOTAL_PAYLOAD_BYTES) {
|
|
30
|
+
const oldest = results.keys().next().value;
|
|
31
|
+
if (!oldest) {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
results.delete(oldest);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function putStoredResult(input) {
|
|
38
|
+
const createdAt = Date.now();
|
|
39
|
+
const payloadSize = estimateBytes(input.payload);
|
|
40
|
+
const stored = {
|
|
41
|
+
...input,
|
|
42
|
+
resultId: randomUUID(),
|
|
43
|
+
createdAt,
|
|
44
|
+
expiresAt: createdAt + RESULT_TTL_MS,
|
|
45
|
+
payloadSize,
|
|
46
|
+
};
|
|
47
|
+
results.set(stored.resultId, stored);
|
|
48
|
+
evictToFit();
|
|
49
|
+
return stored;
|
|
50
|
+
}
|
|
51
|
+
export function getStoredResult(resultId, ownerSessionKey) {
|
|
52
|
+
sweepExpired();
|
|
53
|
+
const result = results.get(resultId);
|
|
54
|
+
if (!result) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (result.ownerSessionKey !== ownerSessionKey) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
touch(resultId, result);
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
export function clearStoredResults() {
|
|
64
|
+
results.clear();
|
|
65
|
+
}
|
|
66
|
+
export function getStoredResultStats() {
|
|
67
|
+
sweepExpired();
|
|
68
|
+
return {
|
|
69
|
+
count: results.size,
|
|
70
|
+
totalPayloadBytes: currentTotalBytes(),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { RoutedPublicToolName } from '../router/action-groups.js';
|
|
2
|
+
import type { ActionName } from '../router/actions.js';
|
|
3
|
+
import type { DetailLevel, ResponseFamily } from '../router/types.js';
|
|
4
|
+
export type TransactionHistoryContinuation = {
|
|
5
|
+
kind: 'signaturesQuick';
|
|
6
|
+
nextBefore?: string;
|
|
7
|
+
lastSeenSignature?: string;
|
|
8
|
+
until?: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'historyApi';
|
|
11
|
+
paginationToken?: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'rawApi';
|
|
14
|
+
paginationToken?: string;
|
|
15
|
+
};
|
|
16
|
+
export type ContinuationState = {
|
|
17
|
+
model: 'none';
|
|
18
|
+
} | {
|
|
19
|
+
model: 'page';
|
|
20
|
+
nextPage?: number;
|
|
21
|
+
} | {
|
|
22
|
+
model: 'transactionHistory';
|
|
23
|
+
next?: TransactionHistoryContinuation;
|
|
24
|
+
};
|
|
25
|
+
export type ActionRecipe = {
|
|
26
|
+
publicTool: RoutedPublicToolName;
|
|
27
|
+
action: ActionName;
|
|
28
|
+
params: Record<string, unknown>;
|
|
29
|
+
responseFamily: ResponseFamily;
|
|
30
|
+
defaultDetail: DetailLevel;
|
|
31
|
+
};
|
|
32
|
+
export type ResultPayload = {
|
|
33
|
+
recipe: ActionRecipe;
|
|
34
|
+
continuation: ContinuationState;
|
|
35
|
+
sectionHints?: string[];
|
|
36
|
+
};
|
|
37
|
+
export type StoredResult = {
|
|
38
|
+
resultId: string;
|
|
39
|
+
kind: ResponseFamily;
|
|
40
|
+
ownerSessionKey: string;
|
|
41
|
+
summary: string;
|
|
42
|
+
availableExpansions: string[];
|
|
43
|
+
createdAt: number;
|
|
44
|
+
expiresAt: number;
|
|
45
|
+
payload: ResultPayload;
|
|
46
|
+
payloadSize: number;
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ActionName } from './actions.js';
|
|
2
|
+
export declare const PUBLIC_TOOL_NAMES: readonly ["heliusAccount", "heliusWallet", "heliusAsset", "heliusTransaction", "heliusChain", "heliusStreaming", "heliusKnowledge", "heliusWrite", "heliusCompression", "expandResult"];
|
|
3
|
+
export type PublicToolName = typeof PUBLIC_TOOL_NAMES[number];
|
|
4
|
+
export type RoutedPublicToolName = Exclude<PublicToolName, 'expandResult'>;
|
|
5
|
+
export declare const ACTION_GROUPS: Record<RoutedPublicToolName, readonly ActionName[]>;
|
|
6
|
+
export declare function findPublicToolForAction(action: ActionName): RoutedPublicToolName;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HELIUS_ACCOUNT_ACTIONS, HELIUS_ASSET_ACTIONS, HELIUS_CHAIN_ACTIONS, HELIUS_COMPRESSION_ACTIONS, HELIUS_KNOWLEDGE_ACTIONS, HELIUS_STREAMING_ACTIONS, HELIUS_TRANSACTION_ACTIONS, HELIUS_WALLET_ACTIONS, HELIUS_WRITE_ACTIONS, } from './actions.js';
|
|
2
|
+
export const PUBLIC_TOOL_NAMES = [
|
|
3
|
+
'heliusAccount',
|
|
4
|
+
'heliusWallet',
|
|
5
|
+
'heliusAsset',
|
|
6
|
+
'heliusTransaction',
|
|
7
|
+
'heliusChain',
|
|
8
|
+
'heliusStreaming',
|
|
9
|
+
'heliusKnowledge',
|
|
10
|
+
'heliusWrite',
|
|
11
|
+
'heliusCompression',
|
|
12
|
+
'expandResult',
|
|
13
|
+
];
|
|
14
|
+
export const ACTION_GROUPS = {
|
|
15
|
+
heliusAccount: HELIUS_ACCOUNT_ACTIONS,
|
|
16
|
+
heliusWallet: HELIUS_WALLET_ACTIONS,
|
|
17
|
+
heliusAsset: HELIUS_ASSET_ACTIONS,
|
|
18
|
+
heliusTransaction: HELIUS_TRANSACTION_ACTIONS,
|
|
19
|
+
heliusChain: HELIUS_CHAIN_ACTIONS,
|
|
20
|
+
heliusStreaming: HELIUS_STREAMING_ACTIONS,
|
|
21
|
+
heliusKnowledge: HELIUS_KNOWLEDGE_ACTIONS,
|
|
22
|
+
heliusWrite: HELIUS_WRITE_ACTIONS,
|
|
23
|
+
heliusCompression: HELIUS_COMPRESSION_ACTIONS,
|
|
24
|
+
};
|
|
25
|
+
export function findPublicToolForAction(action) {
|
|
26
|
+
for (const [tool, actions] of Object.entries(ACTION_GROUPS)) {
|
|
27
|
+
if (actions.includes(action)) {
|
|
28
|
+
return tool;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`No public tool mapping found for action "${action}"`);
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ActionName } from './actions.js';
|
|
3
|
+
export type ActionHandlerResponse = {
|
|
4
|
+
content?: Array<{
|
|
5
|
+
type?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
}>;
|
|
8
|
+
isError?: boolean;
|
|
9
|
+
structuredContent?: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type ActionHandler = (params: Record<string, unknown>, extra: unknown) => Promise<ActionHandlerResponse> | ActionHandlerResponse;
|
|
12
|
+
export type ActionHandlerDefinition = {
|
|
13
|
+
name: ActionName;
|
|
14
|
+
description?: string;
|
|
15
|
+
inputSchema?: unknown;
|
|
16
|
+
handler: ActionHandler;
|
|
17
|
+
};
|
|
18
|
+
export declare function registerActionHandlers(server: McpServer): void;
|
|
19
|
+
export declare function getActionHandlers(): Map<ActionName, ActionHandlerDefinition>;
|
|
20
|
+
export declare function callActionHandler(action: ActionName, params: Record<string, unknown>, extra: unknown): Promise<ActionHandlerResponse>;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { registerAuthTools } from '../tools/auth.js';
|
|
3
|
+
import { registerConfigTools } from '../tools/config.js';
|
|
4
|
+
import { registerPlanTools } from '../tools/plans.js';
|
|
5
|
+
import { registerBalanceTools } from '../tools/balance.js';
|
|
6
|
+
import { registerTransactionTools } from '../tools/transactions.js';
|
|
7
|
+
import { registerAssetTools } from '../tools/assets.js';
|
|
8
|
+
import { registerAccountTools } from '../tools/accounts.js';
|
|
9
|
+
import { registerFeeTools } from '../tools/fees.js';
|
|
10
|
+
import { registerNetworkTools } from '../tools/network.js';
|
|
11
|
+
import { registerBlockTools } from '../tools/blocks.js';
|
|
12
|
+
import { registerTokenTools } from '../tools/tokens.js';
|
|
13
|
+
import { registerDasExtraTools } from '../tools/das-extras.js';
|
|
14
|
+
import { registerWebhookTools } from '../tools/webhooks.js';
|
|
15
|
+
import { registerEnhancedWebSocketTools } from '../tools/enhanced-websockets.js';
|
|
16
|
+
import { registerLaserstreamTools } from '../tools/laserstream.js';
|
|
17
|
+
import { registerWalletTools } from '../tools/wallet.js';
|
|
18
|
+
import { registerDocsTools } from '../tools/docs.js';
|
|
19
|
+
import { registerGuideTools } from '../tools/guides.js';
|
|
20
|
+
import { registerRecommendTools } from '../tools/recommend.js';
|
|
21
|
+
import { registerSolanaKnowledgeTools } from '../tools/solana-knowledge.js';
|
|
22
|
+
import { registerTransferTools } from '../tools/transfers.js';
|
|
23
|
+
import { registerZkCompressionTools } from '../tools/zk-compression.js';
|
|
24
|
+
import { registerStakingTools } from '../tools/staking.js';
|
|
25
|
+
function isZodType(value) {
|
|
26
|
+
return typeof value === 'object' && value !== null && typeof value.safeParse === 'function';
|
|
27
|
+
}
|
|
28
|
+
function buildRuntimeSchema(inputSchema) {
|
|
29
|
+
if (isZodType(inputSchema) && 'passthrough' in inputSchema && typeof inputSchema.passthrough === 'function') {
|
|
30
|
+
return inputSchema.passthrough();
|
|
31
|
+
}
|
|
32
|
+
if (!inputSchema || typeof inputSchema !== 'object' || Array.isArray(inputSchema)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const rawShape = {};
|
|
36
|
+
for (const [key, value] of Object.entries(inputSchema)) {
|
|
37
|
+
if (isZodType(value)) {
|
|
38
|
+
rawShape[key] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (Object.keys(rawShape).length === 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return z.object(rawShape).passthrough();
|
|
45
|
+
}
|
|
46
|
+
function materializeActionParams(tool, params) {
|
|
47
|
+
const schema = buildRuntimeSchema(tool.inputSchema);
|
|
48
|
+
if (!schema) {
|
|
49
|
+
return params;
|
|
50
|
+
}
|
|
51
|
+
const parsed = schema.safeParse(params);
|
|
52
|
+
if (parsed.success) {
|
|
53
|
+
return parsed.data;
|
|
54
|
+
}
|
|
55
|
+
const issue = parsed.error.issues[0];
|
|
56
|
+
const path = issue?.path?.length ? issue.path.join('.') : 'input';
|
|
57
|
+
const message = `Invalid parameters for ${tool.name}: ${path} ${issue?.message ?? 'is invalid'}`.trim();
|
|
58
|
+
throw new Error(message);
|
|
59
|
+
}
|
|
60
|
+
class ActionHandlerCollector {
|
|
61
|
+
tools = new Map();
|
|
62
|
+
tool(name, ...rest) {
|
|
63
|
+
let description;
|
|
64
|
+
let inputSchema;
|
|
65
|
+
if (typeof rest[0] === 'string') {
|
|
66
|
+
description = rest.shift();
|
|
67
|
+
}
|
|
68
|
+
if (rest.length > 1 && typeof rest[0] === 'object' && rest[0] !== null) {
|
|
69
|
+
inputSchema = rest.shift();
|
|
70
|
+
}
|
|
71
|
+
const handler = rest[0];
|
|
72
|
+
if (typeof handler !== 'function') {
|
|
73
|
+
throw new Error(`Action handler "${name}" is missing a callable handler`);
|
|
74
|
+
}
|
|
75
|
+
this.tools.set(name, {
|
|
76
|
+
name: name,
|
|
77
|
+
description,
|
|
78
|
+
inputSchema,
|
|
79
|
+
handler: handler,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
let cachedActionHandlers = null;
|
|
84
|
+
export function registerActionHandlers(server) {
|
|
85
|
+
registerAuthTools(server);
|
|
86
|
+
registerConfigTools(server);
|
|
87
|
+
registerPlanTools(server);
|
|
88
|
+
registerBalanceTools(server);
|
|
89
|
+
registerTransactionTools(server);
|
|
90
|
+
registerAssetTools(server);
|
|
91
|
+
registerAccountTools(server);
|
|
92
|
+
registerFeeTools(server);
|
|
93
|
+
registerNetworkTools(server);
|
|
94
|
+
registerBlockTools(server);
|
|
95
|
+
registerTokenTools(server);
|
|
96
|
+
registerDasExtraTools(server);
|
|
97
|
+
registerWebhookTools(server);
|
|
98
|
+
registerEnhancedWebSocketTools(server);
|
|
99
|
+
registerLaserstreamTools(server);
|
|
100
|
+
registerWalletTools(server);
|
|
101
|
+
registerDocsTools(server);
|
|
102
|
+
registerGuideTools(server);
|
|
103
|
+
registerRecommendTools(server);
|
|
104
|
+
registerSolanaKnowledgeTools(server);
|
|
105
|
+
registerTransferTools(server);
|
|
106
|
+
registerZkCompressionTools(server);
|
|
107
|
+
registerStakingTools(server);
|
|
108
|
+
}
|
|
109
|
+
export function getActionHandlers() {
|
|
110
|
+
if (cachedActionHandlers) {
|
|
111
|
+
return cachedActionHandlers;
|
|
112
|
+
}
|
|
113
|
+
const collector = new ActionHandlerCollector();
|
|
114
|
+
registerActionHandlers(collector);
|
|
115
|
+
cachedActionHandlers = collector.tools;
|
|
116
|
+
return cachedActionHandlers;
|
|
117
|
+
}
|
|
118
|
+
export async function callActionHandler(action, params, extra) {
|
|
119
|
+
const tool = getActionHandlers().get(action);
|
|
120
|
+
if (!tool) {
|
|
121
|
+
throw new Error(`No action handler registered for action "${action}"`);
|
|
122
|
+
}
|
|
123
|
+
const normalizedParams = materializeActionParams(tool, params);
|
|
124
|
+
return await Promise.resolve(tool.handler(normalizedParams, extra));
|
|
125
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const HELIUS_ACCOUNT_ACTIONS: readonly ["getStarted", "setHeliusApiKey", "generateKeypair", "signup", "getAccountStatus", "getAccountPlan", "getHeliusPlanInfo", "compareHeliusPlans", "previewUpgrade", "upgradePlan", "payRenewal", "purchaseCredits"];
|
|
2
|
+
export declare const HELIUS_WALLET_ACTIONS: readonly ["getBalance", "getTokenBalances", "getWalletBalances", "getWalletHistory", "getWalletTransfers", "getWalletIdentity", "batchWalletIdentity", "getWalletFundedBy"];
|
|
3
|
+
export declare const HELIUS_ASSET_ACTIONS: readonly ["getAsset", "getAssetsByOwner", "searchAssets", "getAssetsByGroup", "getAssetProof", "getAssetProofBatch", "getSignaturesForAsset", "getNftEditions", "getTokenHolders"];
|
|
4
|
+
export declare const HELIUS_TRANSACTION_ACTIONS: readonly ["parseTransactions", "getTransactionHistory", "getTransfersByAddress"];
|
|
5
|
+
export declare const HELIUS_CHAIN_ACTIONS: readonly ["getAccountInfo", "getTokenAccounts", "getProgramAccounts", "getBlock", "getNetworkStatus", "getPriorityFeeEstimate", "getStakeAccounts", "getWithdrawableAmount"];
|
|
6
|
+
export declare const HELIUS_STREAMING_ACTIONS: readonly ["createWebhook", "getAllWebhooks", "getWebhookByID", "updateWebhook", "deleteWebhook", "transactionSubscribe", "accountSubscribe", "laserstreamSubscribe"];
|
|
7
|
+
export declare const HELIUS_KNOWLEDGE_ACTIONS: readonly ["lookupHeliusDocs", "listHeliusDocTopics", "getHeliusCreditsInfo", "getRateLimitInfo", "troubleshootError", "recommendStack", "getSIMD", "listSIMDs", "searchSolanaDocs", "readSolanaSourceFile", "fetchHeliusBlog", "getPumpFunGuide", "getSenderInfo", "getWebhookGuide", "getLatencyComparison", "getEnhancedWebSocketInfo", "getLaserstreamInfo"];
|
|
8
|
+
export declare const HELIUS_WRITE_ACTIONS: readonly ["transferSol", "transferToken", "stakeSOL", "unstakeSOL", "withdrawStake"];
|
|
9
|
+
export declare const HELIUS_COMPRESSION_ACTIONS: readonly ["getCompressedAccount", "getCompressedAccountsByOwner", "getMultipleCompressedAccounts", "getCompressedBalance", "getCompressedBalanceByOwner", "getCompressedMintTokenHolders", "getCompressedTokenAccountBalance", "getCompressedTokenAccountsByOwner", "getCompressedTokenAccountsByDelegate", "getCompressedTokenBalancesByOwnerV2", "getCompressedAccountProof", "getMultipleCompressedAccountProofs", "getMultipleNewAddressProofs", "getCompressionSignaturesForAccount", "getCompressionSignaturesForAddress", "getCompressionSignaturesForOwner", "getCompressionSignaturesForTokenOwner", "getLatestCompressionSignatures", "getLatestNonVotingSignatures", "getTransactionWithCompressionInfo", "getValidityProof", "getIndexerHealth", "getIndexerSlot"];
|
|
10
|
+
export declare const ACTION_NAMES: readonly ["getStarted", "setHeliusApiKey", "generateKeypair", "signup", "getAccountStatus", "getAccountPlan", "getHeliusPlanInfo", "compareHeliusPlans", "previewUpgrade", "upgradePlan", "payRenewal", "purchaseCredits", "getBalance", "getTokenBalances", "getWalletBalances", "getWalletHistory", "getWalletTransfers", "getWalletIdentity", "batchWalletIdentity", "getWalletFundedBy", "getAsset", "getAssetsByOwner", "searchAssets", "getAssetsByGroup", "getAssetProof", "getAssetProofBatch", "getSignaturesForAsset", "getNftEditions", "getTokenHolders", "parseTransactions", "getTransactionHistory", "getTransfersByAddress", "getAccountInfo", "getTokenAccounts", "getProgramAccounts", "getBlock", "getNetworkStatus", "getPriorityFeeEstimate", "getStakeAccounts", "getWithdrawableAmount", "createWebhook", "getAllWebhooks", "getWebhookByID", "updateWebhook", "deleteWebhook", "transactionSubscribe", "accountSubscribe", "laserstreamSubscribe", "lookupHeliusDocs", "listHeliusDocTopics", "getHeliusCreditsInfo", "getRateLimitInfo", "troubleshootError", "recommendStack", "getSIMD", "listSIMDs", "searchSolanaDocs", "readSolanaSourceFile", "fetchHeliusBlog", "getPumpFunGuide", "getSenderInfo", "getWebhookGuide", "getLatencyComparison", "getEnhancedWebSocketInfo", "getLaserstreamInfo", "transferSol", "transferToken", "stakeSOL", "unstakeSOL", "withdrawStake", "getCompressedAccount", "getCompressedAccountsByOwner", "getMultipleCompressedAccounts", "getCompressedBalance", "getCompressedBalanceByOwner", "getCompressedMintTokenHolders", "getCompressedTokenAccountBalance", "getCompressedTokenAccountsByOwner", "getCompressedTokenAccountsByDelegate", "getCompressedTokenBalancesByOwnerV2", "getCompressedAccountProof", "getMultipleCompressedAccountProofs", "getMultipleNewAddressProofs", "getCompressionSignaturesForAccount", "getCompressionSignaturesForAddress", "getCompressionSignaturesForOwner", "getCompressionSignaturesForTokenOwner", "getLatestCompressionSignatures", "getLatestNonVotingSignatures", "getTransactionWithCompressionInfo", "getValidityProof", "getIndexerHealth", "getIndexerSlot"];
|
|
11
|
+
export type ActionName = typeof ACTION_NAMES[number];
|
|
12
|
+
export declare const ACTION_NAME_SET: Set<string>;
|