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:
npm install -g @decibeltrade/cli
You’ll also need:
Setup with Claude Code
The fastest way to add the MCP server:
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.
{
"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 API key for sponsored transactions |
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.
Authentication
The MCP server supports the same authentication methods as the CLI, resolved in this order:
- Environment variables (
DECIBEL_PRIVATE_KEY + DECIBEL_SUBACCOUNT_ADDRESS)
- 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.