Skip to main content
Glama
noahgsolomon

Pump.fun MCP Server

by noahgsolomon

create-token

Generate a new token on the Pump.fun platform by specifying name, symbol, description, initial buy amount in SOL, and optional image URL. Ideal for deploying Solana-based assets efficiently.

Instructions

Create a new Pump.fun token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNameNoName of the account to use (will be created if it doesn't exist)default
descriptionYesToken description
imageUrlNoURL to token image (optional)
initialBuyAmountYesInitial buy amount in SOL
nameYesToken name
symbolYesToken symbol

Implementation Reference

  • Core handler function executing the token creation logic: balance check, mint generation, metadata setup, SDK call to createAndBuy, and result processing.
    export async function createToken(
      name: string,
      symbol: string,
      description: string,
      imageUrl: string | undefined,
      initialBuyAmount: number,
      accountName: string = "default"
    ) {
      try {
        const { sdk, connection } = initializeSDK();
        const keysFolder = path.resolve(rootDir, ".keys");
    
        const account = getOrCreateKeypair(keysFolder, accountName);
        const balance = await connection.getBalance(account.publicKey);
        const requiredBalance =
          initialBuyAmount * LAMPORTS_PER_SOL + 0.003 * LAMPORTS_PER_SOL;
    
        if (balance < requiredBalance) {
          return {
            success: false,
            error: `Insufficient SOL balance. Account ${account.publicKey.toString()} has ${
              balance / LAMPORTS_PER_SOL
            } SOL, but needs at least ${
              requiredBalance / LAMPORTS_PER_SOL
            } SOL. Please send SOL to this address and try again.`,
          };
        }
    
        const mint = Keypair.generate();
    
        let fileBlob: Blob | undefined;
        if (imageUrl) {
          const imageData = fs.readFileSync(imageUrl);
          fileBlob = new Blob([imageData], { type: "image/png" });
        }
    
        const tokenMetadata: any = {
          name,
          symbol,
          description,
          file: fileBlob,
        };
    
        const result = await sdk.createAndBuy(
          account,
          mint,
          tokenMetadata,
          BigInt(initialBuyAmount * LAMPORTS_PER_SOL),
          DEFAULT_SLIPPAGE_BASIS_POINTS,
          DEFAULT_PRIORITY_FEES
        );
    
        if (!result.success) {
          return {
            success: false,
            error: result.error || "Unknown error",
          };
        }
    
        fs.writeFileSync(
          path.join(keysFolder, `mint-${mint.publicKey.toString()}.json`),
          safeStringify(Array.from(mint.secretKey))
        );
    
        const tokenBalance = await getSPLBalance(
          connection,
          mint.publicKey,
          account.publicKey
        );
    
        return {
          success: true,
          tokenAddress: mint.publicKey.toString(),
          tokenName: name,
          tokenSymbol: symbol,
          tokenBalance,
          signature: result.signature,
          pumpfunUrl: `https://pump.fun/${mint.publicKey.toString()}`,
        };
      } catch (error: any) {
        console.error("Error creating token:", error);
        return { success: false, error: error?.message || "Unknown error" };
      }
    }
  • Zod input schema defining parameters for the create-token tool: name, symbol, description, optional imageUrl, initialBuyAmount, and accountName.
    {
      name: z.string().describe("Token name"),
      symbol: z.string().describe("Token symbol"),
      description: z.string().describe("Token description"),
      imageUrl: z.string().optional().describe("URL to token image (optional)"),
      initialBuyAmount: z
        .number()
        .min(0.0001)
        .describe("Initial buy amount in SOL"),
      accountName: z
        .string()
        .default("default")
        .describe(
          "Name of the account to use (will be created if it doesn't exist)"
        ),
    },
  • src/index.ts:98-150 (registration)
    MCP server.tool registration for 'create-token', including description, input schema, and thin wrapper handler that invokes the core createToken function and formats response.
    server.tool(
      "create-token",
      "Create a new Pump.fun token",
      {
        name: z.string().describe("Token name"),
        symbol: z.string().describe("Token symbol"),
        description: z.string().describe("Token description"),
        imageUrl: z.string().optional().describe("URL to token image (optional)"),
        initialBuyAmount: z
          .number()
          .min(0.0001)
          .describe("Initial buy amount in SOL"),
        accountName: z
          .string()
          .default("default")
          .describe(
            "Name of the account to use (will be created if it doesn't exist)"
          ),
      },
      async ({
        name,
        symbol,
        description,
        imageUrl,
        initialBuyAmount,
        accountName,
      }) => {
        try {
          const result = await createToken(
            name,
            symbol,
            description,
            imageUrl,
            initialBuyAmount,
            accountName
          );
    
          const formattedResult = formatCreateTokenResult(result);
    
          return createMcpResponse(formattedResult);
        } catch (error: any) {
          console.error("Error creating token:", error);
          return {
            content: [
              {
                type: "text",
                text: `Error creating token: ${error?.message || "Unknown error"}`,
              },
            ],
          };
        }
      }
    );
  • Helper function to format the createToken result into a human-readable multi-line string for display in MCP response.
    export function formatCreateTokenResult(
      result: ReturnType<typeof createToken> extends Promise<infer T> ? T : never
    ) {
      if (!result.success) {
        return `Error creating token: ${result.error}`;
      }
    
      return [
        `Successfully created token!`,
        `Token Address: ${result.tokenAddress}`,
        `Token Name: ${result.tokenName}`,
        `Token Symbol: ${result.tokenSymbol}`,
        `Your Balance: ${result.tokenBalance}`,
        `Transaction Signature: ${result.signature}`,
        `Pump.fun URL: ${result.pumpfunUrl}`,
      ].join("\n");
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. 'Create' implies a write operation, but it doesn't disclose critical traits like authentication requirements, cost implications (SOL usage), whether the token becomes immediately tradable, or potential rate limits. The description fails to compensate for the lack of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with comprehensive schema documentation and gets straight to the point with zero wasted content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a token creation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after creation (e.g., token address returned, initialization state), doesn't mention SOL cost implications from 'initialBuyAmount', and provides no context about the creation process. The schema covers parameters well, but behavioral and outcome aspects are missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing good documentation for all parameters. The description adds no parameter-specific information beyond what's in the schema. This meets the baseline of 3 since the schema adequately covers parameter meanings, but the description doesn't enhance understanding of how parameters interact or their business significance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new Pump.fun token'), making the purpose immediately understandable. It distinguishes from siblings like 'buy-token' or 'sell-token' by focusing on creation rather than trading operations. However, it doesn't specify what 'create' entails in this context (e.g., minting, deployment).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an account), differentiate from similar tools like 'get-token-info', or indicate when creation is appropriate versus buying existing tokens. The agent must infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/noahgsolomon/pumpfun-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server