Bitget APIBitget API
UTAClassic
Legacy Doc
  • Overview
  • API Documentation
  • WebSocket
  • Agent Hub
  • SDK
  • Changelog
Copied to clipboard
Overview
Agent HubMCP ServerCLISkillSignalSDK
Agent Hub

Agent Hub

No need to open the exchange — say one sentence, and AI executes it directly in Claude, Cursor, or Codex on your Bitget account to trade stocks and crypto.

Runs as a local process on your device · API Key signed locally with HMAC-SHA256, never leaves your machine · MIT open source

Latest version

This document may not reflect the latest version. For the most recent changes, see the GitHub repository.

GitHub · Get API Key · Telegram

Table of Contents

Code
Bitget AgentHub │ ├── What it does ├── Choose your install path │ ├── Installation guides │ ├── MCP Server ← Claude Desktop / Cursor / Windsurf / Codex │ ├── CLI · bgc ← Claude Code / Codex CLI / OpenClaw │ ├── Skill ← Works with CLI, teaches AI when and how to call Bitget │ ├── Signal ← Real-time data + AI analysis, no account needed │ └── SDK ← For developers building custom integrations │ ├── Safety └── FAQ

What it does

Who it's for

AgentHub is built for anyone who wants to use AI to trade crypto and tokenized stocks: read charts · analyze markets · execute trades · manage accounts · build strategies · do research.

The frustrating part of using AI for trading isn't the strategy — it's the constant switching between AI and your exchange. Ask AI, then manually place the order. Check the chart, then switch back to chat. AgentHub removes that gap: say it once in your AI, and it handles the rest.

You say to AIWhat happens
"Buy 0.1 BTC at market" · "Open BTC long 10x leverage"Spot / futures order
"Check balance" · "Transfer 500 USDT to futures"Account query & fund transfer
"BTC price" · "4h candles" · "Funding rate"Live market data (no API Key needed)
"Fear or greed right now?" · "Any big news today?"Market analysis (no account needed)

Risk

AI can make mistakes. You are responsible for all orders placed. Always test with paper trading first.

Choose Your Install Path

Select based on the AI tool you use:

Overview

The install steps within each path are universal for all listed tools. For example, the CLI install command is identical for Claude Code, Codex CLI, and OpenClaw — it auto-detects which tools you have installed and deploys to all of them.

I use…Go toOne-line install
Claude Desktop · Cursor · Windsurf · ChatGPT Desktop · CodexMCP Servernpx -y @bitget-ai/bitget-agent-mcp
Claude Code · Codex CLI · OpenClawCLI · bgcnpx @bitget-ai/bitget-agent-installer upgrade-all --target all
Market analysis only, no tradingSignalnpx @bitget-ai/bitget-signal --target all
Not sure / want everythingFull suitenpx @bitget-ai/bitget-agent-installer upgrade-all --target all

Note

The MCP Server one-line command only starts the MCP process — it does not automatically write to your AI tool's config file. You still need to manually (or let AI) edit the config file. See the MCP Server section below for steps.

Prerequisite: Node.js ≥ 20 (run node -v to confirm)

MCP Server

When to use

If you use a GUI-based AI tool (Claude Desktop, Cursor, Windsurf, ChatGPT Desktop, Codex), this is your path. Every instruction you give in the chat is translated into a real operation on your Bitget account.

The install steps below work for all supported tools. The core command npx -y @bitget-ai/bitget-agent-mcp never changes — the only difference is where you put the config file. Find your tool in the Step 1 table.

Let AI Configure It For You (Recommended)

Paste the following directly into your AI and it will complete the setup automatically:

Code
Please configure the Bitget MCP Server for me (requires Node.js 20+): First ask which AI tool I'm using (Claude Desktop / Cursor / Windsurf / ChatGPT Desktop), then add a server launched with `npx -y @bitget-ai/bitget-agent-mcp` to that tool's MCP config, and fill in my BITGET_API_KEY, BITGET_SECRET_KEY, and BITGET_PASSPHRASE. Once done, confirm that the Bitget tools have loaded (I should see market, order, discover, etc.).

Manual Setup

Step 1 — Open your AI tool's config file:

ToolConfig file path
Claude Desktop (macOS)~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows)%APPDATA%\Claude\claude_desktop_config.json
CursorSettings → MCP → Add New Server
Windsurf / ContinueRefer to each tool's MCP documentation

Step 2 — Add the following config (no API Key yet? Go to API Management → Create API Key → enable Read + Trade permissions. Start with a Demo Key for paper trading):

Code
{ "mcpServers": { "bitget": { "command": "npx", "args": ["-y", "@bitget-ai/bitget-agent-mcp"], "env": { "BITGET_API_KEY": "your-api-key", "BITGET_SECRET_KEY": "your-secret-key", "BITGET_PASSPHRASE": "your-passphrase" } } } }

