A Model Context Protocol (MCP) server that enables AI assistants like Claude to develop and deploy Solana smart contracts end-to-end. This server acts as a bridge between AI language models and the Solana blockchain, providing a standardized interface for blockchain interactions.
Important Update: This project is currently being migrated from Solana web3.js v1.x to v2.0 to take advantage of improved performance, better type safety, and modern functional programming patterns. See the migration plan for details.
The Model Context Protocol (MCP) is an open standard that allows AI assistants to access external tools and data sources in a secure, controlled manner. This server implements the MCP specification to expose Solana blockchain functionality to AI assistants.
This MCP server provides AI assistants with the ability to:
Interact with the Solana Blockchain: Query account data, check balances, view transaction history, and get network status from various Solana clusters (mainnet, testnet, devnet)
Create and Manage Transactions: Build, simulate, sign, and send transactions to the Solana blockchain with proper error handling and fee estimation
Develop Smart Contracts: Access templates, compile, test, and deploy Solana programs written in Rust using the Solana SDK or Pinocchio framework
Manage Wallets and Keys: Generate keypairs, derive addresses, and interact with wallet adapters while maintaining security best practices
Work with Tokens: Create, transfer, and manage SPL tokens and token accounts
The server exposes three types of MCP capabilities:
All blockchain interactions are performed through the @solana/web3.js library and related SDKs, with the MCP server acting as a secure intermediary between the AI and the blockchain.
# Clone the repository
git clone https://github.com/FrankGenGo/solana-web3js-mcp-server.git
cd solana-web3js-mcp-server
# Install dependencies
npm install
# Build the server
npm run build
# Start the server
npm start
Install Claude Desktop
Add the following to your Claude Desktop configuration file:
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"solana": {
"command": "node",
"args": ["/absolute/path/to/solana-web3js-mcp-server/dist/index.js"]
}
}
}
Restart Claude Desktop
You can now ask Claude to perform Solana-related tasks, such as:
getAccountInfo
: Fetch and decode account informationcheckAccountBalance
: Get SOL balance for an addressfindProgramAccounts
: Find accounts owned by a programgetRentExemption
: Calculate minimum balance for rent exemptioncreateTransaction
: Build a transaction with specified instructionssignTransaction
: Sign a transaction with one or more keypairssendTransaction
: Send and confirm a transaction on-chainsimulateTransaction
: Simulate a transaction without sending itgetTransactionStatus
: Check the status of a transactiongenerateKeypair
: Create a new Solana keypairimportKeypair
: Import an existing keypair from various formatsderiveKeypair
: Derive a keypair from seed, mnemonic, or pathdeployProgram
: Deploy a program to a Solana clusterupgradeProgram
: Upgrade an existing upgradeable programgenerateProgramAddress
: Derive a program derived address (PDA)createToken
: Create a new SPL tokenmintTokens
: Mint tokens to a token accounttransferTokens
: Transfer tokens between accountsgetTokenAccountInfo
: Get token account informationgetTokenSupply
: Get the total supply of a tokengetConfig
: Get current configuration settingssetConfig
: Update configuration parametersgetClusterVersion
: Get Solana cluster versionsaveKeypair
: Save keypair to secure storagerecoverKeypair
: Recover keypair from seed phraseverifyKeypair
: Verify keypair integrityrequestAirdrop
: Request SOL from devnet/testnet faucetmanageStake
: Create and manage stake accountsgetValidators
: Get validator informationgetBlock
: Get block details by slot numbergetBlockProduction
: Get block production statisticsgetRecentBlockhash
: Get recent blockhash with fee calculatorgetEpochInfo
: Get current epoch informationgetInflationRate
: Get current inflation rategetLogs
: Stream and filter transaction logsgetProgramLogs
: Monitor program execution logs# Run in development mode (with auto-reload)
npm run dev
# Run tests (including integration tests against devnet)
npm test
# Lint the code
npm run lint
The test suite includes integration tests that run against the Solana devnet. To set up your environment for testing:
Install Solana CLI: Follow the official installation instructions
Generate a test keypair:
mkdir -p ~/solana-web3js-tests
solana-keygen new --force --no-bip39-passphrase -o ~/solana-web3js-tests/test-keypair.json
Fund the test keypair with devnet SOL:
solana airdrop 1 $(solana address -k ~/solana-web3js-tests/test-keypair.json) --url devnet
Verify the balance:
solana balance -k ~/solana-web3js-tests/test-keypair.json --url devnet
The test suite will automatically use this keypair for integration tests against devnet.
src/index.ts
: Main entry point (implemented)src/solana-server.ts
: Core server implementation (implemented)src/core/connection-manager.ts
: Solana connection management (implemented)src/transport/
: Transport layer implementations
src/transport/stdio.ts
: Standard I/O transport (implemented)src/transport/http.ts
: HTTP/SSE transport (implemented)src/transport/index.ts
: Transport exports (implemented)src/tools/
: Tool implementations for Solana operations
src/tools/accounts/
: Account management tools (implemented)src/tools/transactions/
: Transaction operations tools (implemented)src/tools/keys/
: Key management tools (implemented)src/tools/programs/
: Program development tools (implemented)src/resources/
: Resource implementations for Solana data (planned)src/prompts/
: Reusable prompts for common workflows (planned)src/types/
: TypeScript type definitions
src/types/solana.ts
: Solana-specific type definitions (partial implementation)src/types/tools.ts
: Tool input/output type definitions (planned)src/types/config.ts
: Configuration type definitions (planned)src/utils/
: Utility functions and classes
src/utils/errors.ts
: Error handling system (implemented)src/utils/logging.ts
: Logging system (implemented)This server is designed to be extensible. To add new functionality:
tools
directorysolana-server.ts
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
{
"mcpServers": {
"solana": {
"env": {},
"args": [
"/absolute/path/to/solana-web3js-mcp-server/dist/index.js"
],
"command": "node"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.