MCP Adapter
Create a Model Context Protocol server for the Ping Agent Kit
The @ping-agent-kit/adapter-mcp
adapter provides a framework for creating a Model Context Protocol (MCP) server to handle protocol operations on the Solana blockchain using the Ping Agent Kit.
Install the adapter alongside the core Ping Agent Kit and your desired plugins:
Copy
npm install ping-agent-kit @ping-agent-kit/adapter-mcp @ping-agent-kit/plugin-token dotenv
Supports all actions from the Ping Agent Kit
MCP server implementation for standardized interactions with Claude Desktop
Environment-based configuration
Selective action exposure
Node.js (v16 or higher recommended)
pnpm, yarn, or npm
Solana wallet with private key
Solana RPC URL
Claude Desktop application
Create a new project for your MCP server:
Copy
mkdir ping-agent-mcp
cd ping-agent-mcp
npm init -y
Install the required dependencies:
Copy
npm install ping-agent-kit @ping-agent-kit/adapter-mcp @ping-agent-kit/plugin-token dotenv
Create a .env
file in your project root:
Copy
SOLANA_PRIVATE_KEY=your_private_key_here
RPC_URL=your_solana_rpc_url_here
OPENAI_API_KEY=your_openai_api_key_here
Create an index.js
file with the following code:
Copy
import { PingAgentKit, KeypairWallet } from "ping-agent-kit";
import { startMcpServer } from '@ping-agent-kit/adapter-mcp';
import TokenPlugin from '@ping-agent-kit/plugin-token';
import * as dotenv from "dotenv";
// Load environment variables
dotenv.config();
// Initialize wallet with private key from environment
const wallet = new KeypairWallet(process.env.SOLANA_PRIVATE_KEY);
// Create agent with plugin
const agent = new PingAgentKit(
wallet,
process.env.RPC_URL,
{
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
}
).use(TokenPlugin);
// Select which actions to expose to the MCP server
const finalActions = {
BALANCE_ACTION: agent.actions.find((action) => action.name === "BALANCE_ACTION"),
TOKEN_BALANCE_ACTION: agent.actions.find((action) => action.name === "TOKEN_BALANCE_ACTION"),
GET_WALLET_ADDRESS_ACTION: agent.actions.find((action) => action.name === "GET_WALLET_ADDRESS_ACTION"),
};
// Start the MCP server
startMcpServer(finalActions, agent, { name: "ping-agent", version: "0.0.1" });
Update your package.json
to add the type
field:
Copy
{
"name": "ping-agent-mcp",
"version": "1.0.0",
"type": "module",
"main": "index.js",
"scripts": {
"start": "node index.js"
}
}
Open the Claude Desktop configuration file:
MacOS:
Copy
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows:
Copy
code $env:AppData\Claude\claude_desktop_config.json
Add your MCP server configuration:
Copy
{ "mcpServers": { "agent-kit": { "command": "node", "env": { "RPC_URL": "your_solana_rpc_url_here", "SOLANA_PRIVATE_KEY": "your_private_key_here", "OPENAI_API_KEY": "your_openai_api_key_here" }, "args": [ "/ABSOLUTE/PATH/TO/YOUR/ping-agent-mcp/index.js" ] } } }
Replace the path with the absolute path to your
index.js
file.Restart Claude Desktop after updating the configuration.
You can customize which actions are available to Claude by modifying the finalActions
object:
Copy
// Example of adding more actions from different plugins
const finalActions = {
// Basic wallet actions
BALANCE_ACTION: agent.actions.find((action) => action.name === "BALANCE_ACTION"),
GET_WALLET_ADDRESS_ACTION: agent.actions.find((action) => action.name === "GET_WALLET_ADDRESS_ACTION"),
// Token actions
TOKEN_BALANCE_ACTION: agent.actions.find((action) => action.name === "TOKEN_BALANCE_ACTION"),
TRANSFER_ACTION: agent.actions.find((action) => action.name === "TRANSFER_ACTION"),
// Trading actions
TRADE_ACTION: agent.actions.find((action) => action.name === "TRADE_ACTION"),
};
Start your MCP server (if running manually):
Copy
node index.js
Open Claude Desktop and ask questions about Solana, like:
“What’s my SOL balance?”
“Show me my token balances”
“What’s my wallet address?”
Claude will use your MCP server to interact with the Solana blockchain and provide responses based on the available actions.
Ping Agent Kit MCP Server
A Model Context Protocol (MCP) server that provides onchain tools for Claude AI, allowing it to interact with the Solana blockchain through a standardized interface. This implementation is based on the Ping Agent Kit and enables AI agents to perform blockchain operations seamlessly.
This MCP server extends Claude’s capabilities by providing tools to:
Interact with Solana blockchain
Execute transactions
Query account information
Manage Solana wallets
The server implements the Model Context Protocol specification to standardize blockchain interactions for AI agents.
Node.js (v16 or higher)
pnpm (recommended), npm, or yarn
Solana wallet with private key
Solana RPC URL (mainnet, testnet, or devnet)
Copy
# Download the installation script
curl -fsSL https://raw.githubusercontent.com/pingaifun/ping-mcp/main/scripts/install.sh -o solana-mcp-install.sh
# Make it executable and run
chmod +x ping-mcp-install.sh && ./ping-mcp-install.sh --backup
This will start an interactive installation process that will guide you through:
Setting up Node.js if needed
Configuring your Solana RPC URL and private key
Setting up the Claude Desktop integration
Copy
# Install globally
npm install -g ping-mcp
# Or install locally in your project
npm install ping-mcp
Clone this repository:
Copy
git clone https://github.com/pingaifun/ping-mcp
cd ping-mcp
Install dependencies:
Copy
pnpm install
Build the project:
Copy
pnpm run build
Create a .env
file with your credentials:
Copy
# Solana Configuration
SOLANA_PRIVATE_KEY=your_private_key_here
RPC_URL=your_solana_rpc_url_here
OPENAI_API_KEY=your_openai_api_key # OPTIONAL
To add this MCP server to Claude Desktop, follow these steps:
Locate the Claude Desktop Configuration File
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
Linux:
~/.config/Claude/claude_desktop_config.json
Add the Configuration Create or edit the configuration file and add the following JSON:
If you installed via npm (Option 1):
Copy
{ "mcpServers": { "ping-mcp": { "command": "npx", "args": ["ping-mcp"], "env": { "RPC_URL": "your_solana_rpc_url_here", "SOLANA_PRIVATE_KEY": "your_private_key_here", "OPENAI_API_KEY": "your_openai_api_key" // OPTIONAL }, "disabled": false, "autoApprove": [] } } }
If you built from source (Option 2):
Copy
{ "mcpServers": { "ping-mcp": { "command": "node", "args": ["/path/to/ping-mcp/build/index.js"], "env": { "RPC_URL": "your_solana_rpc_url_here", "SOLANA_PRIVATE_KEY": "your_private_key_here", "OPENAI_API_KEY": "your_openai_api_key" // OPTIONAL }, "disabled": false, "autoApprove": [] } } }
Restart Claude Desktop After making these changes, restart Claude Desktop for the configuration to take effect.
Copy
ping-agent-kit-mcp/
├── src/
│ ├── index.ts # Main entry point
├── package.json
└── tsconfig.json
The MCP server provides all the Ping Agent Kit tools like:
GET_ASSET
- Retrieve information about a Solana asset/tokenDEPLOY_TOKEN
- Deploy a new token on SolanaGET_PRICE
- Fetch price information for tokensWALLET_ADDRESS
- Get the wallet addressBALANCE
- Check wallet balanceTRANSFER
- Transfer tokens between walletsMINT_NFT
- Create and mint new NFTsTRADE
- Execute token tradesREQUEST_FUNDS
- Request funds (useful for testing/development)RESOLVE_DOMAIN
- Resolve Solana domain namesGET_TPS
- Get current transactions per second on Solana
Keep your private key secure and never share it
Use environment variables for sensitive information
Consider using a dedicated wallet for AI agent operations
Regularly monitor and audit AI agent activities
Test operations on devnet/testnet before mainnet
If you encounter issues:
Verify your Solana private key is correct
Check your RPC URL is accessible
Ensure you’re on the intended network (mainnet, testnet, or devnet)
Check Claude Desktop logs for error messages
Verify the build was successful
Key dependencies include:
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature
)Commit your changes (
git commit -m 'Add some amazing feature'
)Push to the branch (
git push origin feature/amazing-feature
)Open a Pull Request
License
This project is licensed under the MIT License.
Last updated