# OpenNode MCP

> OpenNode MCP Server processes Bitcoin and Lightning Network payments directly from your agent. You can create charges using BOLT11 invoices or on-chain addresses, manage payouts to both LN and BTC, and track all transaction history. It gives your AI client the tools it needs to handle crypto receipts and fund transfers securely.

## Overview
- **Category:** payment-processing
- **Price:** Free
- **Tags:** bitcoin, lightning-network, crypto-payments, merchant-services, payouts

## Description

You're running a payment stack for Bitcoin and Lightning Network receipts? This OpenNode MCP Server gives your agent everything it needs to handle crypto funds, from accepting charges to sending payouts. You can process complex financial workflows—it handles both BTC and LN payments under one roof.

### Accepting Funds and Creating Charges

To take a payment, you'll generate a charge using **`create_charge`**, which accepts either a Lightning BOLT11 invoice or a direct on-chain Bitcoin address. You can keep track of all the money coming in by calling **`list_charges`**, giving you a list of every paid charge ID. If you need to process a refund for an underpaid customer, use **`create_refund`**. To get specific details about any past charge or refund, call **`get_charge`** or **`get_refund`**, respectively.

You'll never run out of place to take money because the server lets you set up static receiving addresses. Use **`create_address`** to generate and manage a new on-chain Bitcoin address for incoming funds, and if you're focused on Lightning, **`create_lnurl_pay`** generates a dedicated LNURL-Pay address. To see all your existing setup, check **`list_addresses`** or **`list_lnurl_pay`**. 

### Managing Payouts and Withdrawals

When it's time to send money out, the server handles both BTC and Lightning payouts. You initiate a general payout using **`initiate_withdrawal`**, which manages both standard blockchain transfers and Lightning payments, and you can preview any pending payment details by calling **`get_withdrawal`**. For dedicated LN withdrawals, use **`initiate_lnurl_withdrawal`** for the specific format required.

Whenever a payout is ready to go, your agent confirms it. If it's a standard Bitcoin withdrawal, run **`confirm_chain_withdrawal`**. If you're paying out over Lightning Network, confirm the transfer with **`confirm_ln_withdrawal`**. You can track every payment sent by calling **`list_withdrawals`** for a complete history of all initiated payouts.

### Account Oversight and Financial Tools

You need to know where your money is. Run **`get_account_balance`** anytime you want the current total balance across supported OpenNode currencies. To see what payments are coming, call **`list_activity`**, which provides an audit log of every account action and transaction that's occurred. You can also pull a list of all originating currencies with **`get_currencies`**. 

If you need to move money between crypto and fiat, use **`initiate_exchange`** to start the conversion process between BTC and fiat currency. The server helps keep you current by providing real-time exchange rates through **`get_rates`**. For managing large fund flows over time, you can set up automated transfers using **`set_scheduled_withdrawals`**.

To get a full picture of your history, check **`list_refunds`** for an overview of all processed refunds, or review the complete record by calling **`list_charges`** again. The server ensures every step—from setting up addresses to scheduling payments and initiating exchanges—is available directly through your agent.

## Tools

### get_account_balance
Retrieves the current total balance for your OpenNode account across supported currencies.

### list_activity
Provides an audit log of all account actions and transactions that have occurred.

### create_address
Creates and returns a new, static on-chain Bitcoin address for receiving funds.

### list_addresses
Lists all the static on-chain Bitcoin addresses you currently manage through OpenNode.

### create_charge
Generates a payment request (charge) using either a Lightning BOLT11 invoice or an on-chain BTC address.

### get_charge
Fetches specific details about a single charge ID, confirming status and amount paid.

### list_charges
Retrieves a list of all charges that have been successfully paid by customers.

### get_currencies
Lists all the originating currencies that OpenNode supports for payment processing.

### initiate_exchange
Starts an exchange transaction, converting BTC into fiat currency and vice versa.

### create_lnurl_pay
Creates and returns a static LNURL-Pay address for receiving Lightning payments.

### list_lnurl_pay
Lists the static LNURL-Pay addresses you have set up for receiving Lightning payments.

### initiate_lnurl_withdrawal
Begins a withdrawal payout specifically using the LNURL-Pay format for Lightning payouts.

### get_rates
Retrieves current exchange rates between Bitcoin and fiat currencies.

### create_refund
Processes a refund against an existing charge that was underpaid by the customer.

### get_refund
Fetches specific details regarding a refund transaction, including the reason and amount.

### list_refunds
Provides an overview and list of all processed refunds on your account.

### set_scheduled_withdrawals
Sets or modifies the status for automated, scheduled bank withdrawals.

### confirm_chain_withdrawal
Confirms a Bitcoin-based withdrawal request that was previously previewed.

### confirm_ln_withdrawal
Confirms a Lightning Network payout request that was previously previewed.

### get_withdrawal
Retrieves detailed information about a planned or pending withdrawal payout.

### initiate_withdrawal
Starts a general withdrawal process, handling both Lightning and standard blockchain payouts. It can also preview pending payments.

### list_withdrawals
Retrieves a complete record of every withdrawal initiated from the account history.

## Prompt Examples

**Prompt:** 
```
Create a charge for 10000 satoshis with the description 'Coffee purchase'.
```

**Response:** 
```
I've created the charge using `create_charge`. Here is your Lightning Invoice (BOLT11): `lnbc100u...` and the on-chain address: `tb1q...`. The charge ID is `ch_123456`.
```

**Prompt:** 
```
List my paid charges on page 1.
```

**Response:** 
```
Retrieving paid charges... I found 3 paid charges via `list_charges`. Notable payments include 'Order #1002' (ID: `ch_abc123`) and 'Donation' (ID: `ch_xyz789`).
```

