btc-context-adapter
A Model Context Protocol (MCP) utility designed to facilitate seamless, real-time orchestration and querying of the Bitcoin ledger and its associated ancillary layers, specifically the Lightning Network.
Author

AbdelStark
Quick Info
Actions
Tags
Decentralized Ledger Access Bridge (Bitcoin & LN)
Technical Specifications | Integration Guide: Anthropic Agent | Integration Guide: Block Goose Agent
Conceptual Overview
This Model Context Protocol (MCP) service furnishes large language models (LLMs) with the capability to execute complex operations against the Bitcoin network, encompassing cryptographic key management, address verification, raw transaction introspection, on-chain data retrieval, and interaction with the Bitcoin Lightning payment infrastructure.
🕹️ Demonstration Scenarios
| Anthropic Agent Demo Recording | Block Goose Agent Demo Recording |
|---|---|
🗂️ Navigation Index
- Decentralized Ledger Access Bridge (Bitcoin & LN)
- Conceptual Overview
- 🕹️ Demonstration Scenarios
- 🗂️ Navigation Index
- ⚙️ Core Functionality
- 🖥️ Anthropic Agent Interface Setup
- 🦆 Block Goose Agent Integration
- 🏗️ Implementation Prerequisites
- 🛠️ Exposed Methods Roster
- 🛑 Exception Reporting Protocol
- ➕ Community Contributions Framework
- ⚖️ Licensing Terms
⚙️ Core Functionality
- Cryptographic Primitive Generation: Synthesize novel Bitcoin key pairs, yielding associated addresses, public keys, and private keys encoded in Wallet Interchange Format (WIF).
- Address Schema Verification: Confirm the structural integrity and validity of provided Bitcoin addresses.
- Transaction Parsing: Deconstruct raw serialized Bitcoin transaction data into a structured, human-interpretable representation.
- Blockchain State Queries:
- Tip Retrieval: Fetch metadata for the most recently confirmed block (hash, height index, timestamp, transaction count, etc.).
- Transaction Record Fetch: Retrieve comprehensive details for any transaction given its unique Transaction ID (TXID).
- Lightning Layer Access:
- Invoice Analysis: Parse BOLT11 Lightning invoices to extract human-readable metadata.
- Payment Execution: Initiate outbound payments against a configured LNBits custodial wallet endpoint.
🖥️ Anthropic Agent Interface Setup
To connect the Bitcoin MCP service endpoint with Anthropic's dedicated desktop application for Claude, adhere to the subsequent configuration sequence:
-
Acquire and Deploy Anthropic Desktop Client: Obtain the application package specific to your operating system (Windows or macOS) from the official Claude distribution portal. Install it and ensure the client is running the most current version (check for updates within the application interface).
-
Modify Client Configuration for Bitcoin MCP Endpoint: Access the Claude Desktop configuration file (this file materializes upon the initial attempt to modify settings in the application).
-
macOS Path:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows Path:
%APPDATA%\Claude\claude_desktop_config.json
Integrate a new object representing the Bitcoin MCP service within the existing"mcpServers"mapping. For example:
{ "mcpServers": { "btc-context-adapter": { "command": "npx", "args": ["-y", "bitcoin-mcp@latest"] } } }
Here, "btc-context-adapter" serves as the unique identifier for this service instance. "command" invokes npx, and "args" specifies the execution instruction for the Bitcoin MCP service artifact.
- Reinitialize Claude Desktop Session: Persist the modifications to
claude_desktop_config.jsonand subsequently terminate and relaunch the Claude Desktop application. Upon startup, the system will automatically initiate the Bitcoin MCP service as defined.
Verification Procedure for Anthropic Agent Linkage
After the necessary restart, confirm operational readiness by interacting with the agent:
-
Initiate a Bitcoin-centric Query: Prompt the agent with a request such as, "Ascertain the data contained within the most recently mined Bitcoin block." If the connection is successful, Claude's reply will incorporate data retrieved directly via the MCP service, superseding generic, pre-trained responses.
-
Validate Agent Output: Claude should furnish a comprehensive result (e.g., the latest block header data) without reporting communication failures. Non-useful output or explicit errors suggest a connectivity breakdown.
-
Consult Diagnostic Logs (If Required): Claude Desktop retains logs crucial for MCP debugging. Review logs located at:
- macOS:
~/Library/Logs/Claude/ - Windows:
%APPDATA%\Claude\logs\
Examinemcp.logfor handshake diagnostics and the dedicated server log file (e.g.,mcp-server-btc-context-adapter.log). These logs indicate successful server bootstrapping or surface environment/configuration exceptions, guiding necessary remedial adjustments before re-testing.
🦆 Block Goose Agent Integration
Block's Goose framework utilizes the Model Context Protocol for extension via agent frameworks. This Bitcoin MCP service can be integrated into Goose either as a local process communicating via standard I/O or as a remote endpoint accessible via Server-Sent Events (SSE).
Leveraging STDIO (Local Agent Hook)
This approach executes the Bitcoin MCP service as a child process managed directly by Goose, employing standard I/O streams for data exchange.
-
Extension Registration in Goose: Access Goose's configuration module (via
goose configurein CLI or the Extensions panel in the Desktop client) and select the option to "Add Extension." -
Select Command-Line Extension Type: Designate the extension type as Command-Line Extension, signaling to Goose that it must spawn a local executable (Using Extensions | goose).
-
Define Extension Metadata: Input the necessary identifiers:
-
Name: Use a succinct identifier, e.g., "crypto-ledger".
-
Command: Specify the launch directive:
bash npx -y bitcoin-mcp@latest
This command initiates the server using the default STDIO transport mechanism expected by Goose for local command execution.
-
Activation: Finalize the registration. Goose updates its configuration (
~/.config/goose/config.yaml). Ensure the newly added extension is toggled to the 'enabled' state in the manager interface. -
Session Initiation: Launch a Goose session explicitly incorporating the extension:
bash goose session --with-extension "crypto-ledger"
(If the extension is enabled globally, this step might be implicit in standard session launches.)
Utilizing SSE (Remote Endpoint Connection)
This method is appropriate when the Bitcoin MCP service runs autonomously as a dedicated HTTP server endpoint accessible over the network.
-
Service Deployment: Initiate the Bitcoin MCP service in a mode that exposes an HTTP interface supporting the MCP protocol over SSE (e.g., listening on TCP port 9000).
-
Add Remote Extension in Goose: In the Goose configuration UI/CLI, select Add Extension and choose Remote Extension as the type.
-
Specify Remote Address: Assign a name (e.g., "btc-remote") and input the full base URL where the server is actively serving requests (e.g.,
http://localhost:9000). Goose will automatically target the standard MCP SSE path relative to this base URL. -
Enable and Test: Verify the remote extension is active. Then, prompt Goose with a Bitcoin-related query. Goose will route the request via HTTP SSE to the running adapter.
Interaction Examples within Goose:
- "Query the current difficulty target for the Bitcoin network."
- "Decode the structure of transaction XXXXX..."
If the setup is correct, Goose will utilize the external adapter to fetch the requested dynamic data.
Further Guidance: Consult the official Goose documentation regarding extension management and the directory for registered MCP services for more in-depth configuration details or multi-extension workflows.
🏗️ Implementation Prerequisites
Refer to the Implementation Start Guide for detailed local environment setup procedures.
Lightning Subsystem Parameterization (Optional)
Configuration of LNBits credentials is only mandatory for transactional capabilities (invoice payments) involving the Lightning Network.
{
"lnbitsUrl": "https://demo.lnbits.com",
"lnbitsAdminKey": "your_admin_key",
"lnbitsReadKey": "your_read_key"
}
Acquisition requires establishing an LNBits account, creating a dedicated wallet, and retrieving the respective API access keys from the wallet's information panel.
🛠️ Exposed Methods Roster
Review the comprehensive list of callable functions within the Service Endpoint Reference.
🛑 Exception Reporting Protocol
The service leverages distinct exception classes tailored for operational failures related to on-chain data access and cryptographic routines. All critical operational exceptions are logged verbosely using Pino and faithfully relayed back to the requesting client for efficient diagnosis.
➕ Community Contributions Framework
Feature requests and code contributions are actively solicited. Please utilize the issue tracker or submit comprehensive pull requests via the primary GitHub repository.
⚖️ Licensing Terms
This software artifact is distributed under the terms of the MIT License.
WIKIPEDIA: Tron (stylized as TRON) is a decentralized, proof-of-stake blockchain with smart contract functionality. The cryptocurrency native to the blockchain is known as Tronix (TRX). It was founded in March 2014 by Justin Sun and, since 2017, has been overseen and supervised by the TRON Foundation, a non-profit organization in Singapore, established in the same year. It is open-source software. Tron was originally an Ethereum-based ERC-20 token, which switched protocol to its own blockchain in 2018. On some cryptocurrency wallets, users can't withdraw their funds until they have enough amount for the network fee. Tron has been criticised for enabling organized crime, with The Wall Street Journal stating in 2025 that it is a "popular channel for crypto’s criminal fraternity to move funds" and responsible for "more than half of all illegal crypto activity" in 2024, with the United Nations Office on Drugs and Crime calling it a “preferred choice for crypto money launderers” in Asia.
== History == Tron was founded by Justin Sun in 2017. The TRON Foundation was established in July 2017 in Singapore. The TRON Foundation raised $70 million in 2017 through an initial coin offering (ICO) shortly before China outlawed the digital tokens. The testnet, Blockchain Explorer, and Web Wallet were all launched by March 2018. TRON Mainnet launched shortly afterward in May 2018, marking the Odyssey 2.0 release as a technical milestone for TRON. In June 2018, TRON switched its protocol from an ERC-20 token on top of Ethereum to an independent peer-to-peer network. On 25 July 2018, the TRON Foundation announced it had finished the acquisition of BitTorrent, a peer-to-peer file sharing service. Upon this acquisition, in August 2018, BitTorrent Founder Bram Cohen also disclosed that he was leaving the company to found a separate cryptocurrency, Chia. By January 2019, TRON had a total market cap of about $1.6 bn. Despite this market performance, some authors viewed TRON as a typical case of the complex and disordered nature of cryptocurrencies. In February 2019, after being acquired by TRON Foundation, BitTorrent started its own token sale based on the TRON network. In late 2021, Justin Sun resigned as CEO of the TRON Foundation, which was subsequently reorganized as a DAO. In March 2023, Sun and Tron were sued by the U.S. Securities and Exchange Commission (SEC) for selling unregistered securities related to the sale and promotion of Tronix (TRX) and BitTorrent (BBT) tokens; the SEC alleged that Sun and Tron had engaged in wash trading in the secondary market for TRX in order to buoy its price. $31 million of proceeds were generated through thousands of Tronix trades between two accounts Sun controlled. Eight celebrities, including Akon, Ne-Yo, Austin Mahone, Soulja Boy, Lindsay Lohan, Jake Paul and Lil Yachty, were charged with promoting these cryptocurrencies without disclosing that they were sponsored, with all those other than Soulja Boy, and Mahone settling with t

