Purpose
bitcoin-utxo-mcp is a server based on MCP (Model Context Protocol), designed to track Bitcoin's unspent transaction outputs (UTXO) and block statistics, providing AI agents with direct access to key on-chain data. Through this server, AI clients can query UTXO details for a specific Bitcoin address, as well as transaction statistics for a specific block.
Main Capabilities
The server provides the following tools and prompts:
- get_utxo(address: str): Retrieves UTXO details for a specified Bitcoin address, including the number of UTXOs, the total value in BTC, and transaction details. For example:
- Address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa: 50 UTXOs, Total Value: 50.00000000 BTC, UTXO Details: ...
- get_block_stats(block_height: int): Retrieves transaction statistics for a specified Bitcoin block, including the block hash, number of transactions, total value, and block time. For example:
- Block Height: 0, Block Hash: 000000000019d668..., Transactions: 1, Total Value: 50.00000000 BTC, Block Time: 1231006505
- analyze_bitcoin_flow(): A reusable prompt template for an LLM to analyze Bitcoin fund flows, network health, and potential market impact based on UTXO and block data. For example, generating the prompt: "Analyze the provided Bitcoin UTXO and block data: What do the UTXO distributions indicate about funds flow? ..."
Usage
Environment Requirements
- Python: 3.10 or higher
- uv: a fast, modern Python package manager (installation instructions are in the official documentation)
Installation Steps
- Clone the repository:
git clone https://github.com/kukapay/bitcoin-utxo-mcp.git cd bitcoin-utxo-mcp - Install dependencies:
uv sync - Install to Claude Desktop:
Refer to the configuration file format:uv run mcp install main.py --name "Bitcoin UTXO"
Replace /path/to/bitcoin-utxo-mcp with the actual installation path.{ "mcpServers": { "Bitcoin UTXO": { "command": "uv", "args": [ "--directory", "/path/to/bitcoin-utxo-mcp", "run", "main.py" ] } } }
Example Interaction
In an MCP-compatible client (such as Claude Desktop), natural language prompts can be used, for example:
- "Show me the UTXO details for the Bitcoin genesis address." corresponds to the command get_utxo("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"), which outputs the address's UTXO count, total value, and transaction details.
- "What's the transaction data for the Bitcoin genesis block?" corresponds to the command get_block_stats(0), which outputs the genesis block's hash, transaction count, total value, and block time.
- "Analyze Bitcoin funds flow and network health." corresponds to the command analyze_bitcoin_flow(), which generates a prompt for LLM analysis; the LLM can provide insights on fund flows, network health, and market impact based on UTXO distribution and block statistics.
Applicable Scenarios
- AI agents need to query Bitcoin on-chain data in real time to assist decision-making.
- Researchers or developers analyze Bitcoin fund flows and network conditions through an MCP client.
- Combine with an LLM for on-chain data interpretation and market trend analysis.
Limitations
- Depends on external blockchain APIs (such as Blockchain.com) to obtain data; the examples mention responses based on hypothetical APIs.
- Requires Python 3.10+ and the uv package manager environment.
- The currently provided tools are limited to UTXO queries and block statistics, and do not involve other on-chain functions.
- The project uses the MIT license; see the LICENSE file for details.