Skip to main content
Glama
blofin-mcp

blofin-mcp

Official
by blofin

BloFin MCP Server

A Model Context Protocol (MCP) server for the BloFin cryptocurrency exchange API. Provides tools for market data, account management, and trading operations.

Features

Public Data (no authentication required)

  • get_instruments - Get available trading instruments and contract specs

  • get_tickers - Get latest prices, bid/ask, 24h volume

  • get_orderbook - Get order book depth

  • get_trades - Get recent trades

  • get_mark_price - Get mark/index prices

  • get_candlesticks - Get OHLCV candlestick data

  • get_funding_rate - Get current funding rates

  • get_funding_rate_history - Get historical funding rates

Account (authentication required)

  • get_balance - Get futures account balance

  • get_positions - Get open positions

  • get_leverage_info - Get leverage info for an instrument

  • set_leverage - Set leverage for an instrument

  • get_margin_mode - Get current margin mode for an instrument

  • set_margin_mode - Set margin mode for an instrument

  • get_position_mode - Get current position mode

  • set_position_mode - Set position mode

  • get_account_config - Get account configuration

Trading (authentication required)

  • place_order - Place a new order (market, limit, post_only, fok, ioc)

  • cancel_order - Cancel an order

  • batch_orders - Place multiple orders at once

  • cancel_batch_orders - Cancel multiple orders at once

  • close_position - Close a position

  • get_open_orders - Get pending orders

  • get_order_history - Get order history

  • get_order_detail - Get specific order details

  • get_fills_history - Get trade fill history

  • place_tpsl - Place take-profit/stop-loss order

  • cancel_tpsl - Cancel a take-profit/stop-loss order

  • get_pending_tpsl - Get pending TP/SL orders

  • get_tpsl_history - Get TP/SL order history

  • place_algo_order - Place an algo order (trigger/conditional)

  • cancel_algo_order - Cancel algo orders

  • get_pending_algo_orders - Get pending algo orders

  • get_algo_order_history - Get algo order history

Asset Management (authentication required)

  • get_asset_balances - Get balances across account types

  • fund_transfer - Transfer funds between accounts

  • get_fund_transfer_history - Get transfer history

  • get_deposit_history - Get deposit history

  • get_withdrawal_history - Get withdrawal history

  • get_apikey_info - Get API key information

Related MCP server: gate-local-mcp

Important Risk Notice

  • Trading tools can place and cancel real orders.

  • Use demo environment first, then switch to production only when ready.

  • Create API keys with least privilege and restrict by IP whenever possible.

  • Never share your API key, secret, or passphrase.

Tool Coverage

Current implementation registers 40 tools in total:

  • Public Market Data: 8 tools

  • Account: 9 tools

  • Trading: 17 tools

  • Asset Management: 6 tools

Getting Your API Key

  1. Go to blofin.com and log in (or create an account)

  2. Navigate to APIs page

  3. Click Create API Key and select BloFin MCP as the API type

  4. Set your permissions (read-only for market data, or enable trading as needed)

  5. Save your API Key, Secret Key, and Passphrase — you'll need them for configuration below

Environment Variables

Variable

Required

Description

BLOFIN_API_KEY

Yes

Your BloFin API key

BLOFIN_API_SECRET

Yes

Your BloFin API secret

BLOFIN_PASSPHRASE

Yes

Your BloFin API passphrase

BLOFIN_BASE_URL

No

API base URL (defaults to demo trading)

Base URLs

  • Demo Trading: https://demo-trading-openapi.blofin.com (default)

  • Production: https://openapi.blofin.com

Install and Build

npm install
npm run typecheck
npm run build

Installation

Claude Desktop (Extension)

Download the latest blofin-mcp.mcpb from GitHub Releases and double-click to install. Claude Desktop will prompt you to enter your API Key, API Secret, and Passphrase.

Claude Desktop (Manual)

Add to your Claude Desktop config (Settings → Developer → Edit Config):

{
  "mcpServers": {
    "blofin": {
      "command": "npx",
      "args": ["-y", "blofin-mcp"],
      "env": {
        "BLOFIN_API_KEY": "your-api-key",
        "BLOFIN_API_SECRET": "your-api-secret",
        "BLOFIN_PASSPHRASE": "your-passphrase",
        "BLOFIN_BASE_URL": "https://openapi.blofin.com"
      }
    }
  }
}

Claude Code

claude mcp add blofin -- npx -y blofin-mcp

Then set environment variables in your shell profile or .env file:

export BLOFIN_API_KEY="your-api-key"
export BLOFIN_API_SECRET="your-api-secret"
export BLOFIN_PASSPHRASE="your-passphrase"
export BLOFIN_BASE_URL="https://openapi.blofin.com"

Cursor

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

{
  "mcpServers": {
    "blofin": {
      "command": "npx",
      "args": ["-y", "blofin-mcp"],
      "env": {
        "BLOFIN_API_KEY": "your-api-key",
        "BLOFIN_API_SECRET": "your-api-secret",
        "BLOFIN_PASSPHRASE": "your-passphrase",
        "BLOFIN_BASE_URL": "https://openapi.blofin.com"
      }
    }
  }
}

Windsurf

Add to your Windsurf MCP config (~/.codeium/windsurf/mcp_config.json):

{
  "mcpServers": {
    "blofin": {
      "command": "npx",
      "args": ["-y", "blofin-mcp"],
      "env": {
        "BLOFIN_API_KEY": "your-api-key",
        "BLOFIN_API_SECRET": "your-api-secret",
        "BLOFIN_PASSPHRASE": "your-passphrase",
        "BLOFIN_BASE_URL": "https://openapi.blofin.com"
      }
    }
  }
}

Cline (VS Code)

Open Cline MCP settings (Cline → MCP Servers → Configure) and add:

{
  "mcpServers": {
    "blofin": {
      "command": "npx",
      "args": ["-y", "blofin-mcp"],
      "env": {
        "BLOFIN_API_KEY": "your-api-key",
        "BLOFIN_API_SECRET": "your-api-secret",
        "BLOFIN_PASSPHRASE": "your-passphrase",
        "BLOFIN_BASE_URL": "https://openapi.blofin.com"
      }
    }
  }
}

OpenClaw

Add "mcpServers" to your ~/.openclaw/openclaw.json (top-level field, alongside identity, agent, etc.):

{
  "identity": { "name": "Clawd", "emoji": "🦞" },
  "agent": { "workspace": "~/.openclaw/workspace" },

  // Add this section ↓
  "mcpServers": {
    "blofin": {
      "command": "npx",
      "args": ["-y", "blofin-mcp"],
      "env": {
        "BLOFIN_API_KEY": "your-api-key",
        "BLOFIN_API_SECRET": "your-api-secret",
        "BLOFIN_PASSPHRASE": "your-passphrase",
        "BLOFIN_BASE_URL": "https://openapi.blofin.com"
      }
    }
  }
}

If your openclaw.json already has a "mcpServers" section with other servers, just add "blofin": { ... } inside it.

Restart OpenClaw after saving. The agent will automatically discover the 40 BloFin tools.

Open Source Project Files

  • License: LICENSE

  • Contributing guide: CONTRIBUTING.md

  • Security policy: SECURITY.md

  • Community behavior policy: CODE_OF_CONDUCT.md

  • Change history: CHANGELOG.md

Reporting and Support

  • Bug reports and feature requests: GitHub Issues

  • Security issues: follow SECURITY.md

  • API reference: BloFin API Docs

Available Tools

40 tools
batch_ordersA

Place multiple orders at once (up to 20). All must share same instId and marginMode.

Inputs: orders (required).

cancel_algo_orderB

Cancel an algo order.

Inputs: instId, algoId, clientOrderId.

cancel_batch_ordersB

Cancel multiple orders at once.

Inputs: orders (required).

cancel_orderC

Cancel an existing order.

Inputs: orderId (required), instId, clientOrderId.

cancel_tpslB

Cancel take-profit/stop-loss orders. Accepts a JSON array of cancel objects.

Inputs: orders (required).

close_positionC

Close a position for an instrument via a market order.

Inputs: instId (required), marginMode (required), positionSide (required), clientOrderId, +1 more.

fund_transferB

Transfer funds between accounts (funding, futures, copy_trading, earn, spot, inverse_contract).

Inputs: currency (required), amount (required), fromAccount (required), toAccount (required), +3 more.

get_account_configA

Get account configuration including position mode, account level, etc.

Inputs: no named parameters.

get_algo_order_historyC

Get algo order history.

Inputs: orderType (required), instId, algoId, clientOrderId, +4 more.

get_apikey_infoA

Get API key information including permissions, IP whitelist, and expiration.

Inputs: no named parameters.

get_asset_balancesC

Get asset balances across different account types (funding, futures, etc.).

Inputs: accountType (required), currency.

get_balanceA

Get futures account balance details including equity, available balance, frozen amounts.

Inputs: productType.

get_candlesticksC

Get candlestick/kline data for an instrument.

Inputs: instId (required), bar, after, before, +1 more.

get_deposit_historyC

Get deposit history.

Inputs: currency, depositId, txId, state, +3 more.

get_fills_historyC

Get trade fill history for futures.

Inputs: instId, orderId, after, before, +3 more.

