Skip to main content
Glama
alexandresanlim

Mempool MCP Server

get-mempool-txids

Retrieve transaction IDs from the Bitcoin mempool to monitor pending transactions and analyze network activity in real-time.

Instructions

Returns mempool txids

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the 'get-mempool-txids' MCP tool, which invokes MempoolService.getMempoolTxids() and returns the result as text content.
    private registerGetMempoolTxidsHandler(): void {
      this.server.tool(
        "get-mempool-txids",
        "Returns mempool txids",
        async () => {
          const text = await this.mempoolService.getMempoolTxids();
          return { content: [{ type: "text", text }] };
        }
      );
    }
  • Executes the core tool logic by making an API request to the '/mempool/txids' endpoint via IApiClient.
    async getMempoolTxids(): Promise<IMempoolTxidResponse[] | null> {
      return this.client.makeRequest<IMempoolTxidResponse[]>(`mempool/txids`);
    }
  • Wrapper that fetches mempool txids from the request service and formats them into a string response using formatResponse.
    async getMempoolTxids(): Promise<string> {
      const data = await this.requestService.getMempoolTxids();
      return formatResponse<IMempoolTxidResponse[]>("Mempool Txids", data);
    }
  • Defines TypeScript interfaces and types for mempool API responses, including IMempoolTxidResponse as string for txids.
    export interface IMempoolInfoResponse {
      count: number;
      vsize: number;
      total_fee: number;
    }
    
    export type IMempoolTxidResponse = string;
    
    export interface IMempoolRecentResponse {
      txid: string;
      fee: number;
      vsize: number;
      value: number;
      time: number;
    } 

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/alexandresanlim/mempool-mcp-server'

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