cryptoiz-mcp 4.13.2 → 4.14.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.
Files changed (3) hide show
  1. package/index.js +90 -131
  2. package/package.json +9 -25
  3. package/README.md +0 -146
package/index.js CHANGED
@@ -2,171 +2,130 @@
2
2
 
3
3
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
4
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
- import {
6
- CallToolRequestSchema,
7
- ListToolsRequestSchema,
8
- } from '@modelcontextprotocol/sdk/types.js';
5
+ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
+ import { Connection, Keypair, PublicKey, Transaction } from '@solana/web3.js';
7
+ import bs58 from 'bs58';
9
8
 
10
9
  const EDGE_FUNCTION_URL = 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-x402-gateway';
11
10
  const DEV_SECRET = process.env.CRYPTOIZ_DEV_KEY || null;
11
+ const SVM_PRIVATE_KEY = process.env.SVM_PRIVATE_KEY || null;
12
+ const CRYPTOIZ_WALLET = 'DsKmdkYx49Xc1WhqMUAztwhdYPTqieyC98VmnnJdgpXX';
13
+ const USDC_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
14
+ const SOLANA_RPC = 'https://api.mainnet-beta.solana.com';
15
+ const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');
16
+ const ATA_PROGRAM_ID = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');
17
+
18
+ function getKeypair() {
19
+ if (!SVM_PRIVATE_KEY) return null;
20
+ try { return Keypair.fromSecretKey(bs58.decode(SVM_PRIVATE_KEY)); }
21
+ catch(e) { console.error('[Payment] Bad key:', e.message); return null; }
22
+ }
23
+
24
+ function findATA(wallet, mint) {
25
+ const [addr] = PublicKey.findProgramAddressSync(
26
+ [new PublicKey(wallet).toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), new PublicKey(mint).toBuffer()],
27
+ ATA_PROGRAM_ID
28
+ );
29
+ return addr;
30
+ }
31
+
32
+ async function sendUSDC(amount) {
33
+ const kp = getKeypair();
34
+ if (!kp) throw new Error('SVM_PRIVATE_KEY not set');
35
+ const conn = new Connection(SOLANA_RPC, 'confirmed');
36
+ const payerATA = findATA(kp.publicKey.toString(), USDC_MINT);
37
+ const recipATA = findATA(CRYPTOIZ_WALLET, USDC_MINT);
38
+ const tx = new Transaction();
39
+ const recipInfo = await conn.getAccountInfo(recipATA);
40
+ if (!recipInfo) {
41
+ tx.add({ keys:[
42
+ {pubkey:kp.publicKey,isSigner:true,isWritable:true},
43
+ {pubkey:recipATA,isSigner:false,isWritable:true},
44
+ {pubkey:new PublicKey(CRYPTOIZ_WALLET),isSigner:false,isWritable:false},
45
+ {pubkey:new PublicKey(USDC_MINT),isSigner:false,isWritable:false},
46
+ {pubkey:new PublicKey('11111111111111111111111111111111'),isSigner:false,isWritable:false},
47
+ {pubkey:TOKEN_PROGRAM_ID,isSigner:false,isWritable:false},
48
+ {pubkey:new PublicKey('SysvarRent111111111111111111111111111111111'),isSigner:false,isWritable:false},
49
+ ], programId:ATA_PROGRAM_ID, data:Buffer.alloc(0) });
50
+ }
51
+ const data = Buffer.alloc(9); data.writeUInt8(3,0); data.writeBigUInt64LE(BigInt(amount),1);
52
+ tx.add({ keys:[
53
+ {pubkey:payerATA,isSigner:false,isWritable:true},
54
+ {pubkey:recipATA,isSigner:false,isWritable:true},
55
+ {pubkey:kp.publicKey,isSigner:true,isWritable:false},
56
+ ], programId:TOKEN_PROGRAM_ID, data });
57
+ const {blockhash} = await conn.getLatestBlockhash('confirmed');
58
+ tx.recentBlockhash = blockhash; tx.feePayer = kp.publicKey; tx.sign(kp);
59
+ const sig = await conn.sendRawTransaction(tx.serialize(), {skipPreflight:false,preflightCommitment:'confirmed'});
60
+ await conn.confirmTransaction(sig, 'confirmed');
61
+ console.error('[Payment] Sent ' + amount + ' micro-USDC. Sig: ' + sig);
62
+ return sig;
63
+ }
12
64
 
