solana-mcp-server

iclaudiumihaila/solana-mcp-server

3.2

If you are the rightful owner of solana-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A comprehensive MCP server for interacting with the Solana blockchain through natural language, powered by Solscan Pro API v2.0.

Tools
3
Resources
0
Prompts
0

Solana MCP Server

A comprehensive MCP (Model Context Protocol) server for interacting with the Solana blockchain through natural language. Powered by Solscan Pro API v2.0 with support for multiple data providers.

Features

  • šŸš€ Comprehensive Blockchain Data: Access token prices, wallet portfolios, DeFi activities, and more
  • šŸ“Š Solscan Pro API Integration: Professional-grade data with high reliability
  • šŸ”„ Multiple Data Providers: Fallback support with DexScreener and Jupiter
  • ⚔ Smart Caching: Reduces API calls and improves response time
  • šŸ›”ļø Error Handling: Graceful error handling with user-friendly messages
  • 🧮 Trading Tools: Built-in calculator for profit/loss, position sizing, etc.

Installation

Prerequisites

Quick Start

  1. Clone the repository
git clone https://github.com/yourusername/solana-mcp-server.git
cd solana-mcp-server
  1. Install dependencies
pip install -e .
  1. Configure API key
cp .env.example .env
# Edit .env and add your SOLANA_API_KEY
  1. Add to Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "solana": {
      "command": "python",
      "args": ["/path/to/solana-mcp-server/server.py"],
      "env": {
        "SOLANA_API_KEY": "your_solscan_api_key_here"
      }
    }
  }
}
  1. Restart Claude Desktop

Available Tools

šŸŖ™ Token Operations

Get Token Info

Get comprehensive token data including price, market cap, holders, and liquidity.

"What's the price of USDC?"
"Get info for token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
Get Token Prices

Get current prices for single or multiple tokens.

"Get price for [token_address]"
"Get prices for multiple tokens: [address1, address2, address3]"
Find Trending Tokens

Discover trending and popular tokens on Solana.

"Show me trending tokens on Solana"
"What are the top gaining tokens today?"

šŸ‘› Wallet/Account Operations

Get Wallet Portfolio

Complete portfolio analysis with token balances and values.

"Show portfolio for wallet [address]"
"What tokens does [wallet_address] hold?"
Get Wallet Transactions

View transaction history for any wallet.

"Show recent transactions for [wallet]"
"Get transaction history for [address]"
Get DeFi Activities

Track DeFi positions and activities.

"Show DeFi activities for [wallet]"
"What yield farms is [address] in?"

🧮 Trading Calculator

Perform various trading calculations:

  • Profit/Loss: Calculate P&L with fees
  • Position Sizing: Risk management calculations
  • Price Targets: Calculate multiplier targets
  • Price Impact: Estimate slippage
"Calculate profit if I buy at 0.01 and sell at 0.05 with 1000 tokens"
"What's the position size with $10000 capital and 2% risk?"

API Key Configuration

The server requires a Solscan Pro API key. You can provide it in several ways:

  1. Environment Variable (Recommended for development)
export SOLANA_API_KEY=your_key_here
  1. In .env file (Recommended for persistent setup)
SOLANA_API_KEY=your_key_here
  1. In Claude config (Recommended for Claude Desktop)
"env": {
  "SOLANA_API_KEY": "your_key_here"
}

Project Structure

solana-mcp-server/
ā”œā”€ā”€ server.py           # Main MCP server
ā”œā”€ā”€ providers/          # Data provider integrations
│   ā”œā”€ā”€ solscan/       # Solscan Pro API client
│   ā”œā”€ā”€ dexscreener.py # DexScreener integration
│   └── jupiter.py     # Jupiter aggregator
ā”œā”€ā”€ tools/             # MCP tool implementations
│   ā”œā”€ā”€ token/         # Token-related tools
│   ā”œā”€ā”€ account/       # Wallet/account tools
│   ā”œā”€ā”€ defi/          # DeFi analytics
│   └── market/        # Market data tools
└── utils/             # Utility functions
    ā”œā”€ā”€ cache.py       # Caching system
    └── formatter.py   # Response formatting

Development

Running Tests

python -m pytest tests/

Adding New Tools

  1. Create a new file in tools/ directory
  2. Inherit from BaseTool class
  3. Implement name, description, and execute methods
  4. Register in server.py

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Error Handling

The server includes comprehensive error handling:

  • API failures gracefully fallback to cached data
  • User-friendly error messages
  • Automatic retries for transient failures
  • Rate limiting protection

Caching Strategy

  • Token prices: 30 seconds TTL
  • Account data: 60 seconds TTL
  • Trending tokens: 5 minutes TTL
  • Historical data: 10 minutes TTL

License

MIT License - see LICENSE file for details

Support

Disclaimer

This tool requires a Solscan Pro API key for full functionality. Some features may be limited without proper API access. Always verify critical financial data from multiple sources.