cryptoiz-mcp 3.5.0 → 4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +277 -373
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cryptoiz-mcp",
3
- "version": "3.5.0",
3
+ "version": "4.0.0",
4
4
  "description": "CryptoIZ MCP Server — Solana DEX signals with x402 micropayments. Pay $0.01 USDC per call.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -14,7 +14,7 @@ const SOL_RPC = 'https://api.mainnet-beta.solana.com';
14
14
  const AMOUNT = 10000;
15
15
 
16
16
  async function payAndFetch(url) {
17
- if (!SVM_PRIVATE_KEY) return { error: 'SVM_PRIVATE_KEY not set. Add to Claude Desktop config.' };
17
+ if (!SVM_PRIVATE_KEY) return { error: 'SVM_PRIVATE_KEY not set.' };
18
18
  const first = await fetch(url);
19
19
  if (first.status !== 402) return first.json();
20
20
  try {
@@ -34,370 +34,329 @@ async function payAndFetch(url) {
34
34
  }
35
35
 
36
36
  const N = (v, d=2) => v != null && v !== 'N/A' ? parseFloat(v).toFixed(d) : 'N/A';
37
- const sign = v => { const n = parseFloat(v); return n > 0 ? `+${n}` : `${n}`; };
38
- const risk = (v, label) => parseFloat(v||0) > 0 ? `⚠ WARNING ${parseFloat(v).toFixed(1)}% — ${label}` : '✅ CLEAR';
39
- const mc = v => v || 'N/A';
40
- const pct = v => v != null ? `${parseFloat(v).toFixed(2)}%` : 'N/A';
41
-
42
- const HEADER = (tool, subtitle, url) => [
43
- `DATA_PROVIDER : CryptoIZ AI Trading Platform`,
44
- `TOOL : ${tool}`,
45
- `FULL_DASHBOARD : https://cryptoiz.org/${url}`,
46
- `SUBSCRIBE_PLANS : https://cryptoiz.org/Pricing (1W $15 | 1M $50 | 3M $120 | 1Y $400)`,
47
- `TWITTER : https://twitter.com/cryptoiz_IDN`,
48
- `TELEGRAM_SIGNALS : https://t.me/agus_artemiss`,
49
- ``,
50
- ].join('\n');
51
-
52
- const FOOTER = [
53
- ``,
54
- `DISCLAIMER : Not financial advice. Always DYOR before trading.`,
55
- `MORE_SIGNALS : https://cryptoiz.org/Alpha-Scanner`,
56
- `FULL_PLATFORM : https://cryptoiz.org`,
57
- `SUBSCRIBE : https://cryptoiz.org/Pricing`,
58
- ].join('\n');
59
-
60
- // CA embedded in name line — proven to work (v3.0.x)
61
- // Claude cannot separate name from CA when on same line
62
- const CA_LINE = (name, addr) => {
63
- if (!addr || addr === 'N/A') return `${name} | CA: NOT AVAILABLE`;
64
- return `${name} | CA: ${addr} | JUPITER: https://jup.ag/swap/SOL-${addr}`;
65
- };
37
+ const sign = v => { const n = parseFloat(v||0); return n > 0 ? `+${n}` : `${n}`; };
38
+ const shortCA = ca => ca ? `${ca.slice(0,6)}...${ca.slice(-4)}` : 'N/A';
39
+ const jupLink = ca => ca ? `[Trade](https://jup.ag/swap/SOL-${ca})` : 'N/A';
66
40
 
67
41
  // ══════════════════════════════════════════════════════════════════
68
- // ALPHA SCANNER
42
+ // ALPHA SCANNER — Markdown Table Format
69
43
  // ══════════════════════════════════════════════════════════════════
70
44
  function formatAlpha(data) {
71
- if (data.error) return `ERROR: ${data.error}\nSetup: https://cryptoiz.org`;
72
- const s = data.signals || [];
45
+ if (data.error) return `❌ **Error:** ${data.error}\n\nSetup: https://cryptoiz.org`;
46
+ const signals = data.signals || [];
47
+ const date = data.fetched_at?.split('T')[0];
73
48
 
74
- const lines = [
75
- HEADER('ALPHA ENTRY SCANNER', 'AI Smart Money Signal Detector for Solana DEX', 'Alpha-Scanner'),
76
- ``,
77
- `DATE : ${data.fetched_at?.split('T')[0]}`,
78
- `TOTAL SIGNALS : ${data.total_signals}`,
79
- ``,
80
- `HOW TO READ:`,
81
- ` ALPHA_SCORE = Overall strength 0-100 (higher = stronger signal)`,
82
- ` SIGNAL_CLASS = ALPHA_EARLY (best) > ALPHA_BUILDING > WATCHLIST_ONLY`,
83
- ` Score Accum = How actively smart money is entering (0-100)`,
84
- ` Score Timing = How optimal the entry timing is right now (0-100)`,
85
- ` Score Safety = Protection from manipulation & fake signals (0-100)`,
86
- ` Whale/Dolphin = Smart money tiers: Whale > Dolphin > Shrimp (retail)`,
87
- ` Delta (+/-) = Net change in holder count this period`,
88
- ` Drop/Peak = Price drop from all-time-high in this period`,
89
- ``,
90
- `═══════════════════════════════════════════════════════════════`,
91
- ``,
92
- ...s.map((t, i) => {
93
- const urgency = parseFloat(t.alpha_score) >= 85 ? '🔥 HIGH CONVICTION' :
94
- parseFloat(t.alpha_score) >= 75 ? '⚡ STRONG SIGNAL' :
95
- parseFloat(t.alpha_score) >= 65 ? '👁 WATCH' : '📋 MONITOR';
96
- return [
97
- `[${String(i+1).padStart(2,'0')}] ${CA_LINE(t.name || "Unknown", t.contract_address || "N/A")} ${urgency}`,
98
- ``,
99
- ` SIGNAL_CLASS : ${t.signal_class}`,
100
- ` ALPHA_SCORE : ${N(t.alpha_score)} / 100`,
101
- ` CURRENT_PHASE : ${t.phase || 'N/A'}`,
102
- ` REGIME : ${t.regime || 'N/A'}`,
103
- ` PHASE_CONFIDENCE : ${pct(t.phase_confidence_pct)}`,
104
- ` PHASE_AGE : ${t.phase_age_bars} bars`,
105
- ``,
106
- ` ── HOLDER SIGNALS ──────────────────────────────────`,
107
- ` WHALE_DELTA : ${sign(t.whale_delta)} (holds ${pct(t.whale_supply_pct)} of supply)`,
108
- ` DOLPHIN_DELTA : ${sign(t.dolphin_delta)} (holds ${pct(t.dolphin_supply_pct)} of supply)`,
109
- ` SHRIMP_DELTA : ${sign(t.shrimp_delta)} (negative = retail exiting = bullish sign)`,
110
- ``,
111
- ` ── SUB-SCORES ──────────────────────────────────────`,
112
- ` SCORE_ACCUMULATION : ${N(t.score_accumulation)}`,
113
- ` SCORE_TIMING : ${N(t.score_timing)}`,
114
- ` SCORE_SAFETY : ${N(t.score_safety)}`,
115
- ``,
116
- ` ── RISK FLAGS ──────────────────────────────────────`,
117
- ` RISK_LIQUIDITY : ${risk(t.risk_liquidity_pct, 'exit may be difficult')}`,
118
- ` RISK_TRAP : ${risk(t.risk_trap_pct, 'possible smart money trap')}`,
119
- ``,
120
- ` ── MARKET DATA ─────────────────────────────────────`,
121
- ` MARKET_CAP_NOW : ${mc(t.market_cap_now)}`,
122
- ` PRICE_NOW : $${t.price_now_usd || 'N/A'}`,
123
- ` PRICE_DROP_FROM_PEAK : ${t.price_drop_from_peak_pct ? N(t.price_drop_from_peak_pct)+'%' : 'N/A'}`,
124
- ` MC_WHEN_SIGNAL_FORMED : ${mc(t.market_cap_when_signal_formed)}`,
125
- ` PRICE_WHEN_SIGNAL_FORMED: $${t.price_when_signal_formed_usd || 'N/A'}`,
126
- ``,
127
- `═══════════════════════════════════════════════════════════`,
128
- ].join('\n');
129
- }),
130
- FOOTER,
131
- ];
132
- return lines.join('\n');
49
+ // Group by class
50
+ const early = signals.filter(s => s.signal_class === 'ALPHA_EARLY');
51
+ const building = signals.filter(s => s.signal_class === 'ALPHA_BUILDING');
52
+ const watchlist = signals.filter(s => s.signal_class === 'WATCHLIST_ONLY');
53
+ const others = signals.filter(s => !['ALPHA_EARLY','ALPHA_BUILDING','WATCHLIST_ONLY'].includes(s.signal_class));
54
+
55
+ const tableRow = (s, i) => {
56
+ const risk = parseFloat(s.risk_liquidity_pct||0) > 0 || parseFloat(s.risk_trap_pct||0) > 0
57
+ ? `⚠️ Liq:${N(s.risk_liquidity_pct)}% Trap:${N(s.risk_trap_pct)}%`
58
+ : '✅ Clear';
59
+ return `| ${i} | **${s.name}** | \`${s.contract_address||'N/A'}\` | ${N(s.alpha_score)} | ${s.phase||'N/A'} | ${sign(s.whale_delta)} | ${sign(s.dolphin_delta)} | ${s.market_cap_now||'N/A'} | $${s.price_now_usd||'N/A'} | ${N(s.score_safety)} | ${risk} | ${jupLink(s.contract_address)} |`;
60
+ };
61
+
62
+ const tableHeader = `| # | Token | Contract Address (CA) | Score | Phase | Whale Δ | Dolphin Δ | MC | Price | Safety | Risk | Trade |
63
+ |---|-------|----------------------|-------|-------|---------|-----------|-----|-------|--------|------|-------|`;
64
+
65
+ let out = [];
66
+
67
+ out.push(`## 🔍 CryptoIZ Alpha Entry Scanner`);
68
+ out.push(`**Date:** ${date} | **Total Signals:** ${data.total_signals} | **Source:** https://cryptoiz.org/Alpha-Scanner`);
69
+ out.push(`**Subscribe:** https://cryptoiz.org/Pricing (1W $15 | 1M $50) | **Twitter:** @cryptoiz_IDN | **Telegram:** https://t.me/agus_artemiss`);
70
+ out.push(``);
71
+ out.push(`> ℹ️ **How to read:** Score 0-100 | Whale/Dolphin Δ = smart money movement | ⚠️ = risk flag | CA = contract address`);
72
+ out.push(`> ⚠️ **Safety:** Many fake tokens share the same name. Always use the exact CA below to trade.`);
73
+ out.push(``);
74
+
75
+ if (early.length) {
76
+ out.push(`### 🟢 ALPHA_EARLY — Best Entry (Smart Money Just Entering)`);
77
+ out.push(`> Phase: Early accumulation | Timing: Optimal | Action: Priority entry`);
78
+ out.push(tableHeader);
79
+ early.forEach((s, i) => out.push(tableRow(s, i+1)));
80
+ out.push(``);
81
+ out.push(`**Full CA for copy-paste:**`);
82
+ early.forEach(s => out.push(`- **${s.name}:** \`${s.contract_address}\` ${jupLink(s.contract_address)}`));
83
+ out.push(``);
84
+ }
85
+
86
+ if (building.length) {
87
+ out.push(`### 🔵 ALPHA_BUILDING — Still Valid, Less Optimal Timing`);
88
+ out.push(`> Accumulation ongoing | Still good entry | Monitor closely`);
89
+ out.push(tableHeader);
90
+ building.forEach((s, i) => out.push(tableRow(s, i+1)));
91
+ out.push(``);
92
+ out.push(`**Full CA for copy-paste:**`);
93
+ building.forEach(s => out.push(`- **${s.name}:** \`${s.contract_address}\` ${jupLink(s.contract_address)}`));
94
+ out.push(``);
95
+ }
96
+
97
+ if (watchlist.length) {
98
+ out.push(`### 🟡 WATCHLIST_ONLY Not Ready Yet`);
99
+ out.push(tableHeader);
100
+ watchlist.slice(0,10).forEach((s, i) => out.push(tableRow(s, i+1)));
101
+ if (watchlist.length > 10) out.push(`| ... | *+${watchlist.length-10} more* | | | | | | | | | | |`);
102
+ out.push(``);
103
+ }
104
+
105
+ if (others.length) {
106
+ out.push(`### 🔴 LATE/WEAK/TRAP — Skip or Extreme Caution`);
107
+ out.push(`> ${others.map(s => `${s.name} (${N(s.alpha_score)})`).join(', ')}`);
108
+ out.push(``);
109
+ }
110
+
111
+ out.push(`---`);
112
+ out.push(`⚠️ *Not financial advice. Always DYOR. Data: [CryptoIZ](https://cryptoiz.org) | @cryptoiz_IDN*`);
113
+ return out.join('\n');
133
114
  }
134
115
 
135
116
  // ══════════════════════════════════════════════════════════════════
136
- // DIVERGENCE SCANNER
117
+ // DIVERGENCE — Markdown Table Format
137
118
  // ══════════════════════════════════════════════════════════════════
138
119
  function formatDivergence(data) {
139
- if (data.error) return `ERROR: ${data.error}`;
140
- const byType = data.signals_by_type || {};
120
+ if (data.error) return `❌ **Error:** ${data.error}`;
141
121
  const total = data.total_signals || 0;
122
+ const date = data.fetched_at?.split('T')[0];
123
+ const byType = data.signals_by_type || {};
142
124
 
143
- const lines = [
144
- HEADER('DIVERGENCE SCANNER', 'Smart Money vs Price Divergence Detector', 'Divergence'),
145
- ``,
146
- `DATE : ${data.fetched_at?.split('T')[0]}`,
147
- `TIMEFRAME : ${(data.timeframe||'4h').toUpperCase()}`,
148
- `TOTAL SIGNALS : ${total}`,
149
- ``,
150
- `DIVERGENCE TYPES:`,
151
- ` HIDDEN_ACCUMULATION = Price flat/weak but smart money quietly buying.`,
152
- ` Stealth entry BEFORE the upward move.`,
153
- ` BREAKOUT_ACCUMULATION = Whales buying aggressively on price breakout.`,
154
- ` Momentum-driven entry with strong conviction.`,
155
- ` CLASSIC_DIVERGENCE = Price and smart money moving in OPPOSITE directions.`,
156
- ` High reversal potential watch closely.`,
157
- ``,
158
- `HOW TO READ:`,
159
- ` Divergence Score = Strength of the divergence (higher = stronger)`,
160
- ` Confidence % = AI confidence in the signal`,
161
- ` Whale Now/Prev = Absolute whale holder count change`,
162
- ` Price Change % = Price movement this period`,
163
- ``,
164
- `═══════════════════════════════════════════════════════════════`,
165
- ];
125
+ const tableHeader = `| # | Token | Contract Address (CA) | Div Score | Confidence | Whale Now→Prev | Dolphin Δ | Price | MC | Detected | Trade |
126
+ |---|-------|----------------------|-----------|------------|----------------|-----------|-------|-----|----------|-------|`;
127
+
128
+ const tableRow = (s, i) =>
129
+ `| ${i} | **${s.name||'N/A'}** | \`${s.contract_address||'N/A'}\` | ${N(s.divergence_score)} | ${N(s.confidence_pct)}% | ${s.whale_holders_now||'?'}→${s.whale_holders_prev||'?'} (+${s.whale_delta||0}) | ${sign(s.dolphin_delta)} | $${s.price_now_usd||'N/A'} | ${s.market_cap_usd||'N/A'} | ${s.detected||'N/A'} | ${jupLink(s.contract_address)} |`;
130
+
131
+ let out = [];
132
+ out.push(`## 📊 CryptoIZ Divergence Scanner`);
133
+ out.push(`**Date:** ${date} | **Timeframe:** ${(data.timeframe||'4h').toUpperCase()} | **Total Signals:** ${total}`);
134
+ out.push(`**Source:** https://cryptoiz.org/Divergence | **Subscribe:** https://cryptoiz.org/Pricing | **Twitter:** @cryptoiz_IDN`);
135
+ out.push(``);
136
+ out.push(`> **Divergence Types:**`);
137
+ out.push(`> - **HIDDEN_ACCUMULATION** = Price flat/weak but whales quietly buying stealth entry before move`);
138
+ out.push(`> - **BREAKOUT_ACCUMULATION** = Whales buying on price breakout → momentum entry`);
139
+ out.push(`> - **CLASSIC_DIVERGENCE** = Price & smart money opposite direction → reversal signal`);
140
+ out.push(`> ⚠️ Always use the exact CA to trade. Many tokens share the same name.`);
141
+ out.push(``);
166
142
 
167
143
  if (!total) {
168
- lines.push(`\nNo divergence signals detected at this time.`);
169
- lines.push(`This is normal during low-volatility/sideways markets.`);
170
- lines.push(`Try again in a few hours or switch to 1d timeframe.`);
171
- lines.push(FOOTER);
172
- return lines.join('\n');
144
+ out.push(`*No divergence signals detected at this time. Normal during sideways/low-volatility markets. Try again later or switch timeframe to 1d.*`);
145
+ out.push(``);
146
+ out.push(`---`);
147
+ out.push(`⚠️ *Not financial advice. Data: [CryptoIZ](https://cryptoiz.org) | @cryptoiz_IDN*`);
148
+ return out.join('\n');
173
149
  }
174
150
 
175
151
  const typeOrder = ['HIDDEN_ACCUMULATION','BREAKOUT_ACCUMULATION','CLASSIC_DIVERGENCE'];
176
152
  const typeDesc = {
177
- HIDDEN_ACCUMULATION: 'Price appears weak but smart money is secretly buying stealth setup',
178
- BREAKOUT_ACCUMULATION: 'Whales chasing breakoutsmomentum-driven, high conviction entry',
179
- CLASSIC_DIVERGENCE: 'Price vs smart money in opposite directions — strong reversal signal',
153
+ HIDDEN_ACCUMULATION: '🫥 Stealth smart money entry price weak but whales buying quietly',
154
+ BREAKOUT_ACCUMULATION: '🚀 Momentum entrywhales chasing breakout aggressively',
155
+ CLASSIC_DIVERGENCE: '🔄 Reversal signal — price and smart money in opposite directions',
180
156
  };
181
157
 
182
158
  typeOrder.forEach(type => {
183
159
  const sigs = byType[type] || [];
184
160
  if (!sigs.length) return;
185
- lines.push(`\n▶▶ ${type} — ${sigs.length} signal(s)`);
186
- lines.push(` ${typeDesc[type]}`);
187
- lines.push(`───────────────────────────────────────────────────────────`);
188
-
189
- sigs.forEach((s, i) => {
190
- const urgency = parseFloat(s.divergence_score) > 300 ? '🔥 VERY HIGH' :
191
- parseFloat(s.divergence_score) > 100 ? '⚡ HIGH' :
192
- parseFloat(s.divergence_score) > 50 ? '👁 MODERATE' : '📋 LOW';
193
- lines.push([
194
- ``,
195
- ` [${String(i+1).padStart(2,'0')}] ${CA_LINE(s.name || "Unknown", s.contract_address || "N/A")} — ${urgency}`,
196
- ``,
197
- ` DIVERGENCE_TYPE : ${s.divergence_type}`,
198
- ` DIVERGENCE_SCORE : ${N(s.divergence_score)}`,
199
- ` CONFIDENCE : ${pct(s.confidence_pct)}`,
200
- ` CURRENT_PHASE : ${s.current_phase || 'N/A'}`,
201
- ``,
202
- ` ── HOLDER MOVEMENT ──────────────────────────────`,
203
- ` WHALE_HOLDERS_NOW : ${s.whale_holders_now || 'N/A'} wallets`,
204
- ` WHALE_HOLDERS_PREV : ${s.whale_holders_prev || 'N/A'} wallets`,
205
- ` WHALE_DELTA : ${sign(s.whale_delta)} (new whales entering)`,
206
- ` DOLPHIN_DELTA : ${sign(s.dolphin_delta)}`,
207
- ``,
208
- ` ── PRICE & MARKET ───────────────────────────────`,
209
- ` PRICE_NOW : $${s.price_now_usd || 'N/A'}`,
210
- ` PRICE_PREV_PERIOD : $${s.price_prev_usd || 'N/A'}`,
211
- ` PRICE_CHANGE : ${pct(s.price_change_pct)}`,
212
- ` MARKET_CAP : ${s.market_cap_usd || 'N/A'}`,
213
- ` SIGNAL_AGE : ${s.detected || 'N/A'}`,
214
- ``,
215
- `───────────────────────────────────────────────────────────`,
216
- ].join('\n'));
217
- });
161
+ out.push(`### ${typeDesc[type]}`);
162
+ out.push(tableHeader);
163
+ sigs.forEach((s, i) => out.push(tableRow(s, i+1)));
164
+ out.push(``);
165
+ out.push(`**Full CA for copy-paste:**`);
166
+ sigs.forEach(s => out.push(`- **${s.name}:** \`${s.contract_address}\` ${jupLink(s.contract_address)}`));
167
+ out.push(``);
218
168
  });
219
169
 
220
- lines.push(FOOTER);
221
- return lines.join('\n');
170
+ out.push(`---`);
171
+ out.push(`⚠️ *Not financial advice. Always DYOR. Data: [CryptoIZ](https://cryptoiz.org/Divergence) | @cryptoiz_IDN*`);
172
+ return out.join('\n');
222
173
  }
223
174
 
224
175
  // ══════════════════════════════════════════════════════════════════
225
- // ACCUMULATION DASHBOARD
176
+ // ACCUMULATION — Markdown Table Format
226
177
  // ══════════════════════════════════════════════════════════════════
227
178
  function formatAccumulation(data) {
228
- if (data.error) return `ERROR: ${data.error}`;
179
+ if (data.error) return `❌ **Error:** ${data.error}`;
229
180
  const tokens = data.tokens || [];
181
+ const date = data.fetched_at?.split('T')[0];
230
182
 
231
- const lines = [
232
- HEADER('ACCUMULATION DASHBOARD', '4-Dimension Smart Money Accumulation Detector', 'Dashboard'),
233
- ``,
234
- `DATE : ${data.fetched_at?.split('T')[0]}`,
235
- `TOTAL TOKENS : ${data.total_tokens}`,
236
- ``,
237
- `4-DIMENSION SCORING SYSTEM:`,
238
- ` Structure Score = Price action quality & holder tier patterns (0-100)`,
239
- ` AccDist Score = Accumulation vs distribution balance (0-100)`,
240
- ` Holder Score = Holder loyalty, quality & consistency (0-100)`,
241
- ` Market Score = Market conditions, volume & momentum (0-100)`,
242
- ` Composite Score = Weighted average of all 4 dimensions`,
243
- ``,
244
- `STRENGTH LABELS:`,
245
- ` VERY_STRONG_SMART_MONEY = Highest conviction — priority entry`,
246
- ` STRONG_SMART_MONEY_FORMING = Strong signal — monitor closely`,
247
- ` FORMING = Early stage needs confirmation`,
248
- ` WEAK_OR_NOISY = Low confidence — skip`,
249
- ``,
250
- `═══════════════════════════════════════════════════════════════`,
251
- ``,
252
- ...tokens.map((t, i) => {
253
- const urgency = t.accumulation_strength?.includes('VERY_STRONG') ? '🔥 VERY STRONG' :
254
- t.accumulation_strength?.includes('STRONG') ? '⚡ STRONG FORMING' :
255
- t.accumulation_strength?.includes('FORMING') ? '👁 FORMING' : '📋 WEAK/NOISY';
256
- return [
257
- `[${String(i+1).padStart(2,'0')}] ${CA_LINE(t.name || "Unknown", t.contract_address || "N/A")} — ${urgency}`,
258
- ``,
259
- ` ACCUMULATION_STRENGTH : ${t.accumulation_strength || 'N/A'}`,
260
- ` ACCDIST_STATUS : ${t.accdist_status || 'N/A'}`,
261
- ``,
262
- ` ── COMPOSITE SCORE: ${N(t.score_composite)} / 100 ─────────────────`,
263
- ` SCORE_STRUCTURE : ${N(t.score_structure)}`,
264
- ` SCORE_ACCDIST : ${N(t.score_accdist)}`,
265
- ` SCORE_HOLDER : ${N(t.score_holder)}`,
266
- ` SCORE_MARKET : ${N(t.score_market)}`,
267
- ``,
268
- ` ── MARKET DATA ─────────────────────────────────────`,
269
- ` MARKET_CAP_NOW : ${mc(t.market_cap_now)}`,
270
- ` PRICE_NOW : $${t.price_now_usd || 'N/A'}`,
271
- ` LAST_UPDATED : ${t.last_updated || 'N/A'}`,
272
- ``,
273
- `═══════════════════════════════════════════════════════════`,
274
- ].join('\n');
275
- }),
276
- FOOTER,
277
- ];
278
- return lines.join('\n');
183
+ const tableHeader = `| # | Token | Contract Address (CA) | Composite | Strength | Structure | AccDist | Holder | Market | MC | Price | Trade |
184
+ |---|-------|----------------------|-----------|----------|-----------|---------|--------|--------|-----|-------|-------|`;
185
+
186
+ const tableRow = (t, i) =>
187
+ `| ${i} | **${t.name||'N/A'}** | \`${t.contract_address||'N/A'}\` | **${N(t.score_composite)}** | ${t.accumulation_strength||'N/A'} | ${N(t.score_structure)} | ${N(t.score_accdist)} | ${N(t.score_holder)} | ${N(t.score_market)} | ${t.market_cap_now||'N/A'} | $${t.price_now_usd||'N/A'} | ${jupLink(t.contract_address)} |`;
188
+
189
+ let out = [];
190
+ out.push(`## 💰 CryptoIZ Accumulation Dashboard`);
191
+ out.push(`**Date:** ${date} | **Total:** ${data.total_tokens} tokens | **Source:** https://cryptoiz.org/Dashboard`);
192
+ out.push(`**Subscribe:** https://cryptoiz.org/Pricing (1W $15 | 1M $50) | **Twitter:** @cryptoiz_IDN | **Telegram:** https://t.me/agus_artemiss`);
193
+ out.push(``);
194
+ out.push(`> **4-Dimension Scoring:** Structure (price action) + AccDist (accum vs distrib) + Holder (quality) + Market (conditions)`);
195
+ out.push(`> **Strength:** VERY_STRONG → STRONG_FORMING → FORMING → WEAK/NOISY`);
196
+ out.push(`> ⚠️ Always use the exact CA to trade. Many tokens share the same name.`);
197
+ out.push(``);
198
+ out.push(tableHeader);
199
+ tokens.forEach((t, i) => out.push(tableRow(t, i+1)));
200
+ out.push(``);
201
+ out.push(`**Full CA for copy-paste:**`);
202
+ tokens.slice(0, 10).forEach(t => out.push(`- **${t.name}:** \`${t.contract_address}\` → ${jupLink(t.contract_address)}`));
203
+ out.push(``);
204
+ out.push(`---`);
205
+ out.push(`⚠️ *Not financial advice. Always DYOR. Data: [CryptoIZ](https://cryptoiz.org) | @cryptoiz_IDN*`);
206
+ return out.join('\n');
279
207
  }
280
208
 
281
209
  // ══════════════════════════════════════════════════════════════════
282
- // BTC REGIME MONITOR
210
+ // BTC REGIME — Markdown Format
283
211
  // ══════════════════════════════════════════════════════════════════
284
212
  function formatBTC(data) {
285
- if (data.error) return `ERROR: ${data.error}`;
286
- const regime = (data.btc_regime || 'UNKNOWN').toUpperCase();
287
- const regimeIcon = regime === 'BULL' ? '🟢 BULLISH' : regime === 'BEAR' ? '🔴 BEARISH' : '🟡 NEUTRAL';
288
- const fgi = parseFloat(data.fear_and_greed_index || 0);
289
- const fgiContext = fgi <= 25 ? 'Extreme Fear — Historically strong contrarian buy zone for patient investors.' :
290
- fgi >= 75 ? 'Extreme Greed — Market overheated, elevated reversal risk.' :
291
- 'Neutral zone Follow technical signals for direction.';
292
- const altAdvice = regime === 'BULL'
293
- ? '✅ BTC BULLISH → Favorable for altcoin entries.\n Focus on high Alpha Score tokens on CryptoIZ Alpha Scanner.'
294
- : regime === 'BEAR'
295
- ? 'BTC BEARISH → Be CAUTIOUS.\n Size down. Prioritize Safety Score ≥80 and CLEAR risk flags only.'
296
- : '🟡 BTC NEUTRAL → Be SELECTIVE.\n Wait for signal confirmation before large positions.';
297
- const rsiVal = parseFloat(data.rsi_1h || 50);
298
- const rsiNote = rsiVal < 30 ? '(Oversold — potential bounce)' : rsiVal > 70 ? '(Overbought — caution)' : '(Normal range)';
213
+ if (data.error) return `❌ **Error:** ${data.error}`;
214
+ const regime = (data.btc_regime||'UNKNOWN').toUpperCase();
215
+ const icon = regime==='BULL' ? '🟢' : regime==='BEAR' ? '🔴' : '🟡';
216
+ const fgi = parseFloat(data.fear_and_greed_index||0);
217
+ const fgiCtx = fgi<=25 ? '📉 Extreme Fear — historically strong contrarian buy zone' :
218
+ fgi>=75 ? '📈 Extreme Greed — elevated reversal risk' :
219
+ '➡️ Neutral — follow technical signals';
220
+ const advice = regime==='BULL'
221
+ ? '✅ **BTC BULLISH**Good conditions for altcoin entries. Focus on high Alpha Score tokens.'
222
+ : regime==='BEAR'
223
+ ? '⚠️ **BTC BEARISH** → Size down. Only enter tokens with Safety ≥80 and CLEAR risk flags.'
224
+ : '🟡 **BTC NEUTRAL** → Be selective. Wait for confirmation before large entries.';
225
+ const rsi = parseFloat(data.rsi_1h||50);
226
+ const rsiNote = rsi<30 ? '🟢 Oversold' : rsi>70 ? '🔴 Overbought' : 'Normal';
299
227
 
300
228
  return [
301
- HEADER('BTC REGIME MONITOR', 'Bitcoin Macro Condition for Solana Altcoin Traders', 'BTC'),
302
- ``,
303
- `DATE : ${data.fetched_at?.split('T')[0]}`,
229
+ `## ${icon} CryptoIZ BTC Regime Monitor`,
230
+ `**Date:** ${data.fetched_at?.split('T')[0]} | **Source:** https://cryptoiz.org/BTC | **Twitter:** @cryptoiz_IDN`,
231
+ `**Subscribe:** https://cryptoiz.org/Pricing (1W $15 | 1M $50 | 3M $120 | 1Y $400)`,
304
232
  ``,
305
- `══════════════ BTC REGIME: ${regimeIcon} ════════════════`,
233
+ `### ${icon} BTC Regime: **${regime}**`,
306
234
  ``,
307
- `BTC_PRICE_USD : $${data.btc_price_usd || 'N/A'}`,
308
- `BTC_SCORE : ${data.btc_score} / 10 (0=extreme bear, 10=extreme bull)`,
309
- `BTC_TREND : ${data.btc_trend || 'N/A'}`,
310
- `OPEN_INTEREST : ${data.open_interest || 'N/A'}`,
311
- `FUNDING_RATE : ${data.funding_rate || 'N/A'}`,
235
+ `| Metric | Value |`,
236
+ `|--------|-------|`,
237
+ `| 💵 BTC Price | **$${data.btc_price_usd||'N/A'}** |`,
238
+ `| 📊 BTC Score | **${data.btc_score}/10** (0=extreme bear, 10=extreme bull) |`,
239
+ `| 📈 Trend | ${data.btc_trend||'N/A'} |`,
240
+ `| 📂 Open Interest | ${data.open_interest||'N/A'} |`,
241
+ `| 💸 Funding Rate | ${data.funding_rate||'N/A'} |`,
312
242
  ``,
313
- `══════════════ MARKET SENTIMENT ════════════════════════`,
243
+ `### 😨 Market Sentiment`,
314
244
  ``,
315
- `FEAR_GREED_INDEX : ${data.fear_and_greed_index} / 100`,
316
- `FEAR_GREED_LABEL : ${data.fear_and_greed_label || 'N/A'}`,
317
- `FEAR_GREED_CONTEXT : ${fgiContext}`,
245
+ `| Metric | Value |`,
246
+ `|--------|-------|`,
247
+ `| Fear & Greed Index | **${data.fear_and_greed_index}/100 — ${data.fear_and_greed_label||'N/A'}** |`,
248
+ `| Context | ${fgiCtx} |`,
318
249
  ``,
319
- `══════════════ FUTURES MARKET ══════════════════════════`,
250
+ `### 📊 Futures Market`,
320
251
  ``,
321
- `FUTURES_SIGNAL : ${data.futures_signal || 'N/A'}`,
322
- `OI_REGIME : ${data.oi_regime || 'N/A'}`,
323
- `FUNDING_REGIME : ${data.funding_regime || 'N/A'}`,
324
- `PERP_PRICE_USD : $${data.perp_price_usd || 'N/A'}`,
325
- `FUTURES_CONTEXT : ${data.futures_context || 'N/A'}`,
252
+ `| Metric | Value |`,
253
+ `|--------|-------|`,
254
+ `| Futures Signal | **${data.futures_signal||'N/A'}** |`,
255
+ `| OI Regime | ${data.oi_regime||'N/A'} |`,
256
+ `| Funding Regime | ${data.funding_regime||'N/A'} |`,
257
+ `| Perp Price | $${data.perp_price_usd||'N/A'} |`,
258
+ `| Context | ${data.futures_context||'N/A'} |`,
326
259
  ``,
327
- `══════════════ TECHNICAL INDICATORS (1H) ═══════════════`,
260
+ `### 📉 Technical Indicators (1H)`,
328
261
  ``,
329
- `RSI_1H : ${data.rsi_1h || 'N/A'} ${data.rsi_1h ? rsiNote : ''}`,
330
- `EMA20_1H : $${data.ema20_1h || 'N/A'}`,
331
- `EMA50_1H : $${data.ema50_1h || 'N/A'}`,
332
- `MACD_1H : ${data.macd_1h || 'N/A'}`,
333
- `MACD_SIGNAL_1H : ${data.macd_signal_1h || 'N/A'}`,
262
+ `| Indicator | Value | Signal |`,
263
+ `|-----------|-------|--------|`,
264
+ `| RSI | ${data.rsi_1h||'N/A'} | ${rsiNote} |`,
265
+ `| EMA 20 | $${data.ema20_1h||'N/A'} | — |`,
266
+ `| EMA 50 | $${data.ema50_1h||'N/A'} | — |`,
267
+ `| MACD | ${data.macd_1h||'N/A'} | — |`,
268
+ `| MACD Signal | ${data.macd_signal_1h||'N/A'} | — |`,
334
269
  ``,
335
- `══════════════ ALTCOIN RECOMMENDATION ══════════════════`,
270
+ `### 💡 Altcoin Recommendation`,
336
271
  ``,
337
- `RECOMMENDATION:`,
338
- ` ${altAdvice}`,
272
+ advice,
339
273
  ``,
340
- `For best entry signals under this regime:`,
341
- `>>> https://cryptoiz.org/Alpha-Scanner <<<`,
274
+ `**Best entry signals for this regime:** https://cryptoiz.org/Alpha-Scanner`,
342
275
  ``,
343
- `Plans from $15/week: https://cryptoiz.org/Pricing`,
344
- FOOTER,
276
+ `---`,
277
+ `⚠️ *Not financial advice. Always DYOR. Data: [CryptoIZ](https://cryptoiz.org/BTC) | @cryptoiz_IDN*`,
345
278
  ].join('\n');
346
279
  }
347
280
 
348
281
  // ══════════════════════════════════════════════════════════════════
349
- // STATUS
282
+ // GET TOKEN CA — Free tool
350
283
  // ══════════════════════════════════════════════════════════════════
351
- function formatStatus() {
284
+ async function getTokenCA(tokenName, data) {
285
+ const signals = data.signals || [];
286
+ const match = signals.find(s =>
287
+ (s.name||'').toLowerCase().includes(tokenName.toLowerCase()) ||
288
+ tokenName.toLowerCase().includes((s.name||'').toLowerCase())
289
+ );
290
+ if (!match) {
291
+ return [
292
+ `### ❌ Token "${tokenName}" not found in today's CryptoIZ signals`,
293
+ ``,
294
+ `Available tokens: ${signals.slice(0,20).map(s => s.name).join(', ')}`,
295
+ ``,
296
+ `Try [get_alpha_scanner] to see all signals.`,
297
+ ].join('\n');
298
+ }
352
299
  return [
353
- HEADER('MCP SERVER v3.2.0', 'AI-Powered Solana DEX Trading Signal Platform', 'Pricing'),
300
+ `### 🔐 Contract Address Verification ${match.name}`,
354
301
  ``,
355
- `CONNECTION_STATUS : CONNECTED to CryptoIZ Data Engine`,
356
- `PAYMENT_STATUS : ${SVM_PRIVATE_KEY ? 'READY — x402 Solana USDC autopay ($0.01/call)' : 'NOT SET — add SVM_PRIVATE_KEY to Claude Desktop config'}`,
357
- `PAYMENT_WALLET : DsKmdkYx49Xc1WhqMUAztwhdYPTqieyC98VmnnJdgpXX`,
302
+ `> ⚠️ **SAFETY:** Many fake tokens use the same name "${match.name}". Use ONLY this exact CA.`,
358
303
  ``,
359
- `AVAILABLE TOOLS:`,
304
+ `| Field | Value |`,
305
+ `|-------|-------|`,
306
+ `| Token Name | **${match.name}** |`,
307
+ `| Contract Address | \`${match.contract_address}\` |`,
308
+ `| Alpha Score | ${N(match.alpha_score)} |`,
309
+ `| Signal Class | ${match.signal_class} |`,
310
+ `| Market Cap | ${match.market_cap_now||'N/A'} |`,
311
+ `| Price | $${match.price_now_usd||'N/A'} |`,
360
312
  ``,
361
- ` 1. get_alpha_scanner`,
362
- ` → Alpha Score, Signal Class, Phase, Regime`,
363
- ` → Whale/Dolphin/Shrimp deltas & supply %`,
364
- ` → Sub-scores: Accumulation / Timing / Safety`,
365
- ` → Risk flags: Liquidity / Trap`,
366
- ` → MC & Price NOW + MC & Price WHEN SIGNAL FORMED`,
367
- ` → Contract address (copy to trade on DEX)`,
368
- ` → Full: https://cryptoiz.org/Alpha-Scanner`,
313
+ `**Trade Links (verified):**`,
314
+ `- 🪐 Jupiter: https://jup.ag/swap/SOL-${match.contract_address}`,
315
+ `- Raydium: https://raydium.io/swap/?inputCurrency=sol&outputCurrency=${match.contract_address}`,
369
316
  ``,
370
- ` 2. get_divergence [params: timeframe=4h|1d, limit=1-50]`,
371
- ` → 3 types: HIDDEN_ACCUMULATION / BREAKOUT_ACCUMULATION / CLASSIC_DIVERGENCE`,
372
- ` → Each type explained in plain English`,
373
- ` → Whale holders NOW vs PREV (absolute count)`,
374
- ` → Price now vs previous period`,
375
- ` → Signal age (how long ago detected)`,
376
- ` → Contract address (copy to trade on DEX)`,
377
- ` → Full: https://cryptoiz.org/Divergence`,
378
- ``,
379
- ` 3. get_accumulation [params: min_composite=0-100]`,
380
- ` → 4-dimension composite score`,
381
- ` → Structure / AccDist / Holder / Market scores`,
382
- ` → Strength label (Very Strong → Weak/Noisy)`,
383
- ` → MC & Price now`,
384
- ` → Contract address (copy to trade on DEX)`,
385
- ` → Full: https://cryptoiz.org/Dashboard`,
386
- ``,
387
- ` 4. get_btc_regime`,
388
- ` → BTC regime (Bull/Bear/Neutral) + score/10`,
389
- ` → Fear & Greed Index with interpretation`,
390
- ` → Futures: OI regime, funding rate, signal`,
391
- ` → Technical: RSI / EMA20 / EMA50 / MACD (1H)`,
392
- ` → Altcoin recommendation based on regime`,
393
- ` → Full: https://cryptoiz.org/BTC`,
394
- ``,
395
- ` 5. get_status → This info`,
396
- ``,
397
- `SUBSCRIPTION PLANS:`,
398
- ` 1 Week: $15 | 1 Month: $50 | 3 Months: $120 | 1 Year: $400`,
399
- ` https://cryptoiz.org/Pricing`,
400
- FOOTER,
317
+ `---`,
318
+ `*Data: [CryptoIZ](https://cryptoiz.org) | @cryptoiz_IDN*`,
319
+ ].join('\n');
320
+ }
321
+
322
+ // ══════════════════════════════════════════════════════════════════
323
+ // STATUS
324
+ // ══════════════════════════════════════════════════════════════════
325
+ function formatStatus() {
326
+ return [
327
+ `## 🚀 CryptoIZ MCP Server v4.0.0`,
328
+ ``,
329
+ `**AI-Powered Solana DEX Trading Signal Platform**`,
330
+ ``,
331
+ `| Field | Value |`,
332
+ `|-------|-------|`,
333
+ `| Status | ✅ CONNECTED |`,
334
+ `| Payment | ${SVM_PRIVATE_KEY ? '✅ READY — x402 Solana USDC ($0.01/call)' : '❌ NOT SET — add SVM_PRIVATE_KEY'} |`,
335
+ `| Platform | https://cryptoiz.org |`,
336
+ `| Twitter | @cryptoiz_IDN |`,
337
+ `| Telegram | https://t.me/agus_artemiss |`,
338
+ ``,
339
+ `### Available Tools`,
340
+ ``,
341
+ `| Tool | Description | Cost | Data |`,
342
+ `|------|-------------|------|------|`,
343
+ `| get_alpha_scanner | Strongest Solana signals with smart money analysis | $0.01 USDC | Score, Phase, Whale/Dolphin, MC, Price, CA, Jupiter link |`,
344
+ `| get_divergence | 3-type divergence: Hidden/Breakout/Classic | $0.01 USDC | Score, Confidence, Whale now vs prev, Price, MC, CA |`,
345
+ `| get_accumulation | 4-dimension accumulation scoring | $0.01 USDC | Composite + 4 sub-scores, MC, Price, CA |`,
346
+ `| get_btc_regime | Bitcoin macro regime + altcoin recommendation | $0.01 USDC | Price, Score, Fear&Greed, OI, Funding, RSI/EMA/MACD |`,
347
+ `| get_token_ca | Get exact CA for specific token (scam protection) | FREE | Full CA + Jupiter + Raydium links |`,
348
+ `| get_status | This info | FREE | — |`,
349
+ ``,
350
+ `### Subscription Plans`,
351
+ ``,
352
+ `| Plan | Price |`,
353
+ `|------|-------|`,
354
+ `| 1 Week | $15 |`,
355
+ `| 1 Month | $50 |`,
356
+ `| 3 Months | $120 |`,
357
+ `| 1 Year | $400 |`,
358
+ ``,
359
+ `**Subscribe:** https://cryptoiz.org/Pricing`,
401
360
  ].join('\n');
402
361
  }
403
362
 
@@ -405,37 +364,18 @@ function formatStatus() {
405
364
  // TOOL DEFINITIONS
406
365
  // ══════════════════════════════════════════════════════════════════
407
366
  const TOOLS = [
408
- {
409
- name: 'get_alpha_scanner',
410
- description: 'CryptoIZ Alpha Entry Scanner strongest Solana tokens being accumulated by smart money. Returns: contract address (for DEX trading), alpha score, signal class (ALPHA_EARLY/BUILDING/WATCHLIST), phase, regime, whale/dolphin/shrimp deltas and supply %, accumulation/timing/safety sub-scores, liquidity and trap risk flags, market cap now, price now, MC and price when signal first formed. $0.01 USDC/call. Platform: https://cryptoiz.org/Alpha-Scanner',
411
- inputSchema: { type: 'object', properties: { min_score: { type: 'number', description: 'Minimum alpha score 0-100' }, entry_class: { type: 'string', enum: ['ALPHA_EARLY','ALPHA_BUILDING','WATCHLIST_ONLY'] } }, required: [] }
412
- },
413
- {
414
- name: 'get_divergence',
415
- description: 'CryptoIZ Divergence Scanner — detects 3 types: HIDDEN_ACCUMULATION (price weak but whales buying), BREAKOUT_ACCUMULATION (whales buying breakouts), CLASSIC_DIVERGENCE (price vs smart money opposite direction). Returns: contract address, divergence type with explanation, score, confidence %, whale holders now vs previous period, dolphin delta, price now vs previous, price change %, market cap, signal age. $0.01 USDC/call. Platform: https://cryptoiz.org/Divergence',
416
- inputSchema: { type: 'object', properties: { timeframe: { type: 'string', enum: ['4h','1d'], description: 'Default: 4h' }, limit: { type: 'number', description: 'Max results 1-50, default 30' } }, required: [] }
417
- },
418
- {
419
- name: 'get_accumulation',
420
- description: 'CryptoIZ Accumulation Dashboard — tokens in active accumulation phase scored on 4 dimensions: Structure (price action patterns), AccDist (accumulation vs distribution ratio), Holder (quality and loyalty), Market (conditions and volume). Returns: contract address, composite score, all 4 sub-scores, strength label, market cap, price, last updated. $0.01 USDC/call. Platform: https://cryptoiz.org/Dashboard',
421
- inputSchema: { type: 'object', properties: { min_composite: { type: 'number', description: 'Minimum composite score 0-100' } }, required: [] }
422
- },
423
- {
424
- name: 'get_btc_regime',
425
- description: 'CryptoIZ BTC Regime Monitor — Bitcoin macro condition critical for Solana altcoin trading. Returns: BTC price, regime score 0-10, trend, open interest, funding rate, Fear & Greed Index with interpretation, futures signal, OI regime, funding regime, perp price, RSI/EMA20/EMA50/MACD (1H timeframe), altcoin recommendation. $0.01 USDC/call. Platform: https://cryptoiz.org/BTC',
426
- inputSchema: { type: 'object', properties: {}, required: [] }
427
- },
428
- {
429
- name: 'get_status',
430
- description: 'Check CryptoIZ MCP server v3.2.0 connection status, payment setup, and complete list of all tools with full data descriptions. Platform: https://cryptoiz.org',
431
- inputSchema: { type: 'object', properties: {}, required: [] }
432
- },
367
+ { name: 'get_alpha_scanner', description: 'CryptoIZ Alpha Scanner — Solana smart money signals in markdown table format. Shows contract address, Jupiter trade link, alpha score, class, phase, whale/dolphin signals, sub-scores, risk flags, MC, price. $0.01 USDC/call.', inputSchema: { type: 'object', properties: { min_score: { type: 'number' }, entry_class: { type: 'string', enum: ['ALPHA_EARLY','ALPHA_BUILDING','WATCHLIST_ONLY'] } }, required: [] } },
368
+ { name: 'get_divergence', description: 'CryptoIZ Divergence Scanner — 3 types in table format: HIDDEN_ACCUMULATION, BREAKOUT_ACCUMULATION, CLASSIC_DIVERGENCE. Shows CA, Jupiter link, score, confidence, whale holders now vs prev. $0.01 USDC/call.', inputSchema: { type: 'object', properties: { timeframe: { type: 'string', enum: ['4h','1d'] }, limit: { type: 'number' } }, required: [] } },
369
+ { name: 'get_accumulation', description: 'CryptoIZ Accumulation Dashboard4-dimension scoring table. Shows CA, Jupiter link, composite + 4 sub-scores (structure/accdist/holder/market), MC, price. $0.01 USDC/call.', inputSchema: { type: 'object', properties: { min_composite: { type: 'number' } }, required: [] } },
370
+ { name: 'get_btc_regime', description: 'CryptoIZ BTC Regime Monitor BTC macro in table format. Shows price, score, Fear&Greed, OI regime, funding, futures signal, RSI/EMA/MACD 1H, altcoin recommendation. $0.01 USDC/call.', inputSchema: { type: 'object', properties: {}, required: [] } },
371
+ { name: 'get_token_ca', description: 'FREE: Get exact contract address for a specific token. Includes Jupiter and Raydium trade links. Use this to avoid buying wrong token (many fake tokens share same names). No USDC payment required.', inputSchema: { type: 'object', properties: { token_name: { type: 'string', description: 'Token name to look up, e.g. "Aliens" or "PENGUIN"' } }, required: ['token_name'] } },
372
+ { name: 'get_status', description: 'CryptoIZ MCP server status, all available tools, and subscription plans. Platform: https://cryptoiz.org', inputSchema: { type: 'object', properties: {}, required: [] } },
433
373
  ];
434
374
 
435
375
  // ══════════════════════════════════════════════════════════════════
436
376
  // SERVER
437
377
  // ══════════════════════════════════════════════════════════════════
438
- const server = new Server({ name: 'cryptoiz-mcp', version: '3.5.0' }, { capabilities: { tools: {} } });
378
+ const server = new Server({ name: 'cryptoiz-mcp', version: '4.0.0' }, { capabilities: { tools: {} } });
439
379
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
440
380
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
441
381
  const { name, arguments: args } = request.params;
@@ -444,6 +384,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
444
384
 
445
385
  if (name === 'get_alpha_scanner') {
446
386
  const data = await payAndFetch(`${GATEWAY_URL}?tool=get_alpha_scanner`);
387
+ if (data.error) return { content: [{ type: 'text', text: `❌ ${data.error}` }], isError: true };
447
388
  if (args?.min_score && data.signals) { data.signals = data.signals.filter(s => parseFloat(s.alpha_score) >= args.min_score); data.total_signals = data.signals.length; }
448
389
  if (args?.entry_class && data.signals) { data.signals = data.signals.filter(s => s.signal_class === args.entry_class); data.total_signals = data.signals.length; }
449
390
  return { content: [{ type: 'text', text: formatAlpha(data) }] };
@@ -454,68 +395,31 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
454
395
  if (args?.timeframe) p.set('tf', args.timeframe);
455
396
  if (args?.limit) p.set('limit', String(args.limit));
456
397
  const data = await payAndFetch(`${GATEWAY_URL}?${p}`);
398
+ if (data.error) return { content: [{ type: 'text', text: `❌ ${data.error}` }], isError: true };
457
399
  return { content: [{ type: 'text', text: formatDivergence(data) }] };
458
400
  }
459
401
 
460
402
  if (name === 'get_accumulation') {
461
403
  const data = await payAndFetch(`${GATEWAY_URL}?tool=get_accumulation`);
404
+ if (data.error) return { content: [{ type: 'text', text: `❌ ${data.error}` }], isError: true };
462
405
  if (args?.min_composite && data.tokens) { data.tokens = data.tokens.filter(t => parseFloat(t.score_composite) >= args.min_composite); data.total_tokens = data.tokens.length; }
463
406
  return { content: [{ type: 'text', text: formatAccumulation(data) }] };
464
407
  }
465
408
 
466
409
  if (name === 'get_btc_regime') {
467
410
  const data = await payAndFetch(`${GATEWAY_URL}?tool=get_btc_regime`);
411
+ if (data.error) return { content: [{ type: 'text', text: `❌ ${data.error}` }], isError: true };
468
412
  return { content: [{ type: 'text', text: formatBTC(data) }] };
469
413
  }
470
414
 
471
415
  if (name === 'get_token_ca') {
472
416
  const tokenName = args?.token_name || '';
417
+ if (!tokenName) return { content: [{ type: 'text', text: '❌ Please provide a token_name. Example: "Aliens"' }], isError: true };
473
418
  const data = await payAndFetch(`${GATEWAY_URL}?tool=get_alpha_scanner`);
474
-
475
- if (data.error) return { content: [{ type: 'text', text: `Error: ${data.error}` }], isError: true };
476
-
477
- // Search by name (case insensitive)
478
- const signals = data.signals || [];
479
- const match = signals.find(s =>
480
- (s.name || '').toLowerCase().includes(tokenName.toLowerCase()) ||
481
- tokenName.toLowerCase().includes((s.name || '').toLowerCase())
482
- );
483
-
484
- if (!match) {
485
- return { content: [{ type: 'text', text: [
486
- `Token "${tokenName}" not found in today's CryptoIZ signals.`,
487
- ``,
488
- `Available tokens today: ${signals.map(s => s.name).join(', ')}`,
489
- ``,
490
- `Try get_alpha_scanner to see all available tokens.`,
491
- ].join('\n') }] };
492
- }
493
-
494
- return { content: [{ type: 'text', text: [
495
- `TOKEN VERIFICATION — ${match.name}`,
496
- ``,
497
- `⚠ IMPORTANT: Many fake tokens use the same name.`,
498
- `⚠ ONLY use this exact contract address to avoid scams.`,
499
- ``,
500
- `TOKEN_NAME : ${match.name}`,
501
- `CONTRACT_ADDRESS : ${match.contract_address}`,
502
- ``,
503
- `TRADE LINKS (verified):`,
504
- `BUY_ON_JUPITER : https://jup.ag/swap/SOL-${match.contract_address}`,
505
- `BUY_ON_RAYDIUM : https://raydium.io/swap/?inputCurrency=sol&outputCurrency=${match.contract_address}`,
506
- ``,
507
- `CURRENT SIGNALS:`,
508
- `ALPHA_SCORE : ${match.alpha_score}`,
509
- `SIGNAL_CLASS : ${match.signal_class}`,
510
- `MARKET_CAP : ${match.market_cap_now || 'N/A'}`,
511
- `PRICE_NOW : $${match.price_now_usd || 'N/A'}`,
512
- ``,
513
- `Data from CryptoIZ — https://cryptoiz.org`,
514
- `Not financial advice. Always DYOR.`,
515
- ].join('\n') }] };
419
+ return { content: [{ type: 'text', text: await getTokenCA(tokenName, data) }] };
516
420
  }
517
421
 
518
- return { content: [{ type: 'text', text: `Unknown tool: \${name}` }], isError: true };
422
+ return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
519
423
  } catch (err) {
520
424
  return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
521
425
  }