Building an MCP Server for Solana: 7 Tools for AI Agents

Published: (March 17, 2026 at 03:11 PM EDT)
3 min read
Source: Dev.to

Source: Dev.to

Every time you trade a token on Solana, a token account is created that locks ~0.002 SOL as rent. After selling, that SOL stays trapped. Multiply by hundreds of trades and you have real money sitting idle.

We built RefundYourSOL to fix this — 650 K+ wallets processed so far. Then we wrapped our APIs into an MCP server so AI agents can do the same thing conversationally.

What is MCP?

Model Context Protocol (MCP) is an open standard that lets AI models call external tools. Instead of copy‑pasting wallet addresses between apps, you tell your AI assistant what to do and it handles the rest. MCP works with Claude Desktop, Cursor, Windsurf, Claude Code, and other AI interfaces.

The 7 Tools

Free (no private key needed)

  • scan_wallet – Scan any Solana wallet for reclaimable SOL locked in empty token accounts.

    {
      "wallet": "YourWalletAddress",
      "totalAccounts": 47,
      "estimatedSolRecoverable": "0.0959 SOL"
    }
  • detect_dex – Find which DEX a token trades on, plus price, market cap, and liquidity.

    {
      "mint": "8gHPxqgHj6JQ2sQtMSghQYVN5qRP8wm5T6HNejuwpump",
      "dex": "pumpswap",
      "tokenName": "RefundYourSOL",
      "priceUsd": 0.00042
    }
  • get_token_info – Batch metadata and pricing for up to 10 tokens.

  • get_sol_price – Current SOL/USD price.

Require Private Key

  • close_accounts – Close empty token accounts and reclaim rent SOL. Uses a dry‑run/confirm pattern: the first call shows a preview, the second call with an execution token (60 s TTL) performs the action.
  • burn_and_close – Burn worthless dust tokens and close accounts in one step.
  • trade_token – Buy or sell on 12+ DEXes (PumpSwap, Raydium, Meteora, Orca, FluxBeam, etc.). Fast mode delivers sub‑400 ms execution. Optional Jito MEV protection.

Setup (≈10 seconds)

Scan‑only mode (4 tools, no key needed)

{
  "mcpServers": {
    "refundyoursol": {
      "command": "npx",
      "args": ["-y", "@refundyoursol/mcp"]
    }
  }
}

Full mode (all 7 tools)

{
  "mcpServers": {
    "refundyoursol": {
      "command": "npx",
      "args": ["-y", "@refundyoursol/mcp"],
      "env": {
        "SOLANA_PRIVATE_KEY": "your-base58-key"
      }
    }
  }
}

Safety

Giving AI agents transaction‑signing power is risky. We mitigate it with:

  • Two‑step execution – Every destructive operation starts with a mandatory dry run. A second call with a one‑time execution token (60 s TTL, single‑use) actually executes.
  • Safety Burns – If the wrong token is burned, we can reverse it. No other Solana tool offers this.
  • Scan‑only mode – Omit the private key to expose only read‑only tools.
  • Local signing – Private keys stay on your machine and are never transmitted.

What Makes This Different

Most Solana MCPs provide 3–4 tools for wallet cleanup. Ours offers 7, including token trading on 12+ DEXes—something no other Solana MCP provides. MCP agents automatically receive a discounted 3.5 % fee, with no token holdings or XP required.

  • npm:
  • GitHub:
  • Web app:
  • API docs:

We’d love feedback—especially from anyone building Solana agents. What tools would you want an MCP to expose?

0 views
Back to Blog

Related posts

Read more »