# Counterparty MCP Server [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/XCP/mcp-server  
**GitHub Stars:** 1  
**npm Downloads (last month):** 310  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-server-81

## Description
Interact with Counterparty — the token protocol on Bitcoin. Query, compose, sign.

## Tools
Capabilities this server exposes over MCP:

- **get_balances** — Get all Counterparty token balances for a Bitcoin address
- **get_balance** — Get the balance of a specific asset for a Bitcoin address
- **get_asset_info** — Get metadata for a Counterparty asset (supply, divisibility, issuer, description, etc.)
- **get_asset_balances** — Get all balances for a specific asset across all holders
- **get_assets** — Search or list Counterparty assets
- **get_issuances** — Get the issuance history for a Counterparty asset
- **get_owned_assets** — Get all assets issued/owned by a specific address
- **get_orders** — Get orders on the Counterparty DEX (default: open)
- **get_order** — Get details of a specific DEX order by its transaction hash
- **get_order_matches** — Get matches for a specific DEX order
- **get_orders_by_pair** — Get the order book for a specific trading pair on the DEX
- **get_asset_orders** — Get all DEX orders involving a specific asset
- **get_address_orders** — Get all DEX orders placed by a specific address
- **get_dispensers** — Get Counterparty dispensers (default: open)
- **get_dispenser** — Get details of a specific dispenser by its transaction hash
- **get_dispensers_by_asset** — Get dispensers for a specific asset (default: open)
- **get_address_dispensers** — Get all dispensers created by a specific address
- **get_dispenses** — Get dispense records (purchases) for a specific dispenser
- **get_dividends** — Get dividend distributions for a specific asset
- **get_address_transactions** — Get transaction history for a Bitcoin address on Counterparty
- **get_sends** — Get all sends (token transfers) from a specific address
- **get_transaction** — Get details of a specific Counterparty transaction by its hash
- **get_utxo_balances** — Get Counterparty token balances attached to a specific UTXO
- **get_latest_block** — Get the latest block information from the Counterparty node
- **compose_send** — Compose a transaction to send Counterparty tokens to an address
- **compose_mpma** — Compose a multi-party multi-asset send transaction. Sends multiple assets to multiple destinations in a single transaction. All three arrays must be the same length.
- **compose_order** — Compose a DEX order to trade Counterparty assets. IMPORTANT: give_quantity and get_quantity are TOTAL amounts, not per-unit prices. The price per unit is the ratio between them. Example: to buy 1000 TOKENA at 0.5 XCP each, set give_asset=XCP, give_quantity=500*10^8 (500 XCP total), get_asset=TOKENA, get_quantity=1000. Example: to sell 50 XCP for BTC at 0.001 BTC per XCP, set give_asset=XCP, give_quantity=50*10^8, get_asset=BTC, get_quantity=50*100000 (0.05 BTC total).
- **compose_cancel** — Compose a transaction to cancel an open DEX order
- **compose_btcpay** — Compose a BTC payment for a matched DEX order. Used to complete BTC trades on the DEX.
- **compose_issuance** — Compose a transaction to issue (create) a new Counterparty asset, or update an existing one.
- **compose_dispenser** — Compose a transaction to create, open, or close a dispenser. Dispensers automatically sell tokens for BTC.
- **compose_dispense** — Compose a transaction to buy from a dispenser by sending BTC to it
- **compose_dividend** — Compose a transaction to distribute dividends to all holders of an asset
- **compose_broadcast** — Compose a transaction to broadcast a text message or numeric value to the Counterparty network
- **compose_sweep** — Compose a transaction to sweep all assets and/or BTC from one address to another
- **compose_destroy** — Compose a transaction to permanently destroy (burn) Counterparty tokens
- **compose_fairminter** — Compose a transaction to create a fair minting launch for a new asset. For XCP-420 compliant launches, use compose_xcp420_fairminter instead.
- **compose_xcp420_fairminter** — Compose a XCP-420 compliant fair launch. XCP-420 is a community standard that enforces fixed parameters: 10M supply, 4.2M soft cap, 0.1 XCP per mint, 1000 tokens per mint, 1000 block duration, no premine, no commission, burn payment, locked supply. Only the asset name, start block, and description are configurable.
- **compose_fairmint** — Compose a transaction to mint tokens from an active fair minter
- **compose_attach** — Compose a transaction to attach Counterparty tokens to a specific UTXO
- **compose_detach** — Compose a transaction to detach Counterparty tokens from a UTXO back to an address
- **compose_movetoutxo** — Compose a transaction to move a UTXO (and any attached tokens) to a new output
- **broadcast_transaction** — Broadcast a signed Bitcoin transaction to the network via the Counterparty node
- **get_fee_estimate** — Get current Bitcoin fee rates in sat/vB. Queries the Counterparty node first, falls back to mempool.space. Use the returned values directly as sat_per_vbyte in compose tools.
- **decode_transaction** — Decode a raw Bitcoin transaction hex into its components (inputs, outputs, etc.)
- **unpack_transaction** — Decode and unpack a Counterparty message from a raw transaction, revealing the embedded Counterparty data
- **get_server_info** — Get Counterparty node status, version, and network information
- **api_request** — Make a raw API request to any Counterparty REST endpoint not covered by the other tools. Full API reference: https://raw.githubusercontent.com/CounterpartyXCP/counterparty-core/refs/heads/master/apiary.apib — Example: endpoint="/v2/blocks/last", method="GET"

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "counterparty-mcp-server": {
    "command": "npx",
    "args": ["-y","@21e14/mcp-server"]
  }
}
```

## Documentation & README

# Counterparty MCP Server

Give AI agents the ability to interact with [Counterparty](https://counterparty.io) — the token protocol built on Bitcoin. Query balances, assets, orders, and dispensers. Compose, sign, and broadcast transactions. Works with any MCP-compatible client.

[![npm](https://img.shields.io/npm/v/@21e14/mcp-server)](https://www.npmjs.com/package/@21e14/mcp-server)

## Install

No download needed — just add the config below to your AI client. `npx` fetches and runs the server automatically.

### Claude Desktop

Add to `claude_desktop_config.json` ([how to find it](https://modelcontextprotocol.io/quickstart/user)):

```json
{
  "mcpServers": {
    "counterparty": {
      "command": "npx",
      "args": ["-y", "@21e14/mcp-server"]
    }
  }
}
```

### Claude Code

```bash
claude mcp add counterparty -- npx -y @21e14/mcp-server
```

With signing (see [Signing & Broadcasting](#signing--broadcasting)):

```bash
claude mcp add counterparty \
  -e SIGNER_PRIVATE_KEY=L1aW4aubDFB7yfras2S1mN... \
  -e SIGNER_ADDRESS=bc1q... \
  -- npx -y @21e14/mcp-server
