This MCP server provides a standardized interface for AI agents to interact with the Solana blockchain. Based on the Solana Agent Kit, it enables Claude AI to perform various blockchain operations through a Model Context Protocol implementation.
The easiest way to install the Solana MCP server is via npm:
npm install solana-mpc
Or if you prefer using yarn:
yarn add solana-mpc
To install the server manually:
Clone the repository:
git clone https://github.com/username/solana-agent-kit-mcp-server.git
cd solana-agent-kit-mcp-server
Install dependencies:
npm install
Build the project:
npm run build
Create a configuration file named config.json
in your project root:
{
"port": 3000,
"rpcEndpoint": "https://api.mainnet-beta.solana.com",
"defaultCommitment": "confirmed",
"rateLimiting": {
"enabled": true,
"maxRequests": 100,
"timeWindow": 60000
}
}
Start the MCP server:
npm start
For development with auto-reloading:
npm run dev
The MCP server provides several actions for interacting with the Solana blockchain:
// Example request to get validator information
const response = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'GET_VALIDATOR_INFO',
params: {
limit: 10
}
})
});
const data = await response.json();
// Example request to estimate transaction fees
const response = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'GET_PRIORITY_FEE_ESTIMATE',
params: {
priorityLevel: 'medium'
}
})
});
const data = await response.json();
// Example request to get transaction history
const response = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'GET_TRANSACTION_HISTORY',
params: {
address: 'wallet_address_here',
limit: 20,
before: 'optional_signature_for_pagination'
}
})
});
const data = await response.json();
// Example request to get security.txt information
const response = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'GET_SECURITY_TXT',
params: {
programId: 'program_address_here'
}
})
});
const data = await response.json();
The server also supports other core Solana operations:
// Example request to get asset information
const response = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'GET_ASSET',
params: {
assetId: 'asset_id_here'
}
})
});
const data = await response.json();
// Example request to transfer tokens
const response = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: 'TRANSFER',
params: {
source: 'source_wallet_address',
destination: 'destination_wallet_address',
amount: 1.5,
token: 'token_address' // Optional for SOL
}
})
});
const data = await response.json();
The server returns standard HTTP status codes:
Error responses include a descriptive message to help diagnose issues.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.