get_funding_rateB

Get current funding rate for instruments.

Inputs: instId.

get_funding_rate_historyB

Get historical funding rate data.

Inputs: instId (required), after, before, limit.

get_fund_transfer_historyB

Get fund transfer history between accounts.

Inputs: currency, fromAccount, toAccount, before, +2 more.

get_instrumentsA

Get available trading instruments. Returns contract specifications including min size, tick size, leverage limits.

Inputs: instId.

get_leverage_infoB

Get leverage info for an instrument.

Inputs: instId (required), marginMode (required).

get_margin_modeA

Get current account-level margin mode (cross or isolated).

Inputs: no named parameters.

get_mark_priceB

Get mark price and index price for instruments.

Inputs: instId.

get_open_ordersC

Get list of currently open/pending orders.

Inputs: instId, orderType, state, after, +2 more.

get_orderbookA

Get order book depth for an instrument.

Inputs: instId (required), size.

get_order_detailA

Get details of a specific order. Either orderId or clientOrderId or algoClientOrderId is required.

Inputs: instId (required), orderId, clientOrderId, algoClientOrderId.

get_order_historyC

Get order history.

Inputs: instId, orderType, state, after, +4 more.

get_pending_algo_ordersC

Get pending algo orders.

Inputs: instId, algoId, clientOrderId, orderType, +3 more.

get_pending_tpslB

Get pending take-profit/stop-loss orders.

Inputs: instId, tpslId, clientOrderId, after, +2 more.

get_position_modeA

Get current position mode (long_short_mode or net_mode).

Inputs: no named parameters.

get_positionsC

Get current open positions.

Inputs: instId.

get_tickersA

Get latest price snapshot, best bid/ask, and 24h trading volume for instruments.

Inputs: instId.

get_tpsl_historyB

Get take-profit/stop-loss order history.

Inputs: instId, tpslId, after, before, +1 more.

get_tradesB

Get recent trades for an instrument.

Inputs: instId (required), limit.

get_withdrawal_historyC

Get withdrawal history.

Inputs: currency, withdrawId, type, txId, +4 more.

place_algo_orderC

Place an algo order (trigger order).

Inputs: instId (required), marginMode (required), positionSide (required), side (required), +9 more.

place_orderC

Place a new futures order. Supports limit, market, post_only, fok, ioc order types.

Inputs: instId (required), marginMode (required), positionSide (required), side (required), +10 more.

place_tpslB

Place take-profit/stop-loss order for a position. Either tpTriggerPrice or slTriggerPrice (or both) must be provided.

Inputs: instId (required), marginMode (required), positionSide (required), side (required), +8 more.

set_leverageB

Set leverage for an instrument.

Inputs: instId (required), leverage (required), marginMode (required), positionSide.

set_margin_modeC

Set account-level margin mode.

Inputs: marginMode (required).

set_position_modeC

Set position mode.

Inputs: positionMode (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 40 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action, with clear separation between data retrieval (get_*), order placement (place_*), cancellation (cancel_*), and configuration (set_*). Even within similar categories like cancellations, the tool descriptions specify different order types or modes, avoiding ambiguity.

    Naming Consistency4/5

    Most tools follow a consistent verb_noun pattern with underscores (e.g., get_balance, place_order). Minor deviations like 'batch_orders' (noun phrase as command) and 'fund_transfer' (two nouns) are present, but the overall pattern is predictable and readable.

    Tool Count4/5

    With 40 tools, the set is comprehensive for a crypto exchange API covering orders, positions, account, market data, and transfers. While it is on the higher end, each tool serves a distinct purpose and is justified by the complexity of the domain.

    Completeness5/5

    The tool surface covers full lifecycle operations for orders (place, cancel, query), positions (close, leverage, margin mode), account configuration, market data (orderbook, candlesticks, tickers), transfers, and history. No obvious gaps are present for a typical futures trading workflow.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for the Crypto.com Exchange API, providing 86 dynamically generated tools for market data, trading, account management, and more with real-time WebSocket streaming and safety enforcement.
      48 npm
      27
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Exposes the full Gate API v4 to MCP clients with 384 tools for spot, futures, margin, wallet, and more. Supports both public endpoints (no auth) and authenticated trading operations.
      303 npm
      1
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI tools to execute trades and fetch market data across six crypto exchanges via natural language or API, with dual Telegram and MCP interfaces.
      2
      -
    • A
      license
      B
      quality
      B
      maintenance
      Provides 31 AI-powered crypto trading tools for Claude, Cursor, and any MCP client, enabling strategy creation, backtesting, bot deployment, copy trading, and portfolio management across multiple exchanges.
      34
      2,570 npm
      MIT