
Solana MCP Server

2025.01.14
1
Rust区块链服务金融数据查询金融服务
Solana MCP Server 是一个基于 Model Context Protocol (MCP) 的服务,提供通过 Cline 访问 Solana 区块链数据的全面功能。该服务器实现了多种 Solana RPC 方法,使用户能够通过自然语言对话直接查询区块链信息。
View on GitHub
Overview
基本能力
产品定位
Solana MCP Server 是一个专门为 Solana 区块链设计的 MCP 服务器,旨在通过自然语言交互简化区块链数据的查询和操作。
核心功能
服务器提供了 21 种关键的 Solana RPC 方法,涵盖以下类别:
账户和余额操作
get_sol_balance
: 获取地址的 SOL 余额get_token_balance
: 获取 SPL 代币余额get_account_info
: 获取账户信息get_largest_accounts
: 获取网络上最大的账户
区块和交易信息
get_slot
: 获取当前插槽get_block
: 获取区块信息get_block_time
: 获取区块生产时间get_transaction
: 获取交易详情get_recent_blockhash
: 获取最近的区块哈希
代币操作
get_token_accounts_by_owner
: 按所有者获取代币账户get_token_accounts_by_delegate
: 获取委托的代币账户get_token_supply
: 获取代币供应信息
系统信息
get_epoch_info
: 获取当前纪元信息get_version
: 获取节点版本get_health
: 获取节点健康状态get_supply
: 获取当前供应量get_inflation_rate
: 获取通胀率get_cluster_nodes
: 获取集群节点信息get_minimum_balance_for_rent_exemption
: 获取最低租金豁免余额
质押和治理
get_vote_accounts
: 获取投票账户get_leader_schedule
: 获取领导者计划
适用场景
- 查询 Solana 区块链上的账户余额和交易信息
- 监控区块链网络状态和健康情况
- 管理代币账户和查询代币信息
- 获取区块链网络统计数据和系统信息
使用教程
使用依赖
- Rust 和 Cargo
- Solana CLI 工具(可选,用于测试)
安装教程
macOS 安装命令
mkdir -p ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/ && echo '{"mcpServers":{"solana":{"command":"cargo","args":["run"],"cwd":"'$(pwd)'","env":{"SOLANA_RPC_URL":"https://api.mainnet-beta.solana.com"}}}}' > ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Linux 安装命令
mkdir -p ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/ && echo '{"mcpServers":{"solana":{"command":"cargo","args":["run"],"cwd":"'$(pwd)'","env":{"SOLANA_RPC_URL":"https://api.mainnet-beta.solana.com"}}}}' > ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Windows (PowerShell) 安装命令
$settings = @{mcpServers=@{solana=@{command="cargo";args=@("run");cwd=$PWD.Path;env=@{SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"}}}} | ConvertTo-Json -Depth 10; New-Item -ItemType Directory -Force "$env:APPDATA\Code\User\globalStorage\saoudrizwan.claude-dev\settings"; $settings | Out-File "$env:APPDATA\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json"
调试方式
构建项目
cargo build
运行项目
cargo run
使用示例
配置完成后,您可以通过 Cline 中的自然语言与 Solana 区块链交互。以下是一些示例查询:
- "What's the SOL balance of address Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr?"
- "Show me the current slot number"
- "Get information about the latest block"
- "What's the current inflation rate?"
- "Show me the token accounts owned by address ..."
环境变量
SOLANA_RPC_URL
: (可选) 使用的 Solana RPC 端点。如果未指定,默认为 "https://api.mainnet-beta.solana.com"。