**Prompt:** 
```
Get the details of charge ID ch_abc123.
```

**Response:** 
```
Inspecting charge `ch_abc123` using `get_charge`... The charge is marked as 'paid' for 5000 satoshis, created on 2023-10-27, with the description 'API Access'.
```

## Capabilities

### Process Payments
Create a new charge request using `create_charge` with either a BOLT11 invoice or an on-chain address.

### Manage Payouts
Initiate withdrawals to Bitcoin addresses or Lightning Network invoices, and confirm these transactions with specific confirmation tools.

### Check Account Status
Get the current account balance using `get_account_balance` or view detailed transaction history via `list_activity`.

### Handle Refunds and Exchanges
Process refunds for underpaid charges (`create_refund`) or initiate fiat-to-crypto exchanges between BTC and fiat currencies using `initiate_exchange`.

## Use Cases

### Handling Bulk E-commerce Sales
A store manager needs to process a large batch of sales. Instead of compiling 50 BOLT11 invoices and manually checking their status, the agent runs `create_charge` for each order ID, generating both the LN invoice and on-chain address in one flow. The manager then uses `list_charges` to confirm all payments cleared.

### Executing a Payroll Payout
A company needs to pay its employees weekly crypto salaries. They ask the agent to check the balance (`get_account_balance`) and then use `initiate_withdrawal` for each employee, specifying either BTC or LN payment rails. The agent handles the entire payout sequence.

### Auditing a Payment Dispute
A customer claims they paid but the record is missing. Instead of emailing support with screenshots, the user asks their agent to check the status using `get_charge` with the specific transaction ID. The agent confirms if the payment was received and marked as 'paid' on OpenNode.

### Setting Up Automated Treasury Transfers
The finance department needs funds automatically moved to a bank account every month. They use `set_scheduled_withdrawals` via their agent, setting the criteria and timing. The agent handles the API interaction for future payout confirmation.

## Benefits

- Saves time on reconciliation. Instead of manually checking bank statements, you ask your agent to run `list_charges` or `list_withdrawals`. It gives you a clear audit trail for every incoming payment and outgoing payout.
- Handles multiple networks without switching tools. You can accept payments via BOLT11 invoices (`create_charge`) and immediately schedule payouts over BTC or LN using `initiate_withdrawal` in the same session.
- Keeps your funds secure and liquid. You don't just send money; you manage it. Use `get_account_balance` to check reserves, then use `initiate_exchange` if you need cash instead of crypto.
- Simplifies address management. Need a new receipt address? Call `create_address` or `create_lnurl_pay`. You get the static, ready-to-use string instantly, without visiting a web dashboard.
- Manages complex payment failures. If a customer pays too little, you don't have to guess what went wrong. Use `get_charge` and then call `create_refund` directly through your agent.

## How It Works

The bottom line is that your AI client talks to OpenNode via API calls, handling all payment logic without needing manual web interaction.

1. First, you subscribe to the server and provide your OpenNode API Key. This authenticates your account.
2. Next, you instruct your agent on the required action (e.g., 'Create a charge for $50' or 'Send 1 BTC').
3. The agent executes the appropriate tool (`create_charge`, `initiate_withdrawal`) and returns the necessary ID, invoice, or confirmation details.

## Frequently Asked Questions

**How do I get a new receiving address with create_address?**
You call `create_address` and specify the desired coin. The tool returns a static, ready-to-use on-chain BTC address that you can give to customers instantly.

**What's the difference between initiate_withdrawal and initiate_lnurl_withdrawal?**
`initiate_withdrawal` handles general payouts across both Lightning and standard blockchain rails. Use `initiate_lnurl_withdrawal` specifically when your payout destination is an LNURL-Pay address.

**Can I list all my past payments using list_charges?**
Yes, running `list_charges` returns a record of every charge that has been successfully paid. This helps you audit sales and reconcile revenue quickly.

**Do I need to check get_account_balance before setting scheduled withdrawals?**
While not mandatory, it's best practice. Always run `get_account_balance` first. It confirms your current liquid funds are available for the scheduled transfers you plan to set up with `set_scheduled_withdrawals`.

**What tool do I use to refund a customer?**
You must use `create_refund`. This function requires details about the original charge, making sure the refund is properly linked and tracked in your account history using `list_refunds`.

**What does `list_activity` show if I need a full audit of my account?**
It lists every major transaction action taken on your account. This tool gives you a comprehensive log, tracking everything from charges and refunds to withdrawals and status changes.

**How do I use `initiate_exchange` to convert Bitcoin into fiat currency?**
You call `initiate_exchange` when you need to swap BTC for traditional money. The tool handles the conversion process, letting you move crypto balances into a usable fiat format.

**After using `initiate_withdrawal`, what is the purpose of `confirm_chain_withdrawal`?**
You must use `confirm_chain_withdrawal` to execute a pending withdrawal. Initiating just drafts the request; confirmation sends the final instructions and locks in the payout.

**How do I generate a new Bitcoin payment request?**
Use the `create_charge` tool. Provide the amount in satoshis (or specify a currency like USD) and an optional description. The tool returns a BOLT11 Lightning invoice and an on-chain address.

**Can I preview a withdrawal before confirming it?**
Yes. Call `initiate_withdrawal` with `auto_confirm` set to false. This generates a preview. You can then finalize it using `confirm_chain_withdrawal` or `confirm_ln_withdrawal` depending on the type.

**How do I check my past withdrawals?**
You can use the `list_withdrawals` tool to retrieve a list of past withdrawals, with optional filters for page size, page number, and withdrawal type (like 'ln' or 'chain').