Solana MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Uses dotenv for environment variable management to securely store configuration like private keys and API endpoints.

  • Can use Alchemy as an RPC endpoint provider for connecting to the Solana blockchain.

  • Supports integration with OpenAI models (like ChatGPT) as AI agents that can perform DeFi operations on Solana through the MCP server.

Solana MCP (Model Context Protocol)

A powerful Model Context Protocol (MCP) server for AI agents to interact with the Solana blockchain and DeFi protocols.

šŸš€ Overview

Solana MCP provides a standardized interface for AI agents (like Claude, ChatGPT, etc.) to perform DeFi operations on the Solana blockchain. It bridges the gap between artificial intelligence and decentralized finance, allowing AI systems to:

  • Query wallet balances and token holdings
  • Transfer SOL and SPL tokens
  • Execute token swaps
  • Fetch real-time price data
  • Perform advanced DeFi operations

Built on top of the Solana Agent Kit and the Model Context Protocol (MCP), this tool provides a secure, efficient, and standardized interface for automated DeFi operations.

šŸ“‹ Prerequisites

  • Node.js v22.x or later
  • npm or yarn package manager
  • Solana wallet (keypair)
  • RPC endpoint for Solana (e.g., Helius, Alchemy, or your own node)

šŸ”§ Installation

  1. Clone this repository:
git clone https://github.com/caiovicentino/Solana-MCP.git cd Solana-MCP
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory with the following variables:
SOLANA_PRIVATE_KEY=your_private_key_here RPC_URL=your_rpc_url_here OPENAI_API_KEY=optional_if_using_openai

āš ļø Security Warning: Never commit your .env file or expose your private key. Add .env to your .gitignore file.

  1. Build the project:
npm run build

šŸš€ Usage

Start the MCP server:

npm start

When successfully started, you should see:

āœ… Connected to Solana šŸ”— Using RPC: [your-rpc-endpoint] šŸ‘› Wallet configured: [your-wallet-address] šŸš€ Starting Yield AI MCP Server... šŸ“Š Available DeFi actions: 8 āœØ Yield AI MCP Server started. Ready to perform DeFi operations on Solana!

šŸ’¬ Available Actions

The following DeFi actions are available through the MCP server:

ActionDescription
get_walletGet the current wallet address
check_balanceCheck SOL balance of the wallet
transfer_solTransfer SOL to another wallet
list_tokensList all tokens in the wallet
fetch_priceFetch current price of a token
trade_tokensExecute a trade between tokens
get_tpsGet current Solana network TPS
swap_tokensSwap tokens via liquidity pools

šŸ”Œ Integration with AI Models

This MCP server is designed to be used with AI models that support the Model Context Protocol. The server uses standard input/output for communication, making it compatible with various AI integration frameworks.

Example of using with Claude:

// Example code for integrating with Claude API // (Placeholder - actual integration depends on your specific AI framework)

šŸ”’ Security Considerations

  • Always review transactions before they are executed
  • Consider implementing transaction limits
  • Secure your private key with proper key management practices
  • Use a dedicated wallet with limited funds for testing
  • Monitor for any suspicious activities

šŸ› ļø Advanced Configuration

For more advanced configurations, you can modify the following files:

  • src/index.ts: Main entry point
  • .env: Environment configuration

šŸ“š Resources

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ¤ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request
-
security - not tested
A
license - permissive license
-
quality - not tested

A Model Context Protocol server enabling AI agents to interact with the Solana blockchain for DeFi operations like checking balances, transferring tokens, executing swaps, and fetching price data.

  1. šŸš€ Overview
    1. šŸ“‹ Prerequisites
      1. šŸ”§ Installation
        1. šŸš€ Usage
          1. šŸ’¬ Available Actions
            1. šŸ”Œ Integration with AI Models
              1. šŸ”’ Security Considerations
                1. šŸ› ļø Advanced Configuration
                  1. šŸ“š Resources
                    1. šŸ“„ License
                      1. šŸ¤ Contributing