PumpSwap MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An MCP server that enables AI agents to interact with PumpSwap for real-time token swaps and automated on-chain trading.
Features
- **Buy Tokens**: Purchase tokens using SOL with customizable slippage and priority fees.
- **Sell Tokens**: Sell tokens for SOL with configurable parameters.
- **Token Price Query**: Retrieve current token prices in SOL.
- **Pool Data Retrieval**: Fetch and display detailed pool information for a given token mint.
Prerequisites
- Python 3.13 or higher
- uv for dependency management and script execution
- Solana RPC endpoint (e.g., https://api.mainnet-beta.solana.com)
- A valid Solana private key for transaction signing
Installation
1. **Clone the Repository**:
2. **Install uv**:
If uv is not installed, follow the official uv installation guide. For example:
3. **Set Up Dependencies**:
Use uv to install dependencies:
4. **Configure Environment Variables**:
Create a .env.private filein the project root with the following variables:
Replace your-solana-private-key with your actual Solana private key.
Usage
Run the MCP Server
Use uv to run the server:
The server will listen for MCP commands and expose the following tools:
- buy_token(mint: str, sol_amount: float, user_private_key: str): Buy tokens with SOL.
- sell_token(mint: str, token_amount: float, user_private_key: str): Sell tokens for SOL.
- get_token_price(mint: str): Fetch the current token price in SOL.
- get_pool_data(mint: str): Retrieve formatted pool data for a token.
Buy Tokens
**Prompt**:
This triggers buy_token("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump", 0.1).
**Expected Output**:
Sell Tokens
**Prompt**:
This triggers sell_token("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump", 1000).
**Expected Output**:
Get Token Price
**Prompt**:
This triggers get_token_price("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump").
**Expected Output**:
Get Pool Data
**Prompt**:
This triggers get_pool_data("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump").
**Expected Output**:
Environment Variables
The server uses the following environment variables, loaded from .env.private:
| Variable | Description | Default Value |
|-----------------------|--------------------------------------------------|-------------------------------------|
| HTTPS_RPC_ENDPOINT | Solana RPC endpoint URL | https://api.mainnet-beta.solana.com |
| BUY_SLIPPAGE | Slippage tolerance for buy transactions | 0.3 (30%) |
| SELL_SLIPPAGE | Slippage tolerance for sell transactions | 0.1 (10%) |