SolanaViz MCP 服务器
一个模型上下文协议(MCP)服务器,使Claude能够通过自然语言对话访问、分析和可视化Solana区块链数据。
特性
- 数据分析:获取并分析Solana区块链数据、代币和钱包信息
- 可视化:为数据探索生成基于文本的可视化
- 价格预测:人工智能驱动的代币价格预测
- 证券分析:评估令牌和协议的安全风险
- 多钱包支持:分析任何Solana钱包,包括您自己的钱包
先决条件
- Node.js 18+
- npm或pnpm
- Claude Desktop(用于使用MCP服务器)
- API密钥:
- 鸟眼 - CoinGecko 的 - 那么 - Helius(Solana RPC提供商)
安装
- 克隆存储库:
git clone https://github.com/yourusername/GOATsolana-mcp.git
cd GOATsolana-mcp- 安装依赖项:
npm install
# or
pnpm install- 构建项目:
npm run build
# or
pnpm build配置
- 创建一个
.env根目录中具有以下环境变量的文件(或从以下位置复制.env.example):
BIRDEYE_API_KEY=your_birdeye_api_key
COINGECKO_API_KEY=your_coingecko_api_key
ALLORA_API_KEY=your_allora_api_key
HELIUS_RPC_URL=your_helius_rpc_url
DEFAULT_WALLET_ADDRESS=optional_default_wallet_address- 通过创建一个
claude_desktop_config.jsonClaude Desktop应用程序数据目录中的文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 窗户:
%APPDATA%\Claude\claude_desktop_config.json
添加以下内容,替换 /path/to/GOATsolana-mcp 使用项目的绝对路径:
{
"mcpServers": {
"solana-viz-mcp": {
"command": "node",
"args": ["--input-type=module", "/path/to/GOATsolana-mcp/build/index.js"],
"env": {
"BIRDEYE_API_KEY": "your_birdeye_api_key",
"COINGECKO_API_KEY": "your_coingecko_api_key",
"ALLORA_API_KEY": "your_allora_api_key",
"HELIUS_RPC_URL": "your_helius_rpc_url",
"DEFAULT_WALLET_ADDRESS": "optional_default_wallet_address"
}
}
}
}重要:The --input-type=module 标志对于Node.js正确加载ES模块至关重要。如果没有此标志,即使文件存在,Claude Desktop也会遇到“找不到模块”错误。- 直接启动服务器(用于测试):
npm start- 更改配置后完全重新启动Claude Desktop。
重要提示
模块加载
此项目使用ES模块(导入/导出)而不是CommonJS(require/module.exports)。Claude Desktop配置包括 --input-type=module 标志,这对Node.js正确加载模块至关重要。
模拟实现
当前的实现对一些GOAT SDK插件使用了模拟实现。这是因为插件API和代码中预期的接口之间的接口不匹配。在未来的更新中,这些模拟将被替换为实际实现的适配器。
可用工具
配置工具
set_wallet:设置或更改用于分析的活动钱包地址
数据获取工具
get_token_data:检索全面的令牌信息和指标get_wallet_tokens:分析钱包地址中的代币持有情况get_price_history:获取代币的历史价格数据get_token_pairs:分析DEX之间的交易对get_trending_tokens:识别Solana上当前流行的代币
预测工具
get_price_prediction:为代币生成人工智能驱动的价格预测
安全工具
get_token_security:评估令牌和协议的安全风险
可视化工具
generate_sankey_diagram:可视化实体(代币、协议、钱包)之间的流动generate_treemap:使用嵌套矩形可视化分层数据generate_heatmap:跨类别可视化数据强度generate_network_graph:可视化实体之间的关系和连接generate_radar_chart:比较多个实体的多个变量generate_bubble_chart:可视化三维数据(x、y、大小)generate_temporal_heatmap:可视化不同时间段的数据模式generate_donut_chart:将部分到整体的关系可视化
使用示例
以下是一些如何将SolanaViz MCP与Claude一起使用的示例:
设置钱包并分析持有量
Please set my wallet address to FtG3emhAqBC8Rr9vdCqTJHxaNNuQVt7B7HvujJrQEj7Y and analyze what tokens I'm holding.通过安全分析获取令牌信息
Can you tell me more about the BONK token? Is it secure to invest in?分析市场趋势
What are the trending tokens on Solana right now? Can you show me their price performance?可视化投资组合分配
Analyze my wallet and visualize my portfolio allocation as a donut chart.获取价格预测
What's your price prediction for SOL token in the next 24 hours?输出示例
以下是通过Claude使用不同工具时可以看到的示例:
数据获取示例
令牌数据
当你询问像BONK这样的代币时:
The BONK token (address: DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263) has the following details:
📊 Market Data:
• Current Price: $0.00002981
• Market Cap: $294,152,890
• 24h Volume: $26,843,751
• 24h Change: +7.3%
• All-time High: $0.00003241 (Jan 05, 2024)
💰 Token Economics:
• Total Supply: 99,508,123,523,595
• Circulating Supply: 56,123,876,231,175
• Holders: 842,391 addresses
• Top 10 Holders Control: 47.2% of supply
🔍 Security Analysis:
• Rugpull Risk: Low
• Contract Audit: Passed (Certik)
• Liquidity Score: 9.2/10
• Community Trust: High
• Risk Assessment: Medium钱包代币分析
当您要求分析钱包持有量时:
Wallet FtG3emhAqBC8Rr9vdCqTJHxaNNuQVt7B7HvujJrQEj7Y contains the following tokens:
1. SOL
• Amount: 12.45 SOL
• Value: $1,431.75
• % of Portfolio: 68.2%
2. BONK
• Amount: 13,521,340.93 BONK
• Value: $402.87
• % of Portfolio: 19.2%
3. JTO
• Amount: 38.72 JTO
• Value: $264.15
• % of Portfolio: 12.6%
Total Portfolio Value: $2,098.77价格历史数据
请求价格历史记录时:
Price history for SOL over the last 30 days:
Date | Price (USD) | 24h Volume | Market Cap
------------|-------------|-------------|-------------
2025-03-15 | $115.32 | $1.42B | $49.73B
2025-03-08 | $109.78 | $1.27B | $47.38B
2025-03-01 | $103.65 | $1.15B | $44.73B
2025-02-22 | $114.21 | $1.33B | $49.27B
2025-02-15 | $95.83 | $0.98B | $41.35B
The token has shown an overall upward trend with a 20.3% increase over the past 30 days, despite some volatility in the middle of the period.证券分析
当询问令牌安全性时:
Security Analysis for BONK token (DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263):
✅ Contract Analysis:
• No backdoor functions detected
• No proxy implementation risks
• No excessive owner privileges
• No unusual fee mechanisms
⚖️ Liquidity Analysis:
• Total Liquidity: $18.52M across 5 DEXes
• Largest Pool: Raydium SOL/BONK with $7.82M
• Liquidity Concentration Score: 8.4/10 (Well distributed)
🔍 Ownership Structure:
• Creator Ownership: 12% (vested over 3 years)
• DAO Treasury: 18%
• Community Allocation: 70%
⚠️ Risk Factors:
• Meme token volatility
• Significant social media influence on price
• High correlation with overall market sentiment
🔐 Overall Security Score: 8.2/10 (Low Risk)可视化示例
甜甜圈图
当要求可视化投资组合分配时:
Portfolio Allocation for FtG3emhAqBC8Rr9vdCqTJHxaNNuQVt7B7HvujJrQEj7Y
╭───────────────────────────╮
/ SOL 68.2% \
/ ████████████████ \
| ████████████████ |
| ████████████████ |
| BONK ████████████████ JTO |
| 19.2% ███ ████████████████ ███ |
\ ███ ████████████████ ███ /
\ ███ ███/
╰───███───────────────────███╯
12.6%
Total Portfolio Value: $2,098.77热图
当要求可视化跨时间段的令牌性能时:
Token Performance Heatmap (% Change)
| 24h | 7d | 30d | 90d |
-----------+--------+--------+--------+--------|
SOL | +3.2% | +12.5% | +20.3% | +65.7% |
BONK | +7.3% | -3.8% | +41.2% | +18.5% |
JTO | -1.5% | +5.7% | +9.2% | +32.1% |
PYTH | +2.7% | +8.2% | +15.7% | +27.5% |
RENDER | +0.5% | -2.3% | +11.3% | +42.8% |
Legend: █ >30% █ 10-30% █ 0-10% █ -10-0% █ <-10%网络图
在可视化令牌关系时:
Network Graph: Solana DeFi Token Relationships
┌────────┐
│ SOL │
└────────┘
│
┌──────────────┼──────────────┐
│ │ │
┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐
│ BONK │ │ USDC │ │ JTO │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
│ │ │
┌───▼───┐ ┌───▼───┐ ┌───▼───┐
│ wBTC │ │ ETH │ │ PYTH │
└───────┘ └───────┘ └───────┘
Legend:
- Node size represents market cap
- Edge thickness represents liquidity between tokens桑基图
在可视化令牌流时:
Sankey Diagram: Token Flow Between Major Wallets (Last 7 Days)
Exchange Wallets DeFi Protocols
┌───────────────────┐ ┌─────────────────────┐
│ │ 12,500 SOL │ │
│ Binance ├───────────────────► Marinade Finance │
│ │ │ │
└───────────────────┘ └─────────────────────┘
│
┌───────────────────┐ │ 9,300 SOL
│ │ 7,800 SOL ┌───────▼─────────────┐
│ Coinbase ├────────────────────► │
│ │ │ Orca Pools │
└───────────────────┘ │ │
└─────────────────────┘
┌───────────────────┐ ▲
│ │ 15,200 SOL │
│ Kraken ├────────────────────────────┘
│ │
└───────────────────┘API密钥获取
以下是如何获取所需的API密钥:
- BirdEye API密钥:注册地址 鸟眼.so
- CoinGecko API密钥:注册地址 coingecko.com/api
- API 密钥:注册地址 那么.ai
- Helius RPC URL:注册地址 赫利乌斯·德夫
项目结构
该项目的结构如下:
src/:MCP服务器的源代码
- index.ts:服务器的主要入口点 - tools/:实施各种功能的工具 - utils/:实用函数和助手 - types/:TypeScript类型定义
build/:编译的JavaScript代码(运行后生成npm run build).env:API键的环境变量claude_desktop_config.json:克劳德桌面配置
局限性
- 自由层API密钥具有可能影响功能的速率限制
- 如果没有高级API访问权限,某些工具的功能可能会降低
- 当前的实现为某些API使用了模拟插件
- 不支持事务执行-出于安全考虑,服务器是只读的
故障排除
找不到模块错误
如果您在Claude Desktop中遇到“找不到模块”错误,请确保:
- claude_desktop_config.json中index.js文件的路径是正确的
- 这
--input-type=module标志包含在args数组中 - 您已使用重建项目
npm run build - 您已完全重新启动Claude Desktop
API关键问题
如果工具因API错误而失败:
- 验证您的API密钥在两个
.env和claude_desktop_config.json - 检查API免费层是否有任何费率限制
- 确保大小写正确(尤其是BirdEye API密钥)
许可证
麻省理工学院
致谢
该项目是使用以下方式构建的:
