Pump SDK MCP Server

平台与服务

by nirholas

基于 Pump SDK 的 MCP server,支持 Solana 代币 launchpad、bonding curves、vanity addresses 与密钥管理

什么是 Pump SDK MCP Server

基于 Pump SDK 的 MCP server,支持 Solana 代币 launchpad、bonding curves、vanity addresses 与密钥管理

README

<p align="center"> <h1 align="center">Pump SDK</h1> <p align="center"> TypeScript SDK for the Pump protocol on Solana — token creation, bonding curves, AMM pools, fee sharing, and volume rewards. </p> </p> <p align="center"> <a href="https://www.npmjs.com/package/@nirholas/pump-sdk"><img src="https://img.shields.io/npm/v/@nirholas/pump-sdk.svg?style=flat-square&color=blue" alt="npm version" /></a> <a href="https://github.com/nirholas/pump-fun-sdk/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@nirholas/pump-sdk.svg?style=flat-square" alt="license" /></a> <a href="https://www.npmjs.com/package/@nirholas/pump-sdk"><img src="https://img.shields.io/npm/dm/@nirholas/pump-sdk.svg?style=flat-square" alt="downloads" /></a> <img src="https://img.shields.io/badge/TypeScript-5.0+-blue?style=flat-square&logo=typescript" alt="TypeScript" /> <img src="https://img.shields.io/badge/Solana-1.98+-purple?style=flat-square&logo=solana" alt="Solana" /> </p>

What is Pump SDK?

Pump SDK is the community TypeScript SDK for the Pump.fun protocol on Solana. It provides offline-first instruction builders for every on-chain operation — token creation, bonding curve trading, AMM pool management, tiered fee configuration, creator fee sharing, volume-based token incentives, and social referral fees.

The SDK never sends transactions itself. It returns TransactionInstruction[] that you compose into transactions with your preferred signing and sending strategy.


📋 Table of Contents


🚀 Quick Start

Installation

bash
# npm
npm install @nirholas/pump-sdk

# yarn
yarn add @nirholas/pump-sdk

# pnpm
pnpm add @nirholas/pump-sdk

Peer Dependencies

The SDK requires these Solana packages (install them if not already present):

bash
npm install @solana/web3.js @solana/spl-token @coral-xyz/anchor bn.js

Minimal Example

typescript
import { Connection, PublicKey } from "@solana/web3.js";
import { OnlinePumpSdk } from "@nirholas/pump-sdk";

// 1. Create an online SDK instance
const connection = new Connection("https://api.mainnet-beta.solana.com");
const sdk = new OnlinePumpSdk(connection);

// 2. Fetch current token state
const mint = new PublicKey("YourTokenMintAddress...");
const summary = await sdk.fetchBondingCurveSummary(mint);

console.log("Market Cap:", summary.marketCap.toString(), "lamports");
console.log("Graduated:", summary.isGraduated);
console.log("Progress:", summary.progressBps / 100, "%");

📖 Usage Examples

Create a Token

typescript
import { Keypair } from "@solana/web3.js";
import { PUMP_SDK } from "@nirholas/pump-sdk";

const mintKeypair = Keypair.generate();
const creator = wallet.publicKey;

const createIx = await PUMP_SDK.createV2Instruction({
  mint: mintKeypair.publicKey,
  name: "My Token",
  symbol: "MYTKN",
  uri: "https://arweave.net/metadata.json",
  creator,
  user: creator,
  mayhemMode: false,
});

// createIx is a TransactionInstruction — add to a Transaction and send

Warning: Do NOT use createInstruction — it is deprecated (v1). Always use createV2Instruction.

Buy Tokens on the Bonding Curve

