> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decibel.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Set up the Decibel MCP server with Claude Code, Claude Desktop, or other MCP clients

## Prerequisites

The MCP server is bundled with the Decibel CLI. You can run it directly with `npx` (no global install required) or install the CLI first:

```bash theme={null}
npm install -g @decibeltrade/cli
```

You'll also need:

* A [Node API token](/quickstart/node-api-key) from [Geomi](https://geomi.dev)
* An API wallet created at [app.decibel.trade/api](https://app.decibel.trade/api) (for trading operations)

## Setup with Claude Code

The fastest way to add the MCP server:

```bash theme={null}
claude mcp add --transport stdio \
  --env DECIBEL_PRIVATE_KEY=ed25519-priv-0x... \
  --env DECIBEL_SUBACCOUNT_ADDRESS=0x... \
  --env DECIBEL_NETWORK=testnet \
  --env DECIBEL_NODE_API_KEY=aptoslabs_... \
  -- decibel npx -y --package @decibeltrade/cli decibel-mcp
```

Replace the environment variable values with your own credentials. You can omit `DECIBEL_PRIVATE_KEY` and `DECIBEL_SUBACCOUNT_ADDRESS` if you've already added a default account with `decibel-cli account add`.

## Setup with JSON config

Add the following to your MCP client's configuration file. For Claude Code, this is `~/.claude/settings.json`. For Claude Desktop, this is `claude_desktop_config.json`.

```json theme={null}
{
  "mcpServers": {
    "decibel": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "-p", "@decibeltrade/cli", "decibel-mcp"],
      "env": {
        "DECIBEL_NETWORK": "testnet",
        "DECIBEL_PRIVATE_KEY": "ed25519-priv-0x...",
        "DECIBEL_SUBACCOUNT_ADDRESS": "0x...",
        "DECIBEL_NODE_API_KEY": "your-node-api-key"
      }
    }
  }
}
```

## Environment variables

The MCP server uses the same environment variables as the CLI:

| Variable                      | Required | Description                                                               |
| ----------------------------- | -------- | ------------------------------------------------------------------------- |
| `DECIBEL_NODE_API_KEY`        | Yes      | Node API key for authentication                                           |
| `DECIBEL_PRIVATE_KEY`         | Trading  | API wallet private key for signing transactions                           |
| `DECIBEL_SUBACCOUNT_ADDRESS`  | Trading  | Subaccount address                                                        |
| `DECIBEL_NETWORK`             | No       | Network: `mainnet`, `testnet` (default), `local`                          |
| `DECIBEL_GAS_STATION_API_KEY` | No       | [Gas Station](/quickstart/gas-station) API key for sponsored transactions |

<Note>
  `DECIBEL_PRIVATE_KEY` and `DECIBEL_SUBACCOUNT_ADDRESS` are required for trading tools (placing orders, cancelling, etc.). Market data tools (`get_markets`, `get_price`, `get_orderbook`) only require `DECIBEL_NODE_API_KEY`.
</Note>

## Authentication

The MCP server supports the same authentication methods as the CLI, resolved in this order:

1. Environment variables (`DECIBEL_PRIVATE_KEY` + `DECIBEL_SUBACCOUNT_ADDRESS`)
2. Default account from local storage (`~/.decibel/data.db`)

For the MCP server, environment variables are the most common approach since they're set in the MCP client configuration. If you prefer stored accounts, run `decibel-cli account add` first and the server will use the default account automatically.

## Verify the connection

After configuring your MCP client, ask the AI agent to run a simple query:

```
What markets are available on Decibel?
```

The agent should invoke the `get_markets` tool and return the list of available trading pairs.
