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 · API Docs · 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, OAuth one-click connect │ ├── 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 │ ├── bitget-mcp-server ← US-stock, ETF, and analyst data, 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:

Fastest way to start

Paste this into your AI tool (Claude Code / Cursor, etc.) — it will read the docs and complete both Agentic account authorization and the full MCP/CLI install automatically:

Code
Please read 【https://www.bitget.com/support/articles/12560603894122】to complete Bitget Agentic account authorization, then run npx @bitget-ai/bitget-agent-installer upgrade-all --target all.

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 · Codex (OAuth one-click connect, no manual key needed)MCP 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
US-stock fundamentals, financials, or analyst data, no tradingbitget-mcp-serverclaude mcp add bitget-mcp-server --transport http https://agent.bitget.com/mcp
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)

Agentic Account

An Agentic account connects via OAuth and trades in a fund pool separate from your main account balance — a different connection method from manually configuring an API Key. Once authorized, MCP/CLI tools immediately get trading permission for that account, no key entry required.

Paste this directly into your AI — it will walk you through browser OAuth and install the matching tool:

Code
Please read 【https://www.bitget.com/support/articles/12560603894122】to complete Bitget Agentic account authorization and install the matching MCP.

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 read 【https://www.bitget.com/support/articles/12560603894122】to complete Bitget Agentic account authorization and install the corresponding MCP.

About This Authorization

Funds must be moved from your main account to your Agentic account via Web before trading — your AI can't do that transfer, and can't withdraw either. Once credentials are saved, trading tools work immediately, no Agent restart needed; if the connection drops or credentials expire, a full OAuth run is the only fix.

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 needed: the first time you use a trading tool after startup, the AI will automatically walk you through a browser OAuth authorization, and your credentials are issued by Bitget's server and saved locally:

Code
{ "mcpServers": { "bitget": { "command": "npx", "args": ["-y", "@bitget-ai/bitget-agent-mcp"] } } }

Step 3 — Fully quit and restart your AI tool.

Step 4 — Type What's the current BTC price? in your AI. Getting market data back confirms the basic setup worked. Ask something that needs trading permission next (e.g. check my account balance) and the AI will automatically open your browser to walk you through OAuth authorization — see "About This Authorization" above.

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 an env block to your MCP config (proxy networking only — unrelated to account authorization; fill in your own proxy address):

Code
"env": { "HTTPS_PROXY": "your-proxy-address, e.g. http://127.0.0.1:port", "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

Want to skip manual keys via OAuth instead? The CLI doesn't support that yet — use the MCP Server path above for one-click OAuth connection. 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

Full Tool List

bgc covers all operations through 12 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

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

bitget-mcp-server (New)

bitget-mcp-server is a separate, read-only data service covering US equities/ETF market data and company fundamentals — a different product from Signal (crypto macro/sentiment/technical/news data), with no shared data source or credentials. Like Signal, it needs no Bitget account or API Key.

CategoryCovers
Quotes & price historyReal-time and historical quotes, price history
Company fundamentalsCompany profile, management, financial statements, ratios, valuation
Corporate actionsDividends, insider transactions, major shareholders
Institutional & analyst data13F holdings, analyst price targets, forward estimates, consensus
ETFETF holdings and related data
News & sentimentNews and sentiment data

Access method

The MCP service is live and supports HTTP transport. For Claude Code:

TerminalCode
claude mcp add bitget-mcp-server --transport http https://agent.bitget.com/mcp

Other MCP clients that support HTTP transport (e.g. Cursor, Windsurf) can point to the same endpoint, https://agent.bitget.com/mcp, following their own docs. This MCP does not share an endpoint, package, or credentials with Signal.

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.

Agentic Account users

If you're connecting an Agentic account instead of a manually configured API Key, install the Agentic-specific Skill alongside @bitget-ai/bitget-agent-mcp — it covers OAuth-specific states (re-authorization, credential errors) that this manual-key Skill doesn't. See the Agentic Account section above.

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. Agentic Account credentials follow the same principle: they're stored locally by the MCP/SDK after OAuth and are never typed or pasted by the AI.

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; Agentic Account excludes withdrawals entirely

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: What's the difference between a manual API Key and an Agentic Account?

A: A manual API Key is created in Web and configured by you directly, sharing your main account balance. An Agentic Account connects via OAuth into an isolated fund domain, with credentials managed automatically by the MCP/SDK after you approve the connection.

Q: Can an Agentic Account withdraw funds?

A: No. Withdrawals and main-account operations must always be done manually in Web.

Q: Is bitget-mcp-server the same as Signal?

A: No. They are separate MCP servers. Signal covers crypto macro/sentiment/technical/news data; bitget-mcp-server covers US-listed equities, ETFs, and related fundamentals/analyst data.

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
bitget-mcp-serverhttps://agent.bitget.com/mcp
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/account/newapi
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
  • Agentic Account
  • MCP Server
    • Let AI Configure It For You (Recommended)
    • About This Authorization
    • 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
  • Signal (No Account Needed)
    • Install
  • bitget-mcp-server (New)
  • Skill
  • 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