typescript
import { Connection, PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import { getBuyTokenAmountFromSolAmount, OnlinePumpSdk } from "@nirholas/pump-sdk";

const connection = new Connection("https://api.mainnet-beta.solana.com");
const sdk = new OnlinePumpSdk(connection);

const mint = new PublicKey("TokenMintAddress...");
const user = wallet.publicKey;

// Fetch all required state in parallel — buyState includes tokenProgram (auto-detected)
const [buyState, global, feeConfig] = await Promise.all([
  sdk.fetchBuyState(mint, user),
  sdk.fetchGlobal(),
  sdk.fetchFeeConfig(),
]);

assert(!buyState.bondingCurve.complete, "Token has already graduated to AMM");

// Calculate expected tokens for 0.1 SOL
const solAmount = new BN(100_000_000); // 0.1 SOL in lamports
const expectedTokens = getBuyTokenAmountFromSolAmount({
  global,
  feeConfig,
  mintSupply: buyState.bondingCurve.tokenTotalSupply,
  bondingCurve: buyState.bondingCurve,
  amount: solAmount,
});

// buyState spreads: bondingCurveAccountInfo, bondingCurve, associatedUserAccountInfo, tokenProgram
const buyIxs = await sdk.buyInstructions({
  ...buyState,
  mint,
  user,
  amount: expectedTokens,
  solAmount,
  slippage: 0.05,         // 5% slippage tolerance
});
// buyIxs is TransactionInstruction[] — compose into a VersionedTransaction and send

Note: fetchBuyState auto-detects whether the token uses SPL Token or Token-2022 and returns tokenProgram accordingly. Always spread ...buyState into buyInstructions to ensure the correct program is used.

Sell Tokens

typescript
import BN from "bn.js";
import { getSellSolAmountFromTokenAmount, OnlinePumpSdk } from "@nirholas/pump-sdk";

const sdk = new OnlinePumpSdk(connection);

// Fetch required state in parallel
// Pass buyState.tokenProgram if you have it to avoid a second mint account fetch
const [sellState, global, feeConfig] = await Promise.all([
  sdk.fetchSellState(mint, user),
  sdk.fetchGlobal(),
  sdk.fetchFeeConfig(),
]);

const tokenAmount = new BN(1_000_000_000); // amount in raw units (6 decimals)
const expectedSol = getSellSolAmountFromTokenAmount({
  global,
  feeConfig,
  mintSupply: sellState.bondingCurve.tokenTotalSupply,
  bondingCurve: sellState.bondingCurve,
  amount: tokenAmount,
});

// sellState spreads: bondingCurveAccountInfo, bondingCurve, tokenProgram
const sellIxs = await sdk.sellInstructions({
  ...sellState,
  mint,
  user,
  amount: tokenAmount,
  solAmount: expectedSol,
  slippage: 0.05,
});

Note: fetchSellState returns tokenProgram (auto-detected from the mint). Always spread ...sellState into sellInstructions.

Check Graduation Progress

typescript
import { OnlinePumpSdk } from "@nirholas/pump-sdk";

const sdk = new OnlinePumpSdk(connection);
const progress = await sdk.fetchGraduationProgress(mint);

console.log(`Progress: ${progress.progressBps / 100}%`);
console.log(`Graduated: ${progress.isGraduated}`);
console.log(`Tokens remaining: ${progress.tokensRemaining.toString()}`);
console.log(`SOL accumulated: ${progress.solAccumulated.toString()}`);

Set Up Fee Sharing

typescript
import { PublicKey } from "@solana/web3.js";
import { PUMP_SDK } from "@nirholas/pump-sdk";

// Create a fee sharing config (creator only, before or after graduation)
const createConfigIx = await PUMP_SDK.createFeeSharingConfig({
  creator: wallet.publicKey,
  mint: tokenMint,
  pool: null,  // null for pre-graduation tokens
});

// Update shareholders (must total exactly 10,000 BPS = 100%)
const updateIx = await PUMP_SDK.updateFeeShares({
  authority: wallet.publicKey,
  mint: tokenMint,
  currentShareholders: [wallet.publicKey],
  newShareholders: [
    { address: wallet.publicKey, shareBps: 7000 },         // 70%
    { address: new PublicKey("Partner..."), shareBps: 3000 }, // 30%
  ],
});

Warning: Shares must total exactly 10,000 BPS. The SDK throws InvalidShareTotalError otherwise. Maximum 10 shareholders.


📚 API Reference

See docs/api-reference.md for the complete API documentation with full TypeScript signatures, parameters, and examples.

Core Classes

ClassDescription
PumpSdkOffline instruction builder — no RPC connection required
OnlinePumpSdkExtends PumpSdk with RPC fetchers for account state
PUMP_SDKPre-instantiated singleton of PumpSdk

Bonding Curve Functions

FunctionReturnsDescription
getBuyTokenAmountFromSolAmount(...)BNTokens received for a given SOL amount
getBuySolAmountFromTokenAmount(...)BNSOL cost for a given token amount
getSellSolAmountFromTokenAmount(...)BNSOL received for selling tokens
bondingCurveMarketCap(...)BNCurrent market cap in lamports
newBondingCurve(global)BondingCurveFresh bonding curve from global config

Analytics Functions

FunctionReturnsDescription
calculateBuyPriceImpact(...)PriceImpactResultPrice impact for a buy trade
calculateSellPriceImpact(...)PriceImpactResultPrice impact for a sell trade
getGraduationProgress(...)GraduationProgressBonding curve completion percentage
getTokenPrice(...)TokenPriceInfoCurrent buy/sell price per token
getBondingCurveSummary(...)BondingCurveSummaryComplete bonding curve overview

Fee Functions

FunctionReturnsDescription
getFee(...)BNFee amount for a trade
computeFeesBps(...)CalculatedFeesBpsCurrent fee basis points (protocol + creator)
calculateFeeTier(...)FeesFee tier for a given market cap

Token Incentive Functions

FunctionReturnsDescription
totalUnclaimedTokens(...)BNUnclaimed $PUMP reward tokens
currentDayTokens(...)BNTokens earned today

🔗 On-Chain Programs

ProgramIDPurpose
Pump6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6PBonding curve creation, buying, selling, migration
PumpAMMpAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEAGraduated AMM pools — trading, liquidity, fees
PumpFeespfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZFee sharing config and social fee PDAs

🔧 Configuration

Constructor

The SDK has no required environment variables. You configure it via the constructor:

ParameterTypeRequiredDescription
connectionConnectionOnly for OnlinePumpSdkSolana RPC connection

Key Constants

ConstantValueDescription
PUMP_PROGRAM_ID6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6PMain Pump program
PUMP_AMM_PROGRAM_IDpAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEAAMM program
PUMP_FEE_PROGRAM_IDpfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZFee program
PUMP_TOKEN_MINTpumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn$PUMP token mint
MAX_SHAREHOLDERS10Maximum shareholders in fee sharing
ONE_BILLION_SUPPLY10000000000000001B tokens with 6 decimals
BONDING_CURVE_NEW_SIZE151Bonding curve account size in bytes

⚠️ Error Handling

The SDK defines typed errors for fee sharing validation:

ErrorCauseFix
NoShareholdersErrorEmpty shareholders arrayProvide at least 1 shareholder
TooManyShareholdersErrorMore than 10 shareholdersReduce to ≤ 10 shareholders
ZeroShareErrorA shareholder has 0 or negative BPSSet all shares to positive values
InvalidShareTotalErrorShares don't sum to 10,000 BPSEnsure shares total exactly 10,000
DuplicateShareholderErrorSame address appears twiceRemove duplicate addresses
ShareCalculationOverflowErrorBPS sum exceeds safe integer rangeCheck share values
PoolRequiredForGraduatedErrorpool is null for a graduated coinPass the pool address from fetchPool()

Common Pitfalls

Warning: Never use JavaScript number for token or lamport amounts. Always use BN from bn.js. JavaScript numbers lose precision above 2^53.

Warning: Check bondingCurve.complete before trading. If true, the token has graduated to AMM — use ammBuyInstruction/ammSellInstruction instead.

Warning: createInstruction is deprecated. Use createV2Instruction for all new token creation.


❓ FAQ

Q: Do I need an RPC connection to use the SDK? No. PumpSdk (and the PUMP_SDK singleton) builds instructions offline. Only use OnlinePumpSdk when you need to fetch on-chain state.

Q: How do I know if a token has graduated to AMM? Check bondingCurve.complete === true or use sdk.isGraduated(mint). Graduated tokens trade on PumpAMM, not the bonding curve.

Q: What is slippage in buy/sell instructions? A decimal fraction (e.g., 0.05 = 5%). The SDK adjusts maxSolCost (buy) or minSolOutput (sell) to protect against price movement.

Q: Why do amounts use BN instead of number? Solana token amounts (lamports, token units) regularly exceed JavaScript's safe integer limit (2^53). BN provides arbitrary-precision arithmetic.

Q: What's the difference between Pump and PumpAMM programs? Pump handles the bonding curve phase (creation → graduation). PumpAMM handles post-graduation trading with constant-product AMM pools.

Q: How does fee sharing work? Token creators can split their creator fees among up to 10 shareholders. Each shareholder gets a share in basis points (1/10,000). The total must equal exactly 10,000 BPS (100%).

Q: What is Mayhem Mode? A special token creation mode with randomized bonding curve parameters. Tokens created with mayhemMode: true have unpredictable pricing dynamics.

Q: Can I use the SDK in the browser? Yes. The SDK has no Node.js-specific dependencies. The ESM build works in modern browsers with a bundler.


🏗️ Architecture

See docs/architecture.md for detailed system design, data flow diagrams, and module explanations.


🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Development setup
  • Branch naming and commit conventions
  • Testing requirements
  • PR process

📄 License

MIT © nirholas


🙏 Acknowledgments

常见问题

Pump SDK MCP Server 是什么?

基于 Pump SDK 的 MCP server,支持 Solana 代币 launchpad、bonding curves、vanity addresses 与密钥管理

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描111.1k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描111.1k

MCP服务构建器

by alirezarezvani

Universal
热门

从 OpenAPI 一键生成 Python/TypeScript MCP server 脚手架,并校验 tool schema、命名规范与版本兼容性,适合把现有 REST API 快速发布成可生产演进的 MCP 服务。

帮你快速搭建 MCP 服务与后端 API,脚手架完善、扩展顺手,尤其适合想高效验证服务能力的开发者。

平台与服务
未扫描9.6k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
83.0k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.3k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
34.8k

评论