```

Manage servers with `claude mcp list`, `claude mcp get counterparty`, or `claude mcp remove counterparty`.

### VS Code (Copilot)

Use `Ctrl+Shift+P` → **MCP: Add Server** → **Stdio**, then enter:

```
npx -y @21e14/mcp-server
```

Or add to `.vscode/mcp.json`:

```json
{
  "servers": {
    "counterparty": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@21e14/mcp-server"]
    }
  }
}
```

### Cursor

Add to `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "counterparty": {
      "command": "npx",
      "args": ["-y", "@21e14/mcp-server"]
    }
  }
}
```

### Windsurf

Add to `~/.codeium/windsurf/mcp_config.json`:

```json
{
  "mcpServers": {
    "counterparty": {
      "command": "npx",
      "args": ["-y", "@21e14/mcp-server"]
    }
  }
}
```

### ChatGPT

In ChatGPT desktop, go to **Settings → Beta Features → MCP Servers**, then add:

```
npx -y @21e14/mcp-server
```

### Any MCP Client

The server speaks stdio. Point any MCP-compatible client at:

```bash
npx -y @21e14/mcp-server
```

That's it. The agent can now query the Counterparty network and compose unsigned transactions.

## Signing & Broadcasting

To let the agent sign and broadcast transactions, add a signing key:

```json
{
  "mcpServers": {
    "counterparty": {
      "command": "npx",
      "args": ["-y", "@21e14/mcp-server"],
      "env": {
        "SIGNER_PRIVATE_KEY": "L1aW4aubDFB7yfras2S1mN...",
        "SIGNER_ADDRESS": "bc1q..."
      }
    }
  }
}
```

This enables the `sign_and_broadcast` tool. **Signing gives the AI agent the ability to spend funds** — read the security guidance below.

### Bot wallet pattern (recommended)

1. **Generate a fresh keypair offline.** Don't reuse an existing wallet or generate keys through the AI.
2. **Fund it with only what you're willing to risk.** This is your blast radius.
3. **Use a segwit address.** P2WPKH (`bc1q...`), P2SH-P2WPKH (`3...`), or P2TR (`bc1p...`). Legacy P2PKH is not supported.
4. **One key, one address.** No HD derivation. Counterparty reuses addresses by design.
5. **Keep main holdings elsewhere.** The bot wallet is disposable.

### Compose-only mode

Without signing keys, the server returns unsigned transaction hex from all compose tools. You can review and sign offline with your own tooling. This is the safest mode.

### Transaction verification

`sign_and_broadcast` extracts and returns the embedded OP_RETURN data from the transaction before signing — done locally without trusting the API, so the agent can verify the transaction matches what was requested.

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `COUNTERPARTY_NODE` | No | Counterparty node URL (default: `https://api.counterparty.io:4000`) |
| `SIGNER_PRIVATE_KEY` | No | WIF-encoded private key for signing |
| `SIGNER_ADDRESS` | No | Bitcoin address for the signing key |

