bitcoin-mcp

bitcoin-mcp

5

bitcoin-mcp is an implementation of a Model Context Protocol (MCP) server that provides read access to Bitcoin blockchain data without wallet functionality. It interfaces with Bitcoin Core and is designed for use by MCP clients like Claude Desktop.

bitcoin-mcp

bitcoin-mcp extends AI utilities with accurate Bitcoin blockchain data based on MCP. bitcoin-mcp is a streamlined Model Context Protocol (MCP) server implementation that interfaces with Bitcoin Core (full-node) through bitcoin-cli. This bitcoin-mcp server provides Claude Desktop (or other mcp clients) with READ access to Bitcoin blockchain data WITHOUT wallet functionality.

screenshot-btc-mcp0

Features

AI agent meets the most secure data ledger - Bitcoin.

  • Query real-time Bitcoin blockchain information (via bitcoin-cli, but WITHOUT any wallet calls)

  • Access mempool, blocks, and transaction data

  • Generate custom 3D visualization of BTC blocks based on TX output values and BitFeed representation (i.e., those beautiful rectangles on mempool.space)

    image

Prerequisites

  • Claude Desktop (or other mcp clients)
  • Python 3.10+
  • Bitcoin full-node (w. bitcoin-cli)
  • (Windows)

Installation

  1. Clone the repo to your up-to-date btc full node machine (required for bitcoin-mcp to work)

  2. Install dependencies:

pip install -r requirements.txt
  1. Make sure Bitcoin Core is up-to-date and running. Configure .env and add BITCOIN_CLI_PATH so that MCP server can find bitcoin-cli
  • Have this line BITCOIN_CLI_PATH=C:\\Program Files\\Bitcoin\\daemon\\bitcoin-cli in .env
  1. Claude Desktop Configuration (standard setup for any mcp servers)
  • update path\\to\\ to your local bitcoin-mcp folder
{
  "mcpServers": {
    "bitcoin-mcp": {
      "command": "python",
      "args": ["path\\to\\bitcoin-mcp\\bitcoin_mcp_server.py"],
      "env": {}
    }
  }
}

Test the server:

You can test the python server to see if it loads your btc full node.

python bitcoin_mcp_server.py

Available Tools

Mainly for mcp clients like Claude Desktop to utilize Bitcoin blockchain info, so NO WALLET FUNCTIONS ARE INCLUDED.

Blockchain Information

ToolDescription
get_blockchain_infoGet current blockchain state
get_block_hashGet block hash for a specific height
get_blockGet block data by hash
get_block_statsGet block statistics
get_chain_tipsGet information about chain tips
get_chain_tx_statsGet chain transaction statistics
get_difficultyGet current difficulty
get_network_infoGet network information
get_blockchain_statusGet comprehensive blockchain status
get_detailed_block_infoGet detailed block information
search_blocksSearch for blocks meeting criteria
get_bitfeed_3d_representationGet 3D representation of a BTC block based on TX data

Transaction Information

ToolDescription
get_mempool_infoGet mempool information
get_tx_outGet UTXO information
get_tx_out_set_infoGet UTXO set statistics
get_raw_transactionGet raw transaction data
decode_raw_transactionDecode raw transaction
estimate_smart_feeEstimate transaction fee
analyze_transactionAnalyze transaction details

Analytics

ToolDescription
get_difficulty_historyGet difficulty adjustment history
get_fee_historyGet transaction fee history
get_hashrate_estimateEstimate network hashrate
get_block_time_distributionAnalyze block time distribution
analyze_blockchainComprehensive blockchain analysis

Configuration

ToolDescription
configure_bitcoin_cliConfigure bitcoin-cli settings
get_config_infoGet current server configuration
update_server_configUpdate server configuration

Code Structure

  • bitcoin_mcp_server.py: Main server entry point
  • bitcoin_connection.py: Bitcoin Core connection utilities
  • bitcoin_config.py: Configuration management
  • bitcoin_transactions.py: Transaction analysis utilities
  • bitcoin_utils.py: Blockchain utilities
  • bitcoin_analytics.py: Advanced blockchain analytics
  • bitfeed.py: 3D representations of BTC blocks

Security Notes

  • This mcp server does not include wallet functionality in Bitcoin Core (u can add those urself)
  • By default, the server only binds to localhost (127.0.0.1)
  • Enables read-only access to blockchain data

Example Usage

Get current blockchain information:

Tell me about the current state of the Bitcoin blockchain

Analyze a specific block:

Show me detailed information about block 800000

Get transaction fee history:

What have transaction fees been like over the past 24 hours?

Estimate hashrate:

What is the current estimated hashrate of the Bitcoin network?

Generate 3D representation (note that context length may not fit all TXs, try blocks where TX number < 20 ):

Build a react threejs viewer for btc block 111111

License

MIT License