MCP HubMCP Hub
openSVM

solana-mcp-server

by: openSVM

solana mcp sever to enable solana rpc methods

21created 14/01/2025
Visit
Solana
RPC

📌Overview

Purpose: To provide comprehensive access to Solana blockchain data through a Model Context Protocol (MCP) server, enabling users to query information directly via natural language conversations.

Overview: The Solana MCP server implements a range of Solana RPC methods, allowing for easy retrieval of blockchain information. This server is designed for users to interact seamlessly with the Solana blockchain by simplifying queries into conversational prompts.

Key Features:

  • Natural Language Interface: Enables users to ask queries in everyday language, making blockchain data more accessible.

  • Extensive RPC Methods: Offers a wide variety of RPC methods covering account, block, system, epoch, inflation, token, and transaction data, allowing comprehensive data retrieval from the Solana blockchain.

  • Configurable Environment: Facilitates setup through pre-built binaries or from source, adjustable to cater to different environments and user needs.


Solana MCP Server

A Model Context Protocol (MCP) server that provides access to Solana blockchain data through Cline. It implements a wide range of Solana RPC methods, enabling blockchain queries via natural language conversations.

Installation

Using Pre-built Binaries

  1. Go to the Releases page.
  2. Download the appropriate binary for your system:
    • Linux: solana-mcp-server-linux-amd64
    • macOS Intel: solana-mcp-server-macos-amd64
    • macOS Apple Silicon: solana-mcp-server-macos-arm64
    • Windows: solana-mcp-server-windows-amd64.exe
  3. Make the binary executable (Linux/macOS):
    chmod +x solana-mcp-server-*
    
  4. Configure Claude Desktop:
    CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/claude"
    mkdir -p "$CONFIG_DIR"
    echo "{\"mcpServers\":{\"solana\":{\"command\":\"$PWD/solana-mcp-server-*\",\"env\":{\"SOLANA_RPC_URL\":\"https://api.mainnet-beta.solana.com\"}}}}" > "$CONFIG_DIR/config.json"
    

Building from Source

TEMP_DIR=$(mktemp -d) && cd "$TEMP_DIR" && git clone https://github.com/opensvm/solana-mcp-server.git . && cargo build --release && CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/claude" && mkdir -p "$CONFIG_DIR" && echo "{\"mcpServers\":{\"solana\":{\"command\":\"$PWD/target/release/solana-mcp-server\",\"env\":{\"SOLANA_RPC_URL\":\"https://api.mainnet-beta.solana.com\"}}}}" > "$CONFIG_DIR/config.json" || { rm -rf "$TEMP_DIR"; exit 1; }

Available RPC Methods

Account Methods

  • getAccountInfo: Returns information associated with a given account Pubkey.
  • getMultipleAccounts: Returns account information for multiple Pubkeys.
  • getProgramAccounts: Returns all accounts owned by a program Pubkey.
  • getBalance: Returns the SOL balance of an account.
  • getLargestAccounts: Returns the 20 largest accounts by lamport balance.

Block Methods

  • getBlock: Returns identity and transaction information about a confirmed block.
  • getBlocks: Lists confirmed blocks between two slots.
  • getBlocksWithLimit: Lists confirmed blocks from a slot up to a limit.
  • getBlockTime: Returns estimated production time of a block.
  • getBlockHeight: Returns current block height.
  • getBlockCommitment: Returns commitment information for a block.
  • getBlockProduction: Returns recent block production data.

System Methods

  • getHealth: Returns node health status.
  • getVersion: Returns Solana version running on the node.
  • getIdentity: Returns node identity pubkey.
  • getClusterNodes: Returns information about all cluster nodes.
  • getVoteAccounts: Returns info and stake for all voting accounts.

Epoch and Inflation Methods

  • getEpochInfo: Information about the current epoch.
  • getEpochSchedule: Epoch schedule information.
  • getInflationGovernor: Current inflation governor data.
  • getInflationRate: Inflation rates for the current epoch.
  • getInflationReward: Inflation rewards for addresses.

Token Methods

  • getTokenAccountBalance: Returns token balance of an SPL Token account.
  • getTokenAccountsByDelegate: Returns token accounts by delegate.
  • getTokenAccountsByOwner: Returns token accounts by owner.
  • getTokenLargestAccounts: Returns 20 largest token accounts for a mint.
  • getTokenSupply: Returns total supply of a token mint.

Transaction Methods

  • getTransaction: Returns details of a confirmed transaction.
  • getSignaturesForAddress: Returns transaction signatures for an address.
  • getSignatureStatuses: Returns statuses for a list of signatures.
  • getTransactionCount: Returns current transaction count.
  • simulateTransaction: Simulates sending a transaction.
  • sendTransaction: Sends a transaction.

Other Methods

  • getFeeForMessage: Returns fee for a message.
  • getLatestBlockhash: Returns the latest blockhash.
  • isBlockhashValid: Checks if a blockhash is valid.
  • getStakeMinimumDelegation: Returns minimum stake delegation.
  • getSupply: Returns current supply info.
  • requestAirdrop: Requests an airdrop of lamports.

Usage Examples

Interact with the Solana blockchain via natural language in Cline. Example queries:

  • 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 ...

Environment Variables

  • SOLANA_RPC_URL: (Optional) Solana RPC endpoint to use. Defaults to https://api.mainnet-beta.solana.com.

Development

Prerequisites

  • Rust and Cargo.

Building

cargo build

Running

cargo run

License

MIT License