## Tools

### Query (24)

| Tool | Description |
|------|-------------|
| `get_balances` | All token balances for an address |
| `get_balance` | Single asset balance for an address |
| `get_asset_info` | Asset metadata (supply, divisibility, issuer) |
| `get_asset_balances` | All holders of an asset |
| `get_assets` | Search/list assets |
| `get_issuances` | Issuance history for an asset |
| `get_owned_assets` | Assets issued by an address |
| `get_orders` | DEX orders |
| `get_order` | Single order by hash |
| `get_order_matches` | Matches for an order |
| `get_orders_by_pair` | Order book for a trading pair |
| `get_asset_orders` | Orders involving an asset |
| `get_address_orders` | Orders by address |
| `get_dispensers` | Dispensers |
| `get_dispenser` | Single dispenser by hash |
| `get_dispensers_by_asset` | Dispensers for an asset |
| `get_address_dispensers` | Dispensers by address |
| `get_dispenses` | Purchases from a dispenser |
| `get_dividends` | Dividend distributions for an asset |
| `get_address_transactions` | Transaction history for an address |
| `get_sends` | Token transfers from an address |
| `get_transaction` | Single transaction by hash |
| `get_utxo_balances` | Tokens attached to a UTXO |
| `get_latest_block` | Latest block info |

### Compose (18)

| Tool | Description |
|------|-------------|
| `compose_send` | Send tokens to an address |
| `compose_mpma` | Multi-party multi-asset send |
| `compose_order` | Place a DEX order |
| `compose_cancel` | Cancel an open order |
| `compose_btcpay` | Pay for a matched BTC order |
| `compose_issuance` | Create or update an asset (supports inscriptions) |
| `compose_dispenser` | Create, open, or close a dispenser |
| `compose_dispense` | Buy from a dispenser |
| `compose_dividend` | Distribute dividends to holders |
| `compose_broadcast` | Broadcast a message (supports inscriptions) |
| `compose_sweep` | Sweep all assets to a destination |
| `compose_destroy` | Permanently burn tokens |
| `compose_fairminter` | Create a fair launch (supports inscriptions) |
| `compose_xcp420_fairminter` | XCP-420 compliant fair launch |
| `compose_fairmint` | Mint from an active fair launch |
| `compose_attach` | Attach tokens to a UTXO |
| `compose_detach` | Detach tokens from a UTXO |
| `compose_movetoutxo` | Move a UTXO to a new output |

### Bitcoin (4)

| Tool | Description |
|------|-------------|
| `sign_and_broadcast` | Sign and broadcast (requires signing keys) |
| `broadcast_transaction` | Broadcast an already-signed transaction |
| `get_fee_estimate` | Current fee rate estimate |
| `decode_transaction` | Decode raw transaction hex |

### Utility (3)

| Tool | Description |
|------|-------------|
| `unpack_transaction` | Decode a Counterparty message from a transaction |
| `get_server_info` | Node status and version |
| `api_request` | Raw API request to any endpoint ([full API reference](https://raw.githubusercontent.com/CounterpartyXCP/counterparty-core/refs/heads/master/apiary.apib)) |

## Resources

The server includes protocol documentation that agents can read for context:

- `counterparty://protocol-overview` — Assets, quantities, DEX, dispensers, fair minting, fees, and operational tips
- `counterparty://xcp420-standard` — XCP-420 fair launch standard
- `counterparty://quick-start` — Step-by-step workflows for common operations

## Development

```bash
git clone https://github.com/XCP/mcp-server.git
cd mcp-server
npm install
npm test
```

Test locally:

```json
{
  "mcpServers": {
    "counterparty": {
      "command": "node",
      "args": ["/path/to/mcp-server/dist/index.js"]
    }
  }
}
```

## License

MIT