13
65
  class CryptoIZMCPServer {
14
66
  constructor() {
15
67
  this.server = new Server(
16
- {
17
- name: 'cryptoiz-mcp',
18
- version: '4.13.2',
19
- },
20
- {
21
- capabilities: {
22
- tools: {},
23
- },
24
- }
68
+ { name: 'cryptoiz-mcp', version: '4.14.0' },
69
+ { capabilities: { tools: {} } }
25
70
  );
26
-
27
71
  this.setupToolHandlers();
28
72
  this.server.onerror = (error) => console.error('[MCP Error]', error);
29
- process.on('SIGINT', async () => {
30
- await this.server.close();
31
- process.exit(0);
32
- });
73
+ process.on('SIGINT', async () => { await this.server.close(); process.exit(0); });
33
74
  }
34
-
35
75
  setupToolHandlers() {
36
76
  this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
37
77
  tools: [
38
- {
39
- name: 'get_alpha_scanner',
40
- description: 'Get top 20 smart money accumulation signals from CryptoIZ Alpha Scanner. Returns tokens with whale/dolphin buying activity, phase alignment, and safety scores. Cost: $0.05 USDC per call.',
41
- inputSchema: {
42
- type: 'object',
43
- properties: {},
44
- },
45
- },
46
- {
47
- name: 'get_divergence',
48
- description: 'Get top 20 price-momentum divergence signals across 3 types: HIDDEN_ACCUMULATION (whales buying while price flat), BREAKOUT_ACCUMULATION (whales buying on breakout), CLASSIC_DIVERGENCE (price and smart money opposite). Cost: $0.02 USDC per call.',
49
- inputSchema: {
50
- type: 'object',
51
- properties: {
52
- tf: {
53
- type: 'string',
54
- description: 'Timeframe: "4h" (default) or "1d"',
55
- enum: ['4h', '1d'],
56
- },
57
- },
58
- },
59
- },
60
- {
61
- name: 'get_accumulation',
62
- description: 'Get top 20 tokens in accumulation phase ranked by composite score. Includes structure/holder/market scores, strength labels, and tier holder delta data (h100_delta_4h, h1k_delta_4h, h10k_delta_4h with percentage changes). Cost: $0.02 USDC per call.',
63
- inputSchema: {
64
- type: 'object',
65
- properties: {},
66
- },
67
- },
68
- {
69
- name: 'get_btc_regime',
70
- description: 'Get Bitcoin macro regime analysis including state (bull/bear/neutral), fear & greed index, funding rates, open interest, and technical indicators (RSI, EMA, MACD). Cost: $0.01 USDC per call.',
71
- inputSchema: {
72
- type: 'object',
73
- properties: {},
74
- },
75
- },
76
- {
77
- name: 'get_token_ca',
78
- description: 'Lookup Solana token contract address by name. Returns CA, DexScreener chart link, alpha score, entry class, and phase. FREE - no payment required.',
79
- inputSchema: {
80
- type: 'object',
81
- properties: {
82
- name: {
83
- type: 'string',
84
- description: 'Token name to search for',
85
- },
86
- },
87
- required: ['name'],
88
- },
89
- },
90
- {
91
- name: 'get_status',
92
- description: 'Get CryptoIZ MCP server status, version, available tools, and pricing. FREE - no payment required.',
93
- inputSchema: {
94
- type: 'object',
95
- properties: {},
96
- },
97
- },
78
+ { name:'get_alpha_scanner', description:'Get top 20 smart money signals. Cost: $0.05 USDC.', inputSchema:{type:'object',properties:{}} },
79
+ { name:'get_divergence', description:'Get top 20 divergence signals. Cost: $0.02 USDC.', inputSchema:{type:'object',properties:{tf:{type:'string',description:'4h or 1d',enum:['4h','1d']}}} },
80
+ { name:'get_accumulation', description:'Get top 20 accumulation tokens with holder delta. Cost: $0.02 USDC.', inputSchema:{type:'object',properties:{}} },
81
+ { name:'get_btc_regime', description:'Get BTC macro regime analysis. Cost: $0.01 USDC.', inputSchema:{type:'object',properties:{}} },
82
+ { name:'get_token_ca', description:'Lookup token CA by name. FREE.', inputSchema:{type:'object',properties:{name:{type:'string',description:'Token name'}},required:['name']} },
83
+ { name:'get_status', description:'Server status and pricing. FREE.', inputSchema:{type:'object',properties:{}} },
98
84
  ],
99
85
  }));
