DEV Community

RefundYourSOL
RefundYourSOL

Posted on

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

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've got real money sitting idle.

We built RefundYourSOL to fix this — 650K+ 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 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. Works with Claude Desktop, Cursor, Windsurf, Claude Code.

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"
}
Enter fullscreen mode Exit fullscreen mode

detect_dex — Find which DEX a token trades on + price, market cap, liquidity.

{
  "mint": "8gHPxqgHj6JQ2sQtMSghQYVN5qRP8wm5T6HNejuwpump",
  "dex": "pumpswap",
  "tokenName": "RefundYourSOL",
  "priceUsd": 0.00042
}
Enter fullscreen mode Exit fullscreen mode

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 dry-run/confirm pattern — first call shows preview, second call with execution token (60s TTL) executes.

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, and more. Fast mode delivers sub-400ms execution. Optional Jito MEV protection.

Setup (10 seconds)

Scan-only mode (4 tools, no key needed):

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

Full mode (all 7 tools):

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

Safety

Giving AI agents transaction-signing power is risky. Here's how we handle it:

  • Two-step execution — Every destructive operation starts with a mandatory dry run. Only a second call with a one-time execution token (60s TTL, single-use) actually executes.
  • Safety Burns — Accidentally burn the wrong token? We can reverse it. No other Solana tool does this.
  • Scan-only mode — Omit the private key and only read-only tools are exposed.
  • Local signing — Private keys stay on your machine, never transmitted.

What Makes This Different

Other Solana MCPs offer 3-4 tools for wallet cleanup. Ours has 7 — including token trading on 12+ DEXes that no other Solana MCP provides.

MCP agents automatically get a discounted 3.5% fee — no tokens to hold, no XP needed.

Links

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

Top comments (0)