btc_lookup
Look up Bitcoin addresses to retrieve transaction history and balance information for blockchain analysis and security research.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Bitcoin address to lookup |
Implementation Reference
- src/tools/crypto.ts:12-33 (handler)The lookupBtc method in CryptoApiClient performs the actual blockchain lookup using the blockchain.info API.
async lookupBtc(address: string): Promise<any> { try { const response = await fetch(`https://blockchain.info/rawaddr/${address}`); if (!response.ok) throw new Error("BTC Address not found or API error"); const data = await response.json() as any; return { address: data.address, totalReceived: data.total_received / 100000000, totalSent: data.total_sent / 100000000, finalBalance: data.final_balance / 100000000, nTx: data.n_tx, recentTransactions: data.txs?.slice(0, 5).map((tx: any) => ({ hash: tx.hash, time: new Date(tx.time * 1000).toISOString(), result: tx.result / 100000000 })) }; } catch (error) { throw new McpError(ErrorCode.InternalError, `BTC Lookup error: ${(error as Error).message}`); } } - src/index.ts:562-570 (registration)The btc_lookup tool is registered on the MCP server in src/index.ts.
server.tool( "btc_lookup", { address: z.string().describe("Bitcoin address to lookup") }, async ({ address }) => { const result = await cryptoClient.lookupBtc(address); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }