Skip to main content
Glama
alexandresanlim

Mempool MCP Server

get-stats-info

Retrieve real-time Bitcoin blockchain and mempool statistics to analyze network activity and performance using a tool designed for AI clients on the Mempool MCP Server.

Instructions

Returns stats info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the 'get-stats-info' tool with the MCP server, including an inline async handler that fetches and returns formatted stats info.
    private registerGetStatsHandler(): void { this.server.tool( "get-stats-info", "Returns stats info", async () => { const text = await this.statsService.getStatsInfo(); return { content: [{ type: "text", text }] }; } ); }
  • TypeScript interface defining the structure of the stats response data used by the tool implementation.
    export interface IStatsResponse { average_fee: number; average_tx_size: number; block_count: number; mempool_size: number; mempool_txs: number; total_fees: number; total_output: number; total_size: number; total_weight: number; }
  • Executes the API request to retrieve raw stats data from the `/stats` endpoint.
    async getStatsInfo(): Promise<IStatsResponse | null> { return this.client.makeRequest<IStatsResponse>(`stats`); }
  • Orchestrates fetching raw stats and formatting them into a string for the tool response.
    async getStatsInfo(): Promise<string> { const data = await this.requestService.getStatsInfo(); return formatResponse<IStatsResponse>("Stats Info", data); }
  • Utility function that formats the stats object into a human-readable string used in the tool output.
    export const formatResponse = <T extends object>( title: string, data: T | null ): string => { if (!data) { return `Failed to retrieve ${title.toLowerCase()} data.`; } let msg = `${title}:\n`; for (const [key, value] of Object.entries(data)) { msg += `${key}: ${value ?? "N/A"}\n`; } return msg.trim(); };

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