SO

Solana Agent Kit MCP Server for LLMs

Enable LLMs to interact with the Solana blockchain using the Solana Agent Kit MCP server by SendAI, offering 40+ protocol actions and growing.

Quick Install
npx -y @examples/agent-kit-mcp-server

Overview

The Solana Agent Kit MCP Server by SendAI exposes a Model Context Protocol (MCP) compatible HTTP interface that lets LLM-based agents interact with the Solana blockchain. It translates high-level tool calls from an LLM into on-chain queries and transactions, providing a standardized set of protocol actions (40+ and growing) so agents can inspect accounts, sign and send transactions, read program state, and more.

This server is useful when you want to let a language model act on behalf of a user or an automated workflow while keeping blockchain interactions structured and auditable. Instead of embedding raw RPC calls inside prompts, an LLM can call named tools with typed inputs and receive structured outputs — reducing hallucinations and making the agent behavior easier to validate, test, and secure.

Features

  • Exposes MCP-compatible tool endpoints for LLM-driven agents
  • 40+ built-in protocol actions for common Solana operations (account queries, token transfers, transactions, staking, program queries, and more)
  • Configurable Solana RPC endpoint (mainnet, testnet, devnet)
  • Support for signing and broadcasting transactions (local key or external signer)
  • Simple HTTP API for connecting any LLM framework that supports external tools
  • Logging and configurable CORS / auth to integrate into secure deployments
  • Example agent integrations and developer-focused examples in the repo

Installation / Configuration

Clone the example directory and follow the steps below. These commands assume a Node.js-based example server (typical layout for the example project).

  1. Clone the repo and change into the example folder:
git clone https://github.com/sendaifun/solana-agent-kit.git
cd solana-agent-kit/examples/agent-kit-mcp-server
  1. Install dependencies and copy the example environment file:
npm install
cp .env.example .env
  1. Edit .env to configure your environment. Example .env:
# Solana RPC node (Devnet/Mainnet)
SOLANA_RPC_URL=https://api.devnet.solana.com

# Private key or path to keyfile (use secure storage in production!)
PRIVATE_KEY=your_base58_private_key_here

# Server options
MCP_SERVER_PORT=8080
ENABLE_CORS=true
AUTH_TOKEN=supersecret   # optional auth for API calls
LOG_LEVEL=info
  1. Start the server:
npm run start
# or for development
npm run dev

You can also run the server in Docker if a Dockerfile is provided:

docker build -t solana-mcp-server .
docker run -p 8080:8080 --env-file .env solana-mcp-server

Available Tools / Resources

The MCP server exposes a collection of protocol actions grouped by category. Below are representative examples (the example server includes 40+ actions; check the repo for the full list and latest names):

Tool nameDescription
getBalanceReturns SOL balance for a public key
getAccountInfoFetch raw account data and parsed info
getTokenAccountsByOwnerList SPL token accounts for an owner
sendTransactionSign (if configured) and broadcast a transaction
simulateTransactionSimulate a transaction without broadcasting
createAssociatedTokenAccountCreate ATA for a mint/owner
transferTokenTransfer SPL tokens between addresses
getTransactionFetch transaction details by signature
getBlockFetch block data by slot
airdrop (devnet)Request a SOL airdrop on devnet

Resources:

  • GitHub example: https://github.com/sendaifun/solana-agent-kit/tree/main/examples/agent-kit-mcp-server
  • Use the example folder to inspect how each tool maps to RPC calls and signer logic.

Use Cases

  • Wallet-assistant LLM: Answer user queries about balances and recent activity, then prepare a transaction for user confirmation.
    • Example: an LLM calls getBalance -> user confirms -> LLM calls sendTransaction with prepared instructions.
  • Automated trading assistant: Query token balances and recent prices, then execute swaps or token transfers based on rules encoded in the agent.
  • On-chain monitoring agent: Periodically query program accounts and alert (or act) when conditions change (e.g., liquidation risk, stake rewards).
  • Developer tool: Turn natural language prompts into concrete Solana actions for prototyping smart contract interactions.
  • Analytics and reporting: Aggregate account and transaction data to generate summaries for finance dashboards.

Example cURL call (getBalance):

curl -X POST "http://localhost:8080/mcp/invoke" \
  -H "Authorization: Bearer supersecret" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "getBalance",
    "input": { "pubkey": "YourPublicKeyHere" }
  }'

Example response (JSON):

{
  "tool": "getBalance",
  "output": { "lamports": 123456789, "sol": 0.123456789 }
}

Security & Best Practices

  • Never commit private keys to source control. Use secrets managers or hardware signers in production.
  • Run on devnet for experimentation.
  • Enable authentication (AUTH_TOKEN or other) and restrict CORS to trusted origins.
  • Validate and log tool invocations; implement rate-limiting to prevent misuse.
  • Review transaction payloads before broadcasting — prefer flow where the LLM prepares but a human signs final transactions.

For more details and the full list of actions, check the example repository and its source files to see exact tool names, input schemas, and response formats.