Sponsored by Deepsite.site

PumpSwap MCP Server

Created By
kukapay7 months ago
An MCP server that enables AI agents to interact with PumpSwap for real-time token swaps and automated on-chain trading.
Content

PumpSwap MCP Server

An MCP server that enables AI agents to interact with PumpSwap for real-time token swaps and automated on-chain trading.

License Python Status

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:

    git clone https://github.com/kukapay/pumpswap-mcp.git
    cd pumpswap-mcp
    
  2. Install uv: If uv is not installed, follow the official uv installation guide. For example:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  3. Set Up Dependencies: Use uv to install dependencies:

    uv sync
    
  4. Configure Environment Variables: Create a .env.private filein the project root with the following variables:

    HTTPS_RPC_ENDPOINT=https://api.mainnet-beta.solana.com
    BUY_SLIPPAGE=0.3
    SELL_SLIPPAGE=0.1
    SWAP_PRIORITY_FEE=1500000
    PRIVATE_KEY=your-solana-private-key
    

    Replace your-solana-private-key with your actual Solana private key.

Usage

Run the MCP Server

Use uv to run the server:

uv run main.py

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:

Buy 0.1 SOL worth of tokens with mint address FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump.

This triggers buy_token("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump", 0.1).

Expected Output:

Buy successful for 0.1 SOL of token FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump
Transaction ID: <transaction-id>
Amount: <token-amount>
Token Price (SOL): <price>

Sell Tokens

Prompt:

Sell 1000 tokens of FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump.

This triggers sell_token("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump", 1000).

Expected Output:

Sell successful for 1000 tokens of FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump
Transaction ID: <transaction-id>
Amount: <sol-amount>
Token Price (SOL): <price>

Get Token Price

Prompt:

What is the current price of the token with mint FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump?

This triggers get_token_price("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump").

Expected Output:

The current price of token FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump is <price> SOL.

Get Pool Data

Prompt:

Show me the pool data for the token with mint FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump.

This triggers get_pool_data("FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump").

Expected Output:

PumpPool Data for mint FC988ZAKRPc26wefDAxcYWB8kgbJTH4Tg3qDvf7xpump:
Pool Bump: <bump>
Index: <index>
Creator: <creator-pubkey>
Base Mint: <base-mint>
Quote Mint: <quote-mint>
LP Mint: <lp-mint>
Pool Base Token Account: <base-account>
Pool Quote Token Account: <quote-account>
LP Supply: <supply>

Environment Variables

The server uses the following environment variables, loaded from .env.private:

VariableDescriptionDefault Value
HTTPS_RPC_ENDPOINTSolana RPC endpoint URLhttps://api.mainnet-beta.solana.com
BUY_SLIPPAGESlippage tolerance for buy transactions0.3 (30%)
SELL_SLIPPAGESlippage tolerance for sell transactions0.1 (10%)
SWAP_PRIORITY_FEEPriority fee for transactions (in lamports)1500000
PRIVATE_KEYSolana private key for signing transactionsNone (required)

Ensure PRIVATE_KEY is set, as the server will raise an error if it's missing.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer

This software interacts with decentralized finance (DeFi) protocols and handles sensitive data like private keys. Use it at your own risk. Ensure your .env.private file is secure and never share your private key. The authors are not responsible for any financial losses or security issues arising from the use of this software.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Tavily Mcp
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
WindsurfThe new purpose-built IDE to harness magic
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.