100
-
101
86
  this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
102
87
  const { name, arguments: args } = request.params;
103
-
104
88
  try {
105
89
  const url = new URL(EDGE_FUNCTION_URL);
106
90
  url.searchParams.set('tool', name);
107
-
108
- if (name === 'get_divergence' && args.tf) {
109
- url.searchParams.set('tf', args.tf);
110
- }
111
-
112
- if (name === 'get_token_ca' && args.name) {
113
- url.searchParams.set('name', args.name);
114
- }
115
-
91
+ if (name === 'get_divergence' && args.tf) url.searchParams.set('tf', args.tf);
92
+ if (name === 'get_token_ca' && args.name) url.searchParams.set('name', args.name);
116
93
  const headers = { 'Content-Type': 'application/json' };
117
-
118
- if (DEV_SECRET) {
119
- headers['x-dev-key'] = DEV_SECRET;
120
- }
94
+ if (DEV_SECRET) headers['x-dev-key'] = DEV_SECRET;
121
95
 
122
- const response = await fetch(url.toString(), { headers });
123
-
124
- if (response.status === 402) {
125
- const paymentInfo = await response.json();
126
- return {
127
- content: [
128
- {
129
- type: 'text',
130
- text: `Payment required: ${JSON.stringify(paymentInfo, null, 2)}\n\nThis tool requires x402 micropayment. Set CRYPTOIZ_DEV_KEY environment variable for free development access, or configure x402 payment in Claude Desktop.\n\nSee setup guide: https://cryptoiz.org/McpLanding`,
131
- },
132
- ],
133
- };
134
- }
96
+ let response = await fetch(url.toString(), { headers });
135
97
 
136
- if (!response.ok) {
137
- throw new Error(`HTTP ${response.status}: ${await response.text()}`);
98
+ if (response.status === 402 && SVM_PRIVATE_KEY && !DEV_SECRET) {
99
+ const payInfo = await response.json();
100
+ const accepts = payInfo.accepts;
101
+ if (!accepts || !accepts.length) throw new Error('No payment options');
102
+ const amt = parseInt(accepts[0].amount);
103
+ console.error('[Payment] ' + name + ' requires ' + amt + ' micro-USDC');
104
+ const sig = await sendUSDC(amt);
105
+ const proof = Buffer.from(JSON.stringify({ signature: sig })).toString('base64');
106
+ response = await fetch(url.toString(), { headers: { 'Content-Type':'application/json', 'x-payment': proof } });
107
+ if (!response.ok) {
108
+ const err = await response.text();
109
+ throw new Error('Payment OK but data failed (' + response.status + '): ' + err + ' Sig: ' + sig);
110
+ }
111
+ console.error('[Payment] Success! ' + name + ' paid & received.');
138
112
  }
139
113
 
140
- const data = await response.json();
141
-
142
- return {
143
- content: [
144
- {
145
- type: 'text',
146
- text: JSON.stringify(data, null, 2),
147
- },
148
- ],
149
- };
114
+ if (response.status === 402) {
115
+ return { content:[{type:'text',text:'Payment required. Set SVM_PRIVATE_KEY in config.\nSetup: https://cryptoiz.org/McpLanding'}] };
116
+ }
117
+ if (!response.ok) throw new Error('HTTP ' + response.status + ': ' + (await response.text()));
118
+ return { content:[{type:'text',text:JSON.stringify(await response.json(), null, 2)}] };
150
119
  } catch (error) {
151
- return {
152
- content: [
153
- {
154
- type: 'text',
155
- text: `Error calling ${name}: ${error.message}`,
156
- },
157
- ],
158
- isError: true,
159
- };
120
+ return { content:[{type:'text',text:'Error calling ' + name + ': ' + error.message}], isError:true };
160
121
  }
161
122
  });
162
123
  }
