Skip to main content
Glama
kukapay

bitcoin-utxo-mcp

get_utxo

Retrieve unspent transaction outputs (UTXOs) for a Bitcoin address, including details like TXID, value, confirmations, and total balance in BTC. Facilitates direct access to essential on-chain data for AI agents.

Instructions

Get UTXO for a Bitcoin address.

Args: address (str): Bitcoin address (base58 or bech32 format) Returns: A string containing: - Address - Number of UTXOs - Total value in BTC - List of UTXO details (txid, value, confirmations)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes

Implementation Reference

  • main.py:10-42 (handler)
    The handler function for the 'get_utxo' tool. It is decorated with @mcp.tool() for registration and implements the logic to fetch and format UTXO data for a given Bitcoin address using the blockchain.info API. The docstring provides the input/output schema.
    @mcp.tool() async def get_utxo(address: str) -> str: """Get UTXO for a Bitcoin address. Args: address (str): Bitcoin address (base58 or bech32 format) Returns: A string containing: - Address - Number of UTXOs - Total value in BTC - List of UTXO details (txid, value, confirmations) """ async with httpx.AsyncClient() as client: try: response = await client.get(f"https://blockchain.info/unspent?active={address}") response.raise_for_status() data = response.json() utxos = data.get("unspent_outputs", []) total_value = sum(u['value'] for u in utxos) / 1e8 utxo_details = "\n".join( f"- TXID: {u['tx_hash_big_endian']}, Value: {u['value'] / 1e8:.8f} BTC, Confirmations: {u['confirmations']}" for u in utxos ) return ( f"Address {address}:\n" f"{len(utxos)} UTXOs\n" f"Total Value: {total_value:.8f} BTC\n" f"UTXO Details:\n{utxo_details}" ) except Exception as e: return f"Error fetching UTXO: {str(e)}"

Other Tools

Related Tools

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/kukapay/bitcoin-utxo-mcp'

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