Skip to main content
Glama
alexandresanlim

Mempool MCP Server

get-block-header

Retrieve the block header in hexadecimal format using the block hash. Integrates with the Mempool MCP Server for real-time Bitcoin blockchain data access.

Instructions

Returns the block header in hex

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesThe block hash to get header for

Implementation Reference

  • Registers the MCP tool 'get-block-header' with input schema validating block hash (64-char string), description, and handler that delegates to BlocksService.getBlockHeader, formatting the result as MCP text content.
    private registerGetBlockHeaderHandler(): void { this.server.tool( "get-block-header", "Returns the block header in hex", { hash: z.string().length(64).describe("The block hash to get header for"), }, async ({ hash }) => { const text = await this.blocksService.getBlockHeader({ hash }); return { content: [{ type: "text", text }] }; } ); }
  • Intermediate helper in BlocksService that fetches block header from request service and formats it with 'Block Header: ' prefix.
    async getBlockHeader({ hash }: { hash: string }): Promise<string> { const data = await this.requestService.getBlockHeader({ hash }); return `Block Header: ${data}`; }
  • Core handler logic in BlocksRequestService that executes the HTTP request to retrieve the block header hex via the API endpoint `block/${hash}/header`.
    async getBlockHeader({ hash }: { hash: string }): Promise<string | null> { return this.client.makeRequest<string>(`block/${hash}/header`); }

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