163
-
164
124
  async run() {
165
125
  const transport = new StdioServerTransport();
166
126
  await this.server.connect(transport);
167
- console.error('CryptoIZ MCP Server v4.13.2 running on stdio');
127
+ console.error('CryptoIZ MCP Server v4.14.0 running on stdio');
168
128
  }
169
129
  }
170
-
171
130
  const server = new CryptoIZMCPServer();
172
131
  server.run().catch(console.error);
package/package.json CHANGED
@@ -1,36 +1,20 @@
1
1
  {
2
2
  "name": "cryptoiz-mcp",
3
- "version": "4.13.2",
3
+ "version": "4.14.0",
4
4
  "description": "CryptoIZ MCP Server - AI-powered Solana DEX trading intelligence with x402 micropayments",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
- "bin": {
8
- "cryptoiz-mcp": "./index.js"
9
- },
10
- "keywords": [
11
- "mcp",
12
- "model-context-protocol",
13
- "claude",
14
- "solana",
15
- "dex",
16
- "crypto",
17
- "trading",
18
- "x402",
19
- "micropayment",
20
- "usdc"
21
- ],
7
+ "bin": { "cryptoiz-mcp": "./index.js" },
8
+ "files": ["index.js", "package.json", "README.md"],
9
+ "keywords": ["mcp", "claude", "solana", "dex", "crypto", "x402"],
22
10
  "author": "CryptoIZ",
23
11
  "license": "MIT",
24
- "repository": {
25
- "type": "git",
26
- "url": "https://github.com/cryptoiz/cryptoiz-mcp"
27
- },
28
12
  "homepage": "https://cryptoiz.org/McpLanding",
29
13
  "dependencies": {
30
14
  "@modelcontextprotocol/sdk": "^1.0.4",
31
- "@solana/web3.js": "^1.95.8"
15
+ "@dexterai/x402": "latest",
16
+ "@solana/web3.js": "^1.95.8",
17
+ "bs58": "^6.0.0"
32
18
  },
33
- "engines": {
34
- "node": ">=18.0.0"
35
- }
36
- }
19
+ "engines": { "node": ">=18.0.0" }
20
+ }
package/README.md DELETED
@@ -1,146 +0,0 @@
1
- # CryptoIZ MCP Server
2
-
3
- AI-powered Solana DEX trading intelligence for Claude Desktop with x402 USDC micropayments.
4
-
5
- **Version:** 4.13.2
6
- **Platform:** https://cryptoiz.org
7
- **Setup Guide:** https://cryptoiz.org/McpLanding
8
-
9
- ## What's New in v4.13.2
10
-
11
- ✅ **Tier Holder Delta Support** - `get_accumulation` now returns holder change data:
12
- - `h100_delta_4h`, `h1k_delta_4h`, `h10k_delta_4h` - Holder count changes over 4h
13
- - `h100_pct_4h`, `h1k_pct_4h`, `h10k_pct_4h` - Percentage changes
14
- - `holders_over_100`, `holders_over_1k`, `holders_over_10k` - Absolute counts
15
-
16
- ## Features
17
-
18
- - 🎯 **Smart Money Signals** - Track whale & dolphin accumulation
19
- - 📊 **Divergence Scanner** - Price-momentum divergence detection
20
- - 💎 **Accumulation Tracker** - Top tokens in accumulation phase
21
- - 📈 **BTC Regime** - Bitcoin macro analysis
22
- - 🔗 **DexScreener Integration** - Direct chart links for all tokens
23
- - 💰 **x402 Micropayments** - Pay-per-call with Solana USDC
24
-
25
- ## Installation
26
-
27
- ```bash
28
- npm install -g cryptoiz-mcp
29
- ```
30
-
31
- ## Claude Desktop Setup
32
-
33
- Add to `claude_desktop_config.json`:
34
-
35
- ```json
36
- {
37
- "mcpServers": {
38
- "cryptoiz": {
39
- "command": "npx",
40
- "args": ["-y", "cryptoiz-mcp@4.13.2"],
41
- "env": {
42
- "CRYPTOIZ_DEV_KEY": "your-dev-key-here"
43
- }
44
- }
45
- }
46
- }
47
- ```
48
-
49
- **Development Mode:** Set `CRYPTOIZ_DEV_KEY` to bypass payments (contact team@cryptoiz.org)
50
- **Production Mode:** Remove `CRYPTOIZ_DEV_KEY` to enable x402 USDC payments
51
-
52
- ## Available Tools
53
-
54
- ### 1. get_alpha_scanner
55
- **Cost:** $0.05 USDC
56
- **Returns:** 20 smart money signals with:
57
- - Alpha score, entry class (EARLY/BUILDING/WATCHLIST)
58
- - Whale/dolphin deltas, accumulation/timing/safety scores
59
- - Phase alignment, confidence, risk metrics
60
- - DexScreener chart links
61
-
62
- ### 2. get_divergence
63
- **Cost:** $0.02 USDC
64
- **Params:** `tf` - Timeframe ("4h" or "1d")
65
- **Returns:** 20 divergence signals across 3 types:
66
- - HIDDEN_ACCUMULATION - Whales buying while price flat
67
- - BREAKOUT_ACCUMULATION - Whales buying on breakout
68
- - CLASSIC_DIVERGENCE - Price and smart money opposite
69
-
70
- ### 3. get_accumulation
71
- **Cost:** $0.02 USDC
72
- **Returns:** 20 accumulation tokens with:
73
- - Composite/structure/holder/market scores
74
- - Strength labels (VERY_STRONG_SMART_MONEY, FORMING, WEAK_OR_NOISY)
75
- - **NEW:** Tier holder delta data over 4h
76
- - DexScreener chart links
77
-
78
- **Example Output:**
79
- ```json
80
- {
81
- "name": "gsd",
82
- "ca": "8116V1BW9zaXUM6pVhWVaAduKrLcEBi3RGXedKTrBAGS",
83
- "chart": "https://dexscreener.com/solana/8116V1BW9zaXUM6pVhWVaAduKrLcEBi3RGXedKTrBAGS",
84
- "strength": "VERY_STRONG_SMART_MONEY",
85
- "score_composite": "86.12",
86
- "h100_delta_4h": 17,
87
- "h100_pct_4h": "3.6",
88
- "h1k_delta_4h": 10,
89
- "h1k_pct_4h": "5.1",
90
- "h10k_delta_4h": 2,
91
- "h10k_pct_4h": "8.0",
92
- "holders_over_100": 491,
93
- "holders_over_1k": 206,
94
- "holders_over_10k": 27
95
- }
96
- ```
97
-
98
- ### 4. get_btc_regime
99
- **Cost:** $0.01 USDC
100
- **Returns:** Bitcoin macro analysis:
101
- - State (bull/bear/neutral), score, price, trend
102
- - Fear & Greed Index
103
- - Funding rates, open interest
104
- - RSI, EMA, MACD indicators
105
-
106
- ### 5. get_token_ca
107
- **Cost:** FREE
108
- **Params:** `name` - Token name
109
- **Returns:** Contract address lookup with alpha score & chart link
110
-
111
- ### 6. get_status
112
- **Cost:** FREE
113
- **Returns:** Server status, version, tools list, pricing
114
-
115
- ## Payment: x402 Protocol
116
-
117
- CryptoIZ MCP uses the x402 payment protocol with Solana USDC:
118
- - **Network:** Solana mainnet
119
- - **Currency:** USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)
120
- - **Minimum:** 0.01 USDC per call
121
- - **Facilitator:** Dexter (https://x402.dexter.cash)
122
-
123
- No setup required - Claude Desktop handles payments automatically when x402 is configured.
124
-
125
- ## Changelog
126
-
127
- ### 4.13.2 (2026-04-05)
128
- - ✅ Added tier holder delta fields to `get_accumulation`
129
- - ✅ Fixed data source from `gs_holder_series_4h` to `v_holder_deltas_4h_v1`
130
- - ✅ New fields: h100/h1k/h10k delta counts, percentages, and absolute holders
131
-
132
- ### 4.9.0
133
- - Initial public release
134
- - x402 micropayment integration
135
- - 6 trading intelligence tools
136
-
137
- ## Support
138
-
139
- - **Website:** https://cryptoiz.org
140
- - **Setup Guide:** https://cryptoiz.org/McpLanding
141
- - **Twitter:** @cryptoiz_IDN
142
- - **Email:** team@cryptoiz.org
143
-
144
- ## License
145
-
146
- MIT