MCP Server Example
Model Context Protocol integration for AI agents.
The MCP example provides a server that exposes wallet tools via the Model Context Protocol (MCP). This allows AI agents that support MCP (Claude Desktop, Cursor, Continue, Roo, Codeium, etc.) to interact with Solana wallets.
What This Is
This MCP server provides AI agents with:
- Wallet management (create, manage addresses)
- Token transfers and balance queries
- DeFi operations via dynamically loaded plugins
- Any functionality exposed by configured plugins
Who Should Use This
- Claude Desktop users wanting Solana capabilities
- Cursor users building Solana applications
- Continue users with VS Code
- Any AI agent that supports MCP protocol
Installation
# Clone and setup
git clone https://github.com/Jonathanthedeveloper/agentic-wallet.git
cd agent-wallet
# Install root dependencies
bun install
# Build packages (required before running examples)
bun run build
# Setup MCP example
cd apps/examples/saw-mcp
bun installConfiguration
Create a .env file:
# Required
SOLANA_PRIVATE_KEY="your_base58_private_key"
SOLANA_RPC_URL="https://api.devnet.solana.com"
# Optional - depends on plugins used
JUPITER_API_KEY="your_jupiter_api_key"Configure Your AI Agent
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"solana-agent-wallet": {
"command": "bun",
"args": ["/path/to/agent-wallet/apps/examples/saw-mcp/src/index.ts"],
"env": {
"SOLANA_PRIVATE_KEY": "your_private_key_here",
"SOLANA_RPC_URL": "https://api.devnet.solana.com"
}
}
}
}Restart Claude to load the new configuration.
Cursor
Edit ~/.cursor/config.json (or %APPDATA%\Cursor\config.json on Windows):
{
"mcpServers": {
"solana-agent-wallet": {
"command": "bun",
"args": ["/path/to/agent-wallet/apps/examples/saw-mcp/src/index.ts"],
"env": {
"SOLANA_PRIVATE_KEY": "your_private_key_here",
"SOLANA_RPC_URL": "https://api.devnet.solana.com"
}
}
}
}Continue (VS Code)
Edit ~/.continue/config.json:
{
"mcpServers": {
"solana-agent-wallet": {
"command": "bun",
"args": ["/path/to/agent-wallet/apps/examples/saw-mcp/src/index.ts"],
"env": {
"SOLANA_PRIVATE_KEY": "your_private_key_here",
"SOLANA_RPC_URL": "https://api.devnet.solana.com"
}
}
}
}Roo
Edit ~/.roo/roo.json:
{
"mcpServers": {
"solana-agent-wallet": {
"command": "bun",
"args": ["/path/to/agent-wallet/apps/examples/saw-mcp/src/index.ts"],
"env": {
"SOLANA_PRIVATE_KEY": "your_private_key_here",
"SOLANA_RPC_URL": "https://api.devnet.solana.com"
}
}
}
}Codeium
Edit ~/.codeium/galena.json or through Codeium's settings:
{
"mcpServers": {
"solana-agent-wallet": {
"command": "bun",
"args": ["/path/to/agent-wallet/apps/examples/saw-mcp/src/index.ts"],
"env": {
"SOLANA_PRIVATE_KEY": "your_private_key_here",
"SOLANA_RPC_URL": "https://api.devnet.solana.com"
}
}
}
}Test It
In your AI agent, try:
What is my wallet address?
What is my SOL balance?
List all available toolsAvailable Tools
Tools are dynamically loaded based on configured plugins. Ask your AI agent:
What tools are available?Or check the source code in src/index.ts to see which plugins are loaded.
Example Prompts
Get Started
What is my wallet address?
What is my SOL balance?Transfer
Transfer 1 SOL to <address>Tool Discovery
What tools do you have access to?
Show me the schema for the swap toolAdding Plugins
Edit src/index.ts to add or remove plugins:
import { jupiterPlugin, raydiumPlugin } from "@agentic-wallet/solana/plugin";
const wallet = new SolanaAgentWallet({
rpcUrl: process.env.SOLANA_RPC_URL!,
provider: createKeypairProvider(process.env.SOLANA_PRIVATE_KEY!),
})
.use(jupiterPlugin())
.use(raydiumPlugin());Each plugin adds its own set of tools. See the Plugins documentation for available plugins.
Common Token Mints
| Token | Mint Address |
|---|---|
| SOL | So11111111111111111111111111111111111111112 |
| USDC | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| USDT | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11Mcx8eK1VZKu |
| JUP | JUPyiwrYJFskUPiHa7hkeR8VUtkqjberbSOWd91pbT2 |
| BONK | DezXAZ8z7PnrnzA3WNQnJ4w3saRSZ4Z3BB4xvuGi1Yt |
Security
- Never share your private key
- Use devnet for testing first
- Review transactions before approving
Troubleshooting
Tools not appearing
- Restart your AI agent completely
- Check the config file syntax is valid JSON
- Verify the path to the script is correct
- Check logs (Claude:
~/Library/Logs/Claude/)
Tool execution fails
- Ensure wallet has sufficient balance
- Check the input format matches schema
- Try on devnet first
Connection refused
- Ensure bun is in PATH
- Verify script path is correct
- Check environment variables are set