UNPKG

@sanlim/mempool-mcp-server

Version:

A sample of MCP implementation using DDD structure with some APIs call.

36 lines (35 loc) 1.32 kB
import { formatResponse } from "../helpers/format.js"; export class BlocksService { requestService; constructor(requestService) { this.requestService = requestService; } async getBlocks() { const data = await this.requestService.getBlocks(); return formatResponse("Blocks", data); } async getBlockTxids({ hash }) { const data = await this.requestService.getBlockTxids({ hash }); return formatResponse("Block Txids", data); } async getBlockTxs({ hash }) { const data = await this.requestService.getBlockTxs({ hash }); return formatResponse("Block Txs", data); } async getBlockStatus({ hash }) { const data = await this.requestService.getBlockStatus({ hash }); return formatResponse("Block Status", data); } async getBlockRaw({ hash }) { const data = await this.requestService.getBlockRaw({ hash }); return `Block Raw Hex: ${data}`; } async getBlockTxidByIndex({ hash, index, }) { const data = await this.requestService.getBlockTxidByIndex({ hash, index }); return `Block Txid By Index: ${data}`; } async getBlockHeader({ hash }) { const data = await this.requestService.getBlockHeader({ hash }); return `Block Header: ${data}`; } }