Step 3 — Fully quit and restart your AI tool.

Step 4 — Type What's the current BTC price? in your AI. If you get market data, the setup worked.

Adjust Mode As Needed

Append parameters to args to switch modes:

ScenarioAppend to argsNotes
Start with paper trading"--paper-trading"Uses Demo Key, no real funds
Query only, no orders"--read-only"Blocks all orders and transfers
Market data only, no API Key"--modules", "market"No API Key required

Example — read-only mode:

Code
"args": ["-y", "@bitget-ai/bitget-agent-mcp", "--read-only"]

Cursor users

Cursor supports ~40 MCP tools total. Bitget uses ~14 by default. If tools don't load fully, disable other MCPs or use --modules market to load only the market module.

Proxy Setup (If Needed)

If you need to route traffic through a VPN or proxy, add these variables to the env block in your MCP config (fill in your own proxy address):

Code
"env": { "BITGET_API_KEY": "your-api-key", "BITGET_SECRET_KEY": "your-secret-key", "BITGET_PASSPHRASE": "your-passphrase", "HTTPS_PROXY": "your-proxy-address", "NODE_USE_ENV_PROXY": "1" }

Why NODE_USE_ENV_PROXY

NODE_USE_ENV_PROXY=1 ensures Node.js network requests also route through the proxy — without it, some requests may bypass it.

What AI Can Do After Setup

ModuleLoaded by defaultOperations coveredAPI Key required
market✅Prices · candles · funding rate · order book · open interestNo
trade✅Place · cancel · amend orders · positions · strategy ordersYes
account✅Balances · transfers · deposits · withdrawals · sub-accountsYes
strategyOn demandTrigger orders · TP/SL · plan ordersYes
cryptoloansOn demandBorrow · repay · crypto-backed loansYes
taxOn demandTax record queriesYes

Load all modules: "args": ["-y", "@bitget-ai/bitget-agent-mcp", "--modules", "all"]

Try These

Code
What's the current BTC price? Show my USDT balance and open futures positions Open a BTC long on paper trading, 10x leverage, 0.01 BTC Check BTC price, then place a limit buy 2% below current price

CLI · bgc

When to use

If you use a terminal-based AI tool (Claude Code, Codex CLI, OpenClaw), or want to run commands directly in the terminal, this is your path.

The install steps below are universal for all supported tools. After running the install command, it auto-detects which tools you have and deploys to each — no need to repeat the process per tool.

Install

Paste into your terminal AI, or run directly in your terminal:

Code
Please run the following command to install the Bitget Agent Hub terminal tools (requires Node.js 20+): npx @bitget-ai/bitget-agent-installer upgrade-all --target all Once done, verify by running `bgc --version` and `bgc discover`, and show me the output.
TerminalCode
npx @bitget-ai/bitget-agent-installer upgrade-all --target all

This installs bgc CLI, the trading Skill, and the market analysis Skill, and deploys them to Claude Code / Codex / OpenClaw.

Set Up API Key

No API Key yet? Go to API Management → Create API Key → enable Read + Trade permissions. Save all three values: API Key, Secret Key, Passphrase. Start with a Demo Key and use --paper-trading before going live.

TerminalCode
export BITGET_API_KEY="your-api-key" export BITGET_SECRET_KEY="your-secret-key" export BITGET_PASSPHRASE="your-passphrase"

Tip

Add these three lines to ~/.zshrc or ~/.bashrc so you don't have to set them each session. Public market data requires no Key; account operations and trading require all three.

Verify Install

TerminalCode
bgc --version # check version bgc discover # list all available operations bgc market --action tickers --category SPOT --symbol BTCUSDT # test market data, no Key needed

Full Tool List

bgc covers all operations through 14 intent verbs:

VerbWhat it doesExample
marketPrices · candles · funding rate (public)bgc market --action tickers --symbol BTCUSDT
orderPlace · cancel · amend · query ordersbgc order --action place --side buy --qty 0.1
positionView positions · close · set leveragebgc position --action info --category linear
strategy_orderTrigger orders · TP/SLbgc strategy_order --action open
account_overviewAccount snapshot (assets + positions)bgc account_overview --coin USDT
transfer_fundsMove funds between accountsbgc transfer_funds --fromType spot --amount 100
depositDeposit address & historybgc deposit --action address --coin USDT
withdrawWithdraw (high-risk, needs --confirm)bgc withdraw --coin USDT --amount 100 --confirm
loanBorrow · repay crypto loansbgc loan --action borrow --coin USDT
subaccountManage sub-accountsbgc subaccount --action list
taxTax recordsbgc tax --action history --year 2024
discoverExplore all available operationsbgc discover --domain trade

Common Commands

TerminalCode
# Check account balance bgc account_overview --coin USDT # Preview an order (--dry-run won't actually send it) bgc order --action place --category SPOT --symbol BTCUSDT \ --side buy --orderType market --qty 0.001 --dry-run # View futures positions bgc position --category linear # Preview a fund transfer bgc transfer_funds --action transfer --fromType spot --toType mix_usdt \ --amount 100 --coin USDT --dry-run

Safety flags:

FlagEffect
--dry-runPreview the request, don't send it
--read-onlyBlock all write operations
--paper-tradingRoute to Bitget's demo environment
--confirmRequired for high-risk ops like withdraw

Proxy Setup

If you need to route traffic through a VPN or proxy:

TerminalCode
export HTTPS_PROXY="your-proxy-address"

Or override the API base URL:

TerminalCode
export BITGET_API_BASE_URL="https://api.bitget.com"

Try These

Code
What's the current BTC price? Check my USDT balance and transfer 500 USDT to my futures account Open a BTC long on paper trading, 10x leverage, 0.01 BTC Check my BTC positions — if I have none, open a 10x long on paper trading

Skill

When to use

Works with CLI · bgc. For Claude Code · Codex CLI · OpenClaw.

Skill is an instruction file installed into your AI tool that tells it when to call bgc, how to build the command, and how to prompt you for confirmation before any write operation. Without Skill, AI has the tool but doesn't know how to use it.

Skill is included automatically when you install via upgrade-all. To deploy separately:

TerminalCode
npx @bitget-ai/bitget-agent-skill --target all
--targetDeploys to
claudeClaude Code
codexCodex CLI
openclawOpenClaw
allAll of the above

Restart your AI tool after deploying.

Signal (No Account Needed)

No Bitget account. No API Key. Installation deploys 5 Skill files locally and registers a remote public MCP data service (https://datahub.noxiaohao.com/mcp) as the data source — AI analysis is based on real-time data returned by this service, not generated from thin air.

Five data directions:

You can ask…Data source & capability
"How does Fed policy affect BTC?"macro-analyst — live macro data, rates · yield curve · cross-asset correlation
"Are whales moving funds on-chain?"market-intel — on-chain flows · ETF net inflows · DeFi TVL
"What's the market sentiment right now?"sentiment-analyst — Fear & Greed Index · funding rates · long/short ratio
"Is BTC RSI overbought?"technical-analysis — pulls candle data and calculates 23 indicators
"Any major crypto news today?"news-briefing — aggregates 44 sources in real time (media · community · announcements)

Install

Paste into your AI, or run directly in your terminal:

Code
Please run `npx @bitget-ai/bitget-signal --target all` (requires Node.js 20+), install the Bitget market analysis Skills, then remind me to restart my AI tool.
TerminalCode
npx @bitget-ai/bitget-signal --target all

Restart your AI tool after installing, then ask away.

Technical analysis requires Python dependencies

The technical-analysis Skill depends on pandas and numpy. To use technical indicator features, run:

TerminalCode
pip install pandas numpy

SDK (For Developers)

When to use

If you're a developer building custom Bitget integrations — a custom MCP server, quant strategy, LLM tool-use pipeline, or automated trading bot — use the SDK directly.

Install

TerminalCode
npm install @bitget-ai/bitget-agent-sdk

Requirements: Node.js ≥ 20 · ESM only · zero runtime dependencies · TypeScript types included

Quick Start

Code
import { loadConfig, buildTools, BitgetRestClient, safeInvoke } from "@bitget-ai/bitget-agent-sdk"; // Start read-only — safe default const config = loadConfig({ modules: "all", readOnly: true }); const client = new BitgetRestClient(config); const tools = buildTools(config); const ctx = { config, client }; // Query public market data — no API Key needed const market = tools.find((t) => t.name === "market")!; const res = await safeInvoke(market, { action: "tickers", category: "SPOT", symbol: "BTCUSDT" }, ctx); if (res.ok) console.log(res.data); else console.error(res.error);

Config Options

OptionDefaultDescription
surface"intent""intent" curated verbs; "full" exposes all 1:1 ops
modules"account,trade,market"Comma-separated module names, or "all"
readOnlyfalseRemoves all write tools — AI cannot place orders
paperTradingfalseRoutes to Bitget Demo environment, no real funds
baseUrlhttps://api.bitget.comCan be overridden via BITGET_API_BASE_URL env var

Runtime Discovery

No need to memorize operation lists — use discover at runtime:

Code
const discover = tools.find((t) => t.name === "discover")!; await safeInvoke(discover, {}, ctx); // list all domains and tool counts await safeInvoke(discover, { domain: "trade" }, ctx); // tools in the trade domain await safeInvoke(discover, { tool: "market", action: "tickers" }, ctx); // exact contract for one action await safeInvoke(discover, { search: "funding" }, ctx); // keyword search

Error Handling

Use safeInvoke — never throws:

Code
const res = await safeInvoke(tool, args, ctx); if (res.ok) { // res.data } else { // res.error — ready to use as an LLM tool-call error response }

For fine-grained control, use typed errors:

Code
import { BitgetApiError, RateLimitError, ConfigError } from "@bitget-ai/bitget-agent-sdk"; try { await tool.handler(args, ctx); } catch (err) { if (err instanceof RateLimitError) { /* back off and retry */ } else if (err instanceof BitgetApiError) { console.error(err.code, err.message); } else if (err instanceof ConfigError) { /* missing or invalid credentials */ } }

Integration Testing

The SDK includes a built-in MockServer — no real API calls needed:

Code
import { MockServer } from "@bitget-ai/bitget-agent-sdk/testing"; import { loadConfig, BitgetRestClient } from "@bitget-ai/bitget-agent-sdk"; const mock = new MockServer(); await mock.start(); const config = loadConfig({ modules: "market", baseUrl: mock.baseUrl, apiKey: "test", secretKey: "test", passphrase: "test" }); const client = new BitgetRestClient(config); // write your tests against client ... await mock.stop();

More: agent-sdk

Safety

AgentHub is designed so your credentials never leave your machine: API Keys are read only from environment variables, all requests are signed locally with HMAC-SHA256 and sent directly to api.bitget.com — no middleware, no telemetry, no log uploads.

AgentHub has four built-in protection layers:

MechanismDescription
Paper trading--paper-trading routes all requests to Bitget's Demo environment — no real funds
Read-only mode--read-only removes all write tools at startup — AI physically cannot place orders or transfer funds
Dry-run mode--dry-run builds the full request but doesn't send it — verify parameters before executing
High-risk gateWithdrawals and cancel-all require explicit --confirm to prevent accidental AI triggers

Start with paper trading, verify everything behaves as expected, then switch to live. When creating an API Key, follow least-privilege: don't enable withdrawals unless you need them.

FAQ

Q: My AI tool isn't in the list — can I still use it?

A: Any client that supports the MCP protocol can connect via the MCP Server path. Any terminal AI that supports external command calls can use the bgc CLI.

Q: Does querying market data require an API Key?

A: No. Only account operations (checking balance, placing orders, transferring funds) require a Key.

Q: Will my API Key be exposed to the AI?

A: No. Keys are read only from local environment variables — they never appear in the conversation context and are never uploaded to any server.

Q: Bitget tools aren't fully loading in Cursor?

A: Cursor has a total limit of ~40 MCP tools. Disable other MCPs, or add --modules market to only load the market module.

Q: Will AI ask for confirmation before placing an order?

A: Yes. Skill guides AI to show a [CAUTION] prompt before any write operation and waits for your confirmation. High-risk operations like withdrawals also require the --confirm flag.

Q: Is it free?

A: AgentHub itself is MIT open source and free. Trading fees follow your Bitget account tier.

Q: Where do I report issues?

A: GitHub Issues · For security vulnerabilities, email security@bitget.com — do not post publicly.

Links

ResourceURL
Agent Hub (main)https://github.com/Bitget-AI/agent_hub
MCP Serverhttps://github.com/Bitget-AI/agent-mcp
CLI (bgc)https://github.com/Bitget-AI/agent-cli
Skillhttps://github.com/Bitget-AI/agent-skill
Signalhttps://github.com/Bitget-AI/bitget-signal
SDK (developers)https://github.com/Bitget-AI/agent-sdk
Bitget API Docshttps://www.bitget.com/api-doc/common/intro
API Key Managementhttps://www.bitget.com/en/api-management
Telegramhttps://telegram.me/+o1tYqQ_lXxllYjgy

Risk disclaimer

Crypto and tokenized-stock trading carries substantial risk. AI can make mistakes. You must verify all information yourself and accept full responsibility for outcomes. This tool does not constitute investment advice.

On this page
  • Table of Contents
  • What it does
  • Choose Your Install Path
  • MCP Server
    • Let AI Configure It For You (Recommended)
    • Manual Setup
    • Adjust Mode As Needed
    • Proxy Setup (If Needed)
    • What AI Can Do After Setup
    • Try These
  • CLI · bgc
    • Install
    • Set Up API Key
    • Verify Install
    • Full Tool List
    • Common Commands
    • Proxy Setup
    • Try These
  • Skill
  • Signal (No Account Needed)
    • Install
  • SDK (For Developers)
    • Install
    • Quick Start
    • Config Options
    • Runtime Discovery
    • Error Handling
    • Integration Testing
  • Safety
  • FAQ
  • Links
JSON
JSON
JSON
TypeScript
TypeScript
TypeScript
TypeScript
TypeScript