Skip to main content

Model Context Protocol server for Aster DEX — trade, analyze, and manage positions on Aster DEX via MCP

Project description

asterdex-mcp

Model Context Protocol (MCP) server for Aster DEX — a Binance-compatible perpetual futures DEX on-chain.

Features

  • Account — balance, positions, open orders
  • Trading — place/cancel/modify orders (market, limit, stop, TP/SL)
  • Market Data — klines/OHLCV, 24h ticker, orderbook, exchange info
  • Auth — EIP-712 typed data signing (delegation model)

Quick Start

uvx asterdex-mcp

Wallet Setup Guide

Aster DEX uses a delegation model with two wallets:

Wallet What it is Purpose
Main Wallet Your primary wallet (e.g. MetaMask) Holds funds, manages API permissions
Agent Wallet A separate wallet for automation Signs trades on your behalf

Step 1: Create an Agent Wallet

Generate a new Ethereum-compatible wallet for the agent. This wallet will sign transactions but never holds funds.

# Using ethers.js / viem / any wallet generator
# Or use this quick Python snippet:
python3 -c "
from eth_account import Account
acct = Account.create()
print(f'Address: {acct.address}')
print(f'Private Key: {acct.key.hex()}')
"

Save the output — you'll need both the address and private key.

Step 2: Set Up API Access on Aster

  1. Go to Aster DEX and connect your main wallet
  2. Navigate to SettingsAPI Management
  3. Click Create API Key
  4. Enter your agent wallet address when prompted
  5. Important: Enable the following permissions:
    • ✅ Perps Trading (required for placing orders)
    • ✅ Enable IP restriction (recommended for security)
  6. Whitelist your server/agent IP address
  7. Confirm and sign the transaction from your main wallet

Step 3: Get Your Credentials

You need three values:

ASTER_WALLET=0x...    # Your main wallet address (the one on Aster)
ASTER_SIGNER=0x...    # Your agent wallet address (from Step 1)
ASTER_PRIVATE_KEY=0x...  # Your agent wallet private key (from Step 1)

⚠️ Never share your private key. The agent wallet should have NO funds — it only signs messages.

Step 4: Install & Configure

Claude Code

# Add the MCP server
claude mcp add asterdex -- uvx asterdex-mcp \
  -e ASTER_PRIVATE_KEY=0xYOUR_AGENT_PRIVATE_KEY \
  -e ASTER_WALLET=0xYOUR_MAIN_WALLET_ADDRESS \
  -e ASTER_SIGNER=0xYOUR_AGENT_WALLET_ADDRESS

Verify with:

claude mcp list

OpenClaw

Add to your OpenClaw MCP config (~/.openclaw/mcp.json or project-level):

{
  "mcpServers": {
    "asterdex": {
      "command": "uvx",
      "args": ["asterdex-mcp"],
      "env": {
        "ASTER_PRIVATE_KEY": "0xYOUR_AGENT_PRIVATE_KEY",
        "ASTER_WALLET": "0xYOUR_MAIN_WALLET_ADDRESS",
        "ASTER_SIGNER": "0xYOUR_AGENT_WALLET_ADDRESS"
      }
    }
  }
}

Hermes Agent

Add to ~/.hermes/config.yaml under mcp_servers:

mcp_servers:
  asterdex:
    command: uvx
    args:
    - asterdex-mcp
    env:
      ASTER_PRIVATE_KEY: '0xYOUR_AGENT_PRIVATE_KEY'
      ASTER_WALLET: '0xYOUR_MAIN_WALLET_ADDRESS'
      ASTER_SIGNER: '0xYOUR_AGENT_WALLET_ADDRESS'
    enabled: true
    timeout: 30

Then restart: hermes gateway restart

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "asterdex": {
      "command": "uvx",
      "args": ["asterdex-mcp"],
      "env": {
        "ASTER_PRIVATE_KEY": "0xYOUR_AGENT_PRIVATE_KEY",
        "ASTER_WALLET": "0xYOUR_MAIN_WALLET_ADDRESS",
        "ASTER_SIGNER": "0xYOUR_AGENT_WALLET_ADDRESS"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project root (or ~/.cursor/mcp.json globally):

{
  "mcpServers": {
    "asterdex": {
      "command": "uvx",
      "args": ["asterdex-mcp"],
      "env": {
        "ASTER_PRIVATE_KEY": "0xYOUR_AGENT_PRIVATE_KEY",
        "ASTER_WALLET": "0xYOUR_MAIN_WALLET_ADDRESS",
        "ASTER_SIGNER": "0xYOUR_AGENT_WALLET_ADDRESS"
      }
    }
  }
}

Step 5: Verify

Ask your AI agent to run get_balance — if it returns your USDT balance, you're good to go.

Tools

Tool Description
get_balance Account balance and margin summary
get_positions Open positions with PnL
get_open_orders Pending orders (optional symbol filter)
place_order Place market/limit/stop/TP/SL orders
cancel_order Cancel order by ID
cancel_all_orders Bulk cancel all open orders
set_leverage Set leverage per trading pair
get_exchange_info Pairs, precision, leverage limits

Examples

See examples.md for natural language prompting examples — account, analysis, trading, and combined workflows.

How Auth Works

Aster DEX uses EIP-712 typed data signing (same as Hyperliquid). Instead of API keys with HMAC:

  1. Your agent wallet signs each request with EIP-712
  2. Aster verifies the signature against the signer address you registered
  3. The main wallet is included in the signed data so Aster knows whose account to act on

This means:

  • No API key/secret pairs to manage
  • Agent wallet can't steal funds (it has none)
  • You can revoke access anytime from Aster's API settings

Tech Stack

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asterdex_mcp-0.1.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asterdex_mcp-0.1.0-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file asterdex_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: asterdex_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for asterdex_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c00bd04d9649aeb1d7d663d1b1f2ef147578af3846d2bd284a95af898fa07101
MD5 02dc8781727e5f1c1f30926cdb88e342
BLAKE2b-256 a2ab3b1c90020e2fc5c77ddc7fab5568f4a9a2cf506b1f2a7026afb5680b148f

See more details on using hashes here.

File details

Details for the file asterdex_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: asterdex_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for asterdex_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a330fb80971ac39fa058c44c58a271497624207b55c98862b64bb8ae419c0c12
MD5 c87746781f53912efc41f438759cfc82
BLAKE2b-256 6378940e01501f570e0573d97f7065f54a98188e2db9c1c9fbd34df2fb8b70fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page