Tutorials
MCP: Interact with Bitcoin via an LLM
16min
the model context protocol (mcp) https //modelcontextprotocol io/introduction is an open standard that enables developers to build secure, two way connections between their data sources and ai powered tools for additional information about mcp, its origins, and claude https //claude ai , read more from the creators, anthropic https //www anthropic com/news/model context protocol the maestro mcp server https //github com/maestro org/maestro mcp allows for interacting with bitcoin through the interface of an llm client this server functionality provides the llm with a set of tools for exploring blocks, transactions, addresses, and other aspects of the bitcoin blockchain, allowing the llm to not only retrieve and make infereances on on chain data, but also to take action on behalf of the user; ie, serve as an https //github com/resources/articles/ai/what are ai agents in this tutorial, we will use claude ai's https //claude ai desktop client alongside the maestro mcp server to communicate with the bitcoin network via maestro some of the mcp server functionality will not work if you are using the artist tier ; a composer level subscription or higher will be needed to access the more advanced mcp features, such as those related to mempool api activities consult the pricing page https //www gomaestro org/pricing for more information installation requirements node https //nodejs org/en >=20 clone the maestro mcp server repository https //github com/maestro org/maestro mcp server git deploy install npm install run npm start server generation generated with openapi mcp generator https //github com/harsha iiiv/openapi mcp generator npx openapi mcp generator input openapi merged json output / force if you choose to build the server from scratch using the above command, you will likely need to make further customizations related to the api key variable name to be consistent with the claude config json as this variable gets autogenerated contact support # if you experience any issues configure claude (desktop) download claude desktop here https //claude ai/download open claude desktop settings select edit config open the claude app configuration file located at macos /library/application support/claude/claude desktop config json windows %appdata%\claude\claude desktop config json copy the below contents into this config file local scoped mcp after cloning the repo, the server files are stored and sourced locally on your machine you will need 3 things absolute path to node ; ie, which node absolute path to maestro mcp server repo maestro api key { "mcpservers" { "maestro mcp server" { "command" "/absolute/path/to/node", "args" \["/absolute/path/to/maestro mcp server/src/index ts"], "env" { "maestro base url" "https //xbt mainnet gomaestro api org/v0", "maestro api key" "\<maestro api key>" } } } } usage restart claude after any change to either the claude desktop config json or the source code launch claude desktop locate the tools icon select maestro mcp server view available mcp tools prompt claude examples "fetch the latest bitcoin block" "get the blockchain info for bitcoin" "fetch all utxos for this address bc1prqpwzqqcfzlrtjz3at5kuz4zevqsmvxc5xjuzvg58y48leu67x0q0kvy85 " see usage https //docs gomaestro org/bitcoin/mcp interact with bitcoin via an llm#jmoe2 for viewing all the available mcp tools you will need to approve the request within claude debugging cli inspector tool mcp cli https //github com/wong2/mcp cli logs \# macos tail n 20 f /library/logs/claude/maestro mcp server log support if you are experiencing any trouble with the above, open an issue https //github com/maestro org/maestro mcp/issues/new or reach out on discord https //discord gg/es2rdhbjt3