Interact with Bitcoin: generate keys, validate addresses, decode transactions and query the blockchain
₿itcoin & Lightning Network MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Documentation
|
Try with Claude
|
Try with Goose
Overview
A Model Context Protocol (MCP) server that enables AI models to interact with Bitcoin and Lightning Network, allowing them to generate keys, validate addresses, decode transactions, query the blockchain, and more.
🎮 Demo
| Claude Demo Video | Goose Demo Video |
| ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| | |
💼 Table of Contents
- ₿itcoin \& Lightning Network MCP Server
- Overview
- 🎮 Demo
- 💼 Table of Contents
- 🔧 Features
- 🔑 Claude Desktop Integration
- Testing the Claude Desktop Integration
- 🦆 Goose Integration
- Using STDIO (Local Extension)
- Using SSE (Remote Extension)
- 📦 Development Setup
- Lightning Network Configuration (Optional)
- 📦 Available Tools
- 🚨 Error Handling
- 🤝 Contributing
- 📝 License
🔧 Features
- **Key Generation**: Create new Bitcoin key pairs — including address, public key, and private key (WIF).
- **Address Validation**: Validate the correctness of a Bitcoin address.
- **Transaction Decoding**: Parse a raw Bitcoin transaction and display its details in a human-readable format.
- **Blockchain Queries**:
- **Latest Block**: Retrieve details about the most recent block (hash, height, timestamp, transaction count, etc.).
- **Transaction Details**: Fetch detailed information about a transaction using its TXID.
- **Lightning Network**:
- **Invoice Decoding**: Parse a BOLT11 Lightning invoice and display human-readable information.
- **Payment**: Pay a Lightning invoice directly from your LNBits wallet.
🔑 Claude Desktop Integration
To use the Bitcoin MCP server with Claude Desktop (Anthropic's desktop app for Claude), follow these steps:
1. **Download and Install Claude Desktop:** Visit the official Claude Desktop downloads page and get the app for your operating system (macOS or Windows) (Installing Claude for Desktop | Anthropic Help Center). Install the app and ensure you're using the latest version (you can check for updates in the app menu).
2. **Configure Claude Desktop to use the Bitcoin MCP Server:** Open the Claude Desktop configuration file (it's created when you first edit settings in Claude Desktop):
- **macOS:** ~/Library/Application Support/Claude/claude_desktop_config.json
- **Windows:** %APPDATA%\Claude\claude_desktop_config.json
Add an entry for the Bitcoin MCP server in this JSON config under the "mcpServers" section. For example:
In the snippet above, "bitcoin-mcp" is an identifier for the server (you can name it whatever you want). The command is set to run the npx command, and args points to the path of your Bitcoin MCP server script or the command to run the server.
3. **Restart Claude Desktop:** Save the claude_desktop_config.json file and then **close and reopen Claude Desktop**. On the next launch, Claude will automatically start the Bitcoin MCP server as configured. If Claude Desktop was running, you need to restart it for the changes to take effect.
Testing the Claude Desktop Integration
Once Claude Desktop is restarted, you can test whether the Bitcoin MCP server is working correctly:
- **Ask Claude a sample question related to Bitcoin.** For example, try asking: _"What's the latest block on the Bitcoin network?"_ If the integration is successful, Claude's response should include the latest block fetched via the MCP server, rather than an "I don't know" or a generic answer. You can also try other queries like _"Give me information about the transaction with TXID abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890."_ Claude should use the MCP server's tools to retrieve the data and answer your query.
- **Verify the response:** Claude should return a detailed answer (e.g. the latest block on the Bitcoin network) without errors. If you get an error message or no useful response, the MCP server might not be connected properly.