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(模型上下文协议)

一个强大的模型上下文协议 (MCP) 服务器,用于 AI 代理与 Solana 区块链和 DeFi 协议进行交互。

🚀 概述

Solana MCP 为 AI 代理(如 Claude、ChatGPT 等)提供了标准化接口,以便在 Solana 区块链上执行 DeFi 操作。它弥合了人工智能与去中心化金融之间的差距,使 AI 系统能够:

  • 查询钱包余额和代币持有量
  • 转移 SOL 和 SPL 代币
  • 执行代币交换
  • 获取实时价格数据
  • 执行高级 DeFi 操作

该工具建立在Solana Agent Kit和模型上下文协议 (MCP) 之上,为自动化 DeFi 操作提供了安全、高效和标准化的接口。

📋 先决条件

  • Node.js v22.x 或更高版本
  • npm 或 yarn 包管理器
  • Solana 钱包(密钥对)
  • Solana 的 RPC 端点(例如 Helius、Alchemy 或您自己的节点)

🔧 安装

  1. 克隆此存储库:
git clone https://github.com/caiovicentino/Solana-MCP.git cd Solana-MCP
  1. 安装依赖项:
npm install
  1. 在根目录中创建一个.env文件,其中包含以下变量:
SOLANA_PRIVATE_KEY=your_private_key_here RPC_URL=your_rpc_url_here OPENAI_API_KEY=optional_if_using_openai

⚠️安全警告:切勿提交你的.env文件或暴露你的私钥。请将.env添加到你的.gitignore文件中。

  1. 构建项目:
npm run build

🚀 使用方法

启动 MCP 服务器:

npm start

成功启动后,您应该看到:

✅ 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!

💬 可用操作

通过 MCP 服务器可以进行以下 DeFi 操作:

行动描述
get_wallet获取当前钱包地址
check_balance检查钱包的 SOL 余额
transfer_sol将 SOL 转移到另一个钱包
list_tokens列出钱包中的所有代币
fetch_price获取代币的当前价格
trade_tokens执行代币之间的交易
get_tps获取当前 Solana 网络 TPS
swap_tokens通过流动性池交换代币

🔌 与 AI 模型集成

该 MCP 服务器旨在与支持模型上下文协议 (MCP) 的 AI 模型配合使用。该服务器使用标准输入/输出进行通信,从而兼容各种 AI 集成框架。

与 Claude 一起使用的示例:

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

🔒 安全注意事项

  • 执行交易前务必检查交易
  • 考虑实施交易限制
  • 通过适当的密钥管理实践保护您的私钥
  • 使用资金有限的专用钱包进行测试
  • 监视任何可疑活动

🛠️高级配置

对于更高级的配置,您可以修改以下文件:

  • src/index.ts :主入口点
  • .env :环境配置

📚 资源

📄 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

🤝 贡献

欢迎贡献代码!欢迎提交 Pull 请求。

  1. 分叉项目
  2. 创建你的功能分支( git checkout -b feature/amazing-feature
  3. 提交您的更改( git commit -m 'Add some amazing feature'
  4. 推送到分支( git push origin feature/amazing-feature
  5. 打开拉取请求
-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器使 AI 代理能够与 Solana 区块链交互以执行 DeFi 操作,例如检查余额、转移代币、执行交换和获取价格数据。

  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
                        ID: jjut2t85re