Skip to main content
Glama
noahgsolomon

Pump.fun MCP Server

by noahgsolomon

get-token-info

Retrieve detailed information about a Pump.fun token by entering its mint address using the tool on the Pump.fun MCP Server. Simplify token data access for Solana-based assets.

Instructions

Get information about a Pump.fun token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenAddressYesThe token's mint address

Implementation Reference

  • Core handler function that initializes SDK, fetches bonding curve account for the token, computes supply, and returns token info.
    export async function getTokenInfo(tokenAddress: string) {
      const { sdk } = initializeSDK();
      console.log("SDK initialized");
    
      const mintPublicKey = new PublicKey(tokenAddress);
      console.log("Getting bonding curve account...");
      const bondingCurveAccount = await sdk.getBondingCurveAccount(mintPublicKey);
    
      if (!bondingCurveAccount) {
        console.log(`No token found with address ${tokenAddress}`);
        return null;
      }
    
      const tokenTotalSupply = (bondingCurveAccount as any).tokenTotalSupply;
      const formattedSupply = tokenTotalSupply
        ? Number(tokenTotalSupply) / Math.pow(10, DEFAULT_DECIMALS)
        : "Unknown";
    
      return {
        tokenAddress,
        bondingCurveAccount,
        formattedSupply,
        pumpfunUrl: `https://pump.fun/${tokenAddress}`,
      };
    }
  • src/index.ts:56-96 (registration)
    Registers the 'get-token-info' tool with MCP server, defines input schema, and provides wrapper handler that calls core getTokenInfo function.
    server.tool(
      "get-token-info",
      "Get information about a Pump.fun token",
      {
        tokenAddress: z.string().describe("The token's mint address"),
      },
      async ({ tokenAddress }, extra) => {
        try {
          console.error(`Checking token info for: ${tokenAddress}`);
    
          const tokenInfo = await getTokenInfo(tokenAddress);
    
          if (!tokenInfo) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `No token found with address ${tokenAddress}`,
                },
              ],
            };
          }
    
          const formattedInfo = formatTokenInfo(tokenInfo);
    
          return createMcpResponse(formattedInfo);
        } catch (error: any) {
          console.error("Error getting token info:", error);
          return {
            content: [
              {
                type: "text" as const,
                text: `Error getting token info: ${
                  error?.message || "Unknown error"
                }`,
              },
            ],
          };
        }
      }
    );
  • Zod input schema for the tool requiring 'tokenAddress' as a string.
      tokenAddress: z.string().describe("The token's mint address"),
    },
  • Helper function to initialize PumpFunSDK and Solana connection using environment RPC URL.
    export function initializeSDK() {
      const rpcUrl = process.env.HELIUS_RPC_URL;
      if (!rpcUrl) {
        throw new Error("HELIUS_RPC_URL environment variable is not set");
      }
    
      const connection = new Connection(rpcUrl);
      const provider = new AnchorProvider(
        connection,
        {
          publicKey: new PublicKey("11111111111111111111111111111111"),
          signTransaction: async () => {
            throw new Error("Not implemented");
          },
          signAllTransactions: async () => {
            throw new Error("Not implemented");
          },
        },
        { commitment: "confirmed" }
      );
    
      return {
        sdk: new PumpFunSDK(provider),
        connection,
      };
    }
  • Helper to format token info into a readable string.
    export function formatTokenInfo(
      tokenInfo: ReturnType<typeof getTokenInfo> extends Promise<infer T>
        ? NonNullable<T>
        : never
    ) {
      return [
        `Token: ${tokenInfo.tokenAddress}`,
        `Supply: ${tokenInfo.formattedSupply}`,
        `Pump.fun URL: ${tokenInfo.pumpfunUrl}`,
      ].join("\n");
    }
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