MCP Bitcoin CLI
Enables interaction with Bitcoin's OP_RETURN functionality to store documents, create cryptographic timestamps, deploy and manage BRC-20 tokens, and build custom protocols on the Bitcoin blockchain through Bitcoin Core.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Bitcoin CLI create a timestamp for my contract document on testnet"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
What is this?
An MCP (Model Context Protocol) server that enables Claude to interact with Bitcoin's OP_RETURN functionality. Store documents, create timestamps, deploy tokens, and build custom protocols—all through natural language.
Works with Claude Desktop, Cursor, and any MCP-compatible client.
Supports Bitcoin Core v30+ with up to ~100KB OP_RETURN data.
Related MCP server: MCP Crypto Wallet EVM
Quick Start
# Install from source
git clone https://github.com/EricGrill/mcp-bitcoin-cli.git
cd mcp-bitcoin-cli
pip install -e .
# Run the server
mcp-bitcoin-cliAdd to your Claude Desktop config and start working with Bitcoin:
"Create a timestamp for this document on Bitcoin testnet"
Why Use This?
Feature | Description |
Document Storage | Embed documents up to 100KB directly on-chain |
Timestamping | Create immutable SHA-256/SHA3 hash commitments |
BRC-20 Tokens | Deploy, mint, and transfer tokens using the BRC-20 standard |
Custom Protocols | Build your own OP_RETURN protocols with the BTCD envelope format |
Offline-Capable | Encode/decode data without a running Bitcoin node |
Safety First | Testnet default, dry-run mode, fee warnings |
Available Tools
Low-Level Primitives
Offline-capable tools for data encoding and transaction building.
Tool | Description |
| Encode arbitrary data into OP_RETURN script format |
| Parse and extract data from OP_RETURN scripts |
| Construct transactions with OP_RETURN outputs |
| Parse BTCD envelope structure from raw bytes |
Bitcoin Core Interface
Tools for interacting with a running Bitcoin node.
Tool | Description |
| Check connection status and network info |
| List available UTXOs for funding transactions |
| Send signed transactions (dry-run by default) |
| Fetch and decode transaction details |
| Scan blocks for OP_RETURN transactions |
Token Operations (BRC-20)
Create and manage tokens using the BRC-20 standard.
Tool | Description |
| Deploy a new BRC-20 token |
| Mint tokens from an existing deployment |
| Create a transfer inscription |
Document Storage
Store and retrieve documents on the blockchain.
Tool | Description |
| Prepare documents for on-chain storage |
| Parse and extract documents from transactions |
Timestamping & Attestation
Create cryptographic proofs of existence.
Tool | Description |
| Create SHA-256/SHA3 hash commitments |
| Verify data against on-chain timestamps |
Data Envelope Format
All data uses the BTCD envelope format for discoverability and proper parsing:
┌─────────────────────────────────────────────────────────┐
│ OP_RETURN Envelope (variable size, up to ~100KB) │
├──────────┬──────────┬──────────┬────────────────────────┤
│ Magic │ Version │ Type │ Payload │
│ (4 bytes)│ (1 byte) │ (1 byte) │ (variable) │
├──────────┼──────────┼──────────┼────────────────────────┤
│ "BTCD" │ 0x01 │ See below│ Type-specific data │
└──────────┴──────────┴──────────┴────────────────────────┘Type | Hex | Description |
RAW |
| Raw bytes, no structure |
TEXT |
| UTF-8 text |
JSON |
| JSON document |
HASH |
| Hash commitment (timestamp) |
TOKEN |
| Token operation (BRC-20) |
FILE |
| File with content-type |
CUSTOM |
| User-defined protocols |
Configuration
Claude Desktop Setup
Add to your Claude Desktop config:
Platform | Config Path |
macOS |
|
Windows |
|
Linux |
|
{
"mcpServers": {
"bitcoin": {
"command": "mcp-bitcoin-cli",
"env": {
"BITCOIN_NETWORK": "testnet",
"BITCOIN_CLI_PATH": "/usr/local/bin/bitcoin-cli"
}
}
}
}Configuration File
Create ~/.mcp-bitcoin-cli/config.toml:
[connection]
method = "cli" # "cli" or "rpc"
network = "testnet" # "mainnet", "testnet", "signet", "regtest"
[cli]
path = "bitcoin-cli" # Path to bitcoin-cli binary
datadir = "" # Optional: custom datadir
[rpc]
host = "127.0.0.1"
port = 18332 # Testnet default
user = ""
password = ""
[safety]
require_confirmation = true # Prompt before broadcast
dry_run_default = true # Always dry-run first
max_data_size = 102400 # 100KB limitNetwork Ports
Network | Default RPC Port |
Mainnet | 8332 |
Testnet | 18332 |
Signet | 38332 |
Regtest | 18443 |
Examples
"Create a SHA-256 timestamp for this contract"
"Verify this document against timestamp in transaction abc123..."
"Create a SHA3-256 hash commitment for my research paper""Embed this JSON configuration on the blockchain"
"Store this text document with content-type text/plain"
"Read the document from transaction def456...""Deploy a new token called TEST with max supply 21 million"
"Mint 1000 TEST tokens"
"Create a transfer inscription for 500 TEST""Encode this hex data into an OP_RETURN script"
"Decode the OP_RETURN from this transaction"
"Build a transaction with this message embedded"Architecture
┌─────────────────────────────────────────────────────────┐
│ MCP Server │
├─────────────────────────────────────────────────────────┤
│ High-Level Tools │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
│ │ BRC-20 Ops │ │ Document │ │ Timestamp/ │ │
│ │ deploy/mint │ │ Storage │ │ Attestation │ │
│ └──────┬──────┘ └──────┬──────┘ └────────┬────────┘ │
│ │ │ │ │
│ ───────┴───────────────┴──────────────────┴───────── │
│ │
│ Low-Level Primitives │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
│ │ encode_ │ │ decode_ │ │ build_op_return │ │
│ │ op_return │ │ op_return │ │ _transaction │ │
│ └─────────────┘ └─────────────┘ └─────────────────┘ │
├─────────────────────────────────────────────────────────┤
│ Bitcoin Core Interface (configurable) │
│ ┌──────────────────┐ ┌────────────────────────────┐ │
│ │ bitcoin-cli │ │ JSON-RPC (direct) │ │
│ │ (subprocess) │ │ │ │
│ └──────────────────┘ └────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘Safety Features
Feature | Description |
Testnet Default | Network locked to testnet unless explicitly configured |
Dry-Run Mode | Transactions validated before broadcast by default |
Fee Warnings | Alerts for unusually high fees |
Size Validation | Rejects data exceeding configured max before building |
Network Lock | Can't switch networks mid-session |
Development
# Clone
git clone https://github.com/EricGrill/mcp-bitcoin-cli.git
cd mcp-bitcoin-cli
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest -v
# Run tests with coverage
pytest --cov=mcp_bitcoin_cliProject Structure
src/mcp_bitcoin_cli/
├── __init__.py # Public exports
├── server.py # MCP server with 16 tools
├── envelope.py # BTCD envelope encoding/decoding
├── primitives.py # OP_RETURN script encoding/decoding
├── config.py # Configuration loading
├── node/
│ ├── interface.py # Abstract node interface
│ ├── cli.py # bitcoin-cli subprocess
│ └── rpc.py # JSON-RPC direct connection
└── protocols/
├── base.py # Base protocol class
└── brc20.py # BRC-20 token protocolTroubleshooting
Verify Bitcoin Core is running:
bitcoin-cli getblockchaininfoCheck network matches config (testnet vs mainnet)
Verify RPC credentials if using JSON-RPC mode
Use
broadcast_transactionwithdry_run=truefirstCheck fee rate is sufficient
Verify UTXOs have enough confirmations
Bitcoin Core v30+ supports up to ~100KB OP_RETURN
Older versions limited to 80 bytes
Check
max_data_sizein config
# Verify installation
python -c "import mcp_bitcoin_cli; print(mcp_bitcoin_cli.__version__)"
# Reinstall if needed
pip install -e ".[dev]"Contributing
Contributions welcome!
Fork the repository
Create feature branch:
git checkout -b feature/my-featureMake changes and test:
pytestCommit:
git commit -m 'Add my feature'Push:
git push origin feature/my-featureOpen a Pull Request
Related Projects
MCP Proxmox Admin - Manage Proxmox VE through Claude
Model Context Protocol - The protocol specification
BRC-20 Standard - Bitcoin token standard
License
MIT
Available Tools
16 toolsbroadcast_transactionB
Send signed transaction to the network.
Args:
tx_hex: Signed transaction as hex string
dry_run: If True, only test without broadcasting (default: True)
max_fee_rate: Maximum fee rate in BTC/kB (optional)
Returns:
Dictionary with result. For dry_run, includes 'allowed' status.
For actual broadcast, includes 'txid'.
Inputs: tx_hex (required), dry_run, max_fee_rate.
build_op_return_transactionA
Construct OP_RETURN output data for a transaction.
This prepares the data for inclusion in a transaction but does not
create or broadcast the transaction itself.
Args:
data: Data to embed
encoding: Data encoding ('utf-8' or 'hex')
use_envelope: Whether to wrap in BTCD envelope format
envelope_type: Envelope type if use_envelope is True
('raw', 'text', 'json', 'hash', 'token', 'file')
Returns:
Dictionary with 'script_hex' for the OP_RETURN output.
Inputs: data (required), encoding, use_envelope, envelope_type.
create_timestampB
Create a hash commitment for timestamping.
Args:
data: Data to timestamp
encoding: Data encoding ('utf-8' or 'hex')
hash_algorithm: Hash algorithm to use ('sha256', 'sha3_256')
Returns:
Dictionary with hash and prepared script for embedding.
Inputs: data (required), encoding, hash_algorithm.
create_token_deployB
Create a BRC-20 token deployment inscription.
Args:
tick: Token ticker (exactly 4 characters)
max_supply: Maximum token supply
mint_limit: Maximum amount per mint (optional)
decimals: Token decimals (default: 18)
Returns:
Dictionary with inscription data in various formats.
Inputs: tick (required), max_supply (required), mint_limit, decimals.
create_token_mintB
Create a BRC-20 token mint inscription.
Args:
tick: Token ticker (exactly 4 characters)
amount: Amount to mint
Returns:
Dictionary with inscription data in various formats.
Inputs: tick (required), amount (required).
create_token_transferB
Create a BRC-20 token transfer inscription.
Args:
tick: Token ticker (exactly 4 characters)
amount: Amount to transfer
Returns:
Dictionary with inscription data in various formats.
Inputs: tick (required), amount (required).
decode_op_returnB
Parse OP_RETURN data from script hex.
Args:
script_hex: OP_RETURN script as hex string
Returns:
Dictionary with 'data_hex' and 'data_utf8' (if decodable).
Inputs: script_hex (required).
embed_documentB
Prepare a document for on-chain storage.
Args:
content: Document content
content_type: MIME type of the content (default: 'text/plain')
encoding: Content encoding ('utf-8' or 'hex')
Returns:
Dictionary with prepared document data for embedding.
Inputs: content (required), content_type, encoding.
encode_op_returnB
Encode arbitrary data into OP_RETURN script format.
Args:
data: Data to encode (string)
encoding: Encoding for the data ('utf-8', 'hex'). Default: 'utf-8'
Returns:
Dictionary with 'script_hex' containing the OP_RETURN script.
Inputs: data (required), encoding.
get_node_infoA
Check connection and network status.
Returns:
Dictionary with node information including connection status,
network, block height, and version.
Inputs: no named parameters.
get_transactionC
Fetch transaction details.
Args:
txid: Transaction ID (hash)
Returns:
Dictionary with transaction details.
Inputs: txid (required).
list_utxosB
List available UTXOs for funding transactions.
Args:
min_confirmations: Minimum confirmations required (default: 1)
min_amount: Minimum UTXO amount in BTC (default: 0.0)
Returns:
Dictionary with list of UTXOs.
Inputs: min_confirmations, min_amount.
parse_envelopeA
Parse BTCD envelope structure from raw bytes.
Args:
data_hex: Hex-encoded envelope data
Returns:
Dictionary with envelope fields: magic, version, type, payload_hex.
Inputs: data_hex (required).
read_documentB
Retrieve and parse document from transaction data.
Args:
data_hex: Hex-encoded document data (from OP_RETURN)
Returns:
Dictionary with parsed document content.
Inputs: data_hex (required).
search_op_returnsB
Scan blocks for OP_RETURN transactions.
Note: This is a placeholder that will require additional implementation
for block scanning. Currently returns an error indicating the feature
requires direct block access.
Args:
start_height: Starting block height
end_height: Ending block height (optional, defaults to start_height)
limit: Maximum number of results (default: 100)
Returns:
Dictionary with found OP_RETURN transactions.
Inputs: start_height (required), end_height, limit.
verify_timestampB
Verify data against an on-chain timestamp hash.
Args:
data: Original data to verify
expected_hash: Expected hash value (hex)
encoding: Data encoding ('utf-8' or 'hex')
hash_algorithm: Hash algorithm used ('sha256', 'sha3_256')
Returns:
Dictionary with verification result.
Inputs: data (required), expected_hash (required), encoding, hash_algorithm.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have distinct purposes, such as broadcast_transaction for sending transactions and get_node_info for node status. However, there is some overlap between embed_document and encode_op_return, both preparing data for embedding, which could cause minor confusion. Overall, the descriptions clarify differences, but a few tools have similar scopes.
The naming follows a consistent verb_noun pattern throughout, like broadcast_transaction and decode_op_return, with clear and descriptive names. There are minor deviations, such as get_node_info using 'get' while others use verbs like 'create' or 'list', but the pattern remains largely predictable and readable.
With 16 tools, the count is slightly high but reasonable for a Bitcoin CLI server covering transactions, tokens, documents, and network operations. It feels comprehensive without being overwhelming, though it borders on heavy for the scope. Each tool appears to serve a specific function, justifying its inclusion.
The toolset provides good coverage for Bitcoin operations, including transaction handling, token management (BRC-20), document embedding, and network queries. Minor gaps exist, such as no direct tools for wallet management or advanced blockchain queries, but core workflows like creating, broadcasting, and verifying are well-supported, allowing agents to work effectively.
Maintenance
Related MCP Connectors
A second brain for Claude: remembers your work, plans your day, encrypted under a key only you hold.
Read-only access to your own crypto portfolio across 11+ exchanges and 20+ chains: holdings, full history, FIFO cost basis and P&L, fees and income. Ask Claude or ChatGPT about your portfolio; the connector can never trade, move funds or act as a login.
Swiss encrypted cloud drive for Claude, ChatGPT and AI agents: search, read and save files.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
AlicenseNot gradedqualityFmaintenanceProvides onchain tools for Claude AI to interact with the Base blockchain and Coinbase API, enabling wallet management, fund transfers, and smart contract deployment.26 npm351MIT- AlicenseBqualityDmaintenanceProvides Claude with access to Ethereum and EVM-compatible blockchain operations, enabling wallet management, transaction handling, contract interactions, and blockchain queries through natural language.35236 npm10MIT
- AlicenseBqualityDmaintenanceEnable AI assistants to interact directly with Bitcoin Ordinals inscriptions. Seamlessly integrates with Goose and Claude Desktop to retrieve and display inscription content from transactions.14MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with the Stacks blockchain through Claude Desktop. Manage wallets, trade tokens on DEXs, stack STX for Bitcoin rewards, and track portfolio—all through natural conversation.30 npm6MIT