@bitget-ai/bitget-agent-skill 3.3.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +110 -123
- package/VERSION +1 -1
- package/package.json +7 -11
- package/scripts/install.js +123 -123
- package/scripts/validate-skills.mjs +240 -0
- package/skills/bitget-agentic/SKILL.md +122 -0
- package/skills/bitget-agentic/references/authorization.md +95 -0
- package/skills/bitget-agentic/references/first-time-setup.md +85 -0
- package/skills/bitget-agentic/references/legacy-migration.md +38 -0
- package/skills/bitget-agentic/references/troubleshooting.md +34 -0
- package/references/auth-setup.md +0 -54
- package/references/commands.md +0 -2387
- package/references/demo-trading.md +0 -58
- package/references/discover-guide.md +0 -112
- package/references/error-codes.md +0 -118
- package/references/trading-safety.md +0 -163
- package/scripts/gen-references.js +0 -266
- package/skills/agentic/SKILL.md +0 -195
- package/skills/uta/SKILL.md +0 -189
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bitget-agentic
|
|
3
|
+
description: >
|
|
4
|
+
Trades and queries on Bitget through the Bitget cloud MCP
|
|
5
|
+
(https://agent.bitget.com/mcp) with a Bitget Agentic account authorized by
|
|
6
|
+
browser OAuth, and handles connecting, authorizing, and disconnecting that
|
|
7
|
+
account. Use when the user asks for Bitget prices, K-lines, orders,
|
|
8
|
+
positions, or balances; wants to connect or re-authorize an Agentic account;
|
|
9
|
+
says Connect Agent; or reports that authorization expired or trading fails,
|
|
10
|
+
even without saying "Bitget". Chinese triggers: 连接 Agent、重新授权、
|
|
11
|
+
同意升级到新版MCP、Agentic 账户、Agent 子账户、Agent 账户、AI 账户、
|
|
12
|
+
智能交易账户、Key 失效、连不上、帮我下单、撤单、查行情、看K线、查持仓、查余额.
|
|
13
|
+
Also use when the user asks about the discontinued local setups (bgc, the old
|
|
14
|
+
UTA skill, BITGET_API_KEY environment variables, or the local stdio package
|
|
15
|
+
@bitget-ai/bitget-agent-mcp), to explain that they are discontinued and move
|
|
16
|
+
the user to the cloud MCP. Not for @bitget-ai/bitget-signal or its
|
|
17
|
+
market-data MCP.
|
|
18
|
+
license: MIT
|
|
19
|
+
compatibility: Requires an AI client that can connect remote HTTP MCP servers with OAuth, and network access to agent.bitget.com and bitget.com.
|
|
20
|
+
metadata:
|
|
21
|
+
author: "Bitget"
|
|
22
|
+
version: "4.0.0"
|
|
23
|
+
updated: "2026-11-16"
|
|
24
|
+
mcp-server: "https://agent.bitget.com/mcp"
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Bitget Agentic
|
|
28
|
+
|
|
29
|
+
The Bitget cloud MCP at `https://agent.bitget.com/mcp` lets an AI agent trade and query a Bitget **Agentic account** (a dedicated sub-account, formerly called Agent sub-account). The user logs in once in the browser. The login is an OAuth token held by this client's MCP connection.
|
|
30
|
+
|
|
31
|
+
There are no API keys in this flow. Never ask for, create, paste, or configure one (`BITGET_API_*`), and never copy the token into a file.
|
|
32
|
+
|
|
33
|
+
The server has exactly three tools. This skill registers the server as `bitget-mcp-server`:
|
|
34
|
+
|
|
35
|
+
| Tool | Purpose | Login needed |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `bitget-mcp-server:guide` | Discover what is available and get the id to call | No |
|
|
38
|
+
| `bitget-mcp-server:do_query` | Market and reference data, by `entry_id` | No |
|
|
39
|
+
| `bitget-mcp-server:do_request_open_api` | Bitget market, trading, and account actions, by `operation_id` | Trading, account, and Reality / rToken: yes. Market: no |
|
|
40
|
+
|
|
41
|
+
The rest of this skill writes the tool names without the server prefix. Anything else, including `mcp_auth`, is not a server tool.
|
|
42
|
+
|
|
43
|
+
Priorities, in order: safety, then a clear account state, then speed.
|
|
44
|
+
|
|
45
|
+
## Start here
|
|
46
|
+
|
|
47
|
+
1. **Are the three tools available in this chat?** Try `guide()`. If they are not, the MCP is not connected. That is a connection problem, not an authorization failure: follow [references/first-time-setup.md](references/first-time-setup.md).
|
|
48
|
+
2. **Does the request need login?** Market data does not, so answer it right away. For trading, account, or Reality requests, check login with one read-only account call:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
do_request_open_api(operation_id="getAccountAssets", params={})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
(`getDeductInfo` also works.) Success means logged in. An unauthorized or HTTP 401 result means not logged in: follow [references/authorization.md](references/authorization.md). Start authorization unless the user explicitly says not to. "Just check the market first" is not a refusal.
|
|
55
|
+
3. **Logged in:** use the two sections below.
|
|
56
|
+
|
|
57
|
+
If you were told to read this file right after installing it, read all of it and continue in the same chat.
|
|
58
|
+
|
|
59
|
+
## Calling the MCP
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Market data: guide(surface="market_data") → entry_id → do_query(entry_id, params)
|
|
63
|
+
Trade/account: guide(surface="open_api") → operation_id → do_request_open_api(operation_id, params)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Get every id from `guide`. Do not guess an `entry_id` or `operation_id`. If `guide` does not list something, tell the user it is not available.
|
|
67
|
+
|
|
68
|
+
Not available through this MCP:
|
|
69
|
+
|
|
70
|
+
- Withdrawals, transfers from the main account into the sub-account, and changes to main-account email, phone, or 2FA.
|
|
71
|
+
- US stock direct, CFD, tax, staking / lending, and institutional lending.
|
|
72
|
+
|
|
73
|
+
If the balance is insufficient, the user deposits from the main account on the Bitget website.
|
|
74
|
+
|
|
75
|
+
## Writes
|
|
76
|
+
|
|
77
|
+
Writes move real funds, so each one takes three steps:
|
|
78
|
+
|
|
79
|
+
1. **Preview** with `dry_run: true`.
|
|
80
|
+
2. **Show a confirmation card:** symbol, side, size, price type, account, mainnet, liquidation price when available, and "Confirm execution?".
|
|
81
|
+
3. **Execute** with `confirm: true` only after the user clearly replies "yes" or "confirm". "Just do it for me" is not confirmation.
|
|
82
|
+
|
|
83
|
+
The server refuses high-risk writes (cancel all, close all, set leverage, repay) without `confirm: true`.
|
|
84
|
+
|
|
85
|
+
- Check positions before closing one.
|
|
86
|
+
- After a risk-type error, do not add size.
|
|
87
|
+
- Batch place, cancel, or modify (`batchOrder`, `batchCancel`, `batchModifyOrders`): pass `params` as a JSON array of order objects, or as `{"orderList": [...]}` / `{"orders": [...]}`.
|
|
88
|
+
- When rate limited, retry later. Do not re-authorize.
|
|
89
|
+
|
|
90
|
+
## Account rules
|
|
91
|
+
|
|
92
|
+
- **One Agentic account pairs with one agent.** Authorizing this agent for a different account, or authorizing another agent for an account that is already connected, replaces the previous authorization. Anything an agent was monitoring on the old pairing may stop working, so warn the user before you switch and never switch the login silently.
|
|
93
|
+
- **Several agents can run at once,** each with its own Agentic account. If the user wants one agent to manage several accounts, point them to the [product feedback group](https://telegram.me/+o1tYqQ_lXxllYjgy). Use the same link for product-level questions this skill cannot answer.
|
|
94
|
+
- **Disconnecting** happens on the Bitget website, not through the MCP, and you cannot do it for the user. Tell them:
|
|
95
|
+
|
|
96
|
+
> Please go to "Sub-account management" on the web and use "Disconnect Agent". You must clear open orders before disconnecting. Funds can be transferred back in sub-account management; that step is not a prerequisite for disconnect.
|
|
97
|
+
|
|
98
|
+
- **Token validity** is judged only by an unauthorized or HTTP 401 result from a private call. Do not assume a lifetime, and do not describe it as an API key expiring. Once the token is invalid, stop trading and re-authorize first.
|
|
99
|
+
|
|
100
|
+
## Old setups
|
|
101
|
+
|
|
102
|
+
Two different things can be left on the user's machine. Do not raise either unless it blocks the current task or the user is about to use it.
|
|
103
|
+
|
|
104
|
+
- **Legacy MCP config** blocks the cloud MCP: a local stdio server running `@bitget-ai/bitget-agent-mcp`, or an MCP entry with hand-filled `BITGET_API_KEY` / `BITGET_SECRET_KEY` / `BITGET_PASSPHRASE`. Check for it before authorizing: [references/legacy-migration.md](references/legacy-migration.md).
|
|
105
|
+
- **Discontinued local tools** do not block anything, but must not be installed, recommended, or run: the `bgc` CLI (`@bitget-ai/bitget-agent-cli`), `@bitget-ai/bitget-agent-sdk` with `BITGET_API_*` environment variables, and the old UTA skill (a `bitget-agent-skill` folder in the client's skills directory). If the user asks for one, say it is discontinued and use the cloud MCP.
|
|
106
|
+
|
|
107
|
+
Cleaning up either kind is the user's job. Explain what to remove, and do not edit their config or delete files for them.
|
|
108
|
+
|
|
109
|
+
`npm` and `npx` are install channels, not old setups; this skill itself is installed with `npx`. `@bitget-ai/bitget-signal` and its market-data MCP are a separate, supported product: leave them alone.
|
|
110
|
+
|
|
111
|
+
## When something fails
|
|
112
|
+
|
|
113
|
+
Look the situation up in [references/troubleshooting.md](references/troubleshooting.md). If the cause is unclear, do not guess: tell the user what happened and ask whether to try again.
|
|
114
|
+
|
|
115
|
+
## Reference files
|
|
116
|
+
|
|
117
|
+
| File | Read it when |
|
|
118
|
+
|---|---|
|
|
119
|
+
| [references/first-time-setup.md](references/first-time-setup.md) | The three tools are missing, or the user is connecting for the first time |
|
|
120
|
+
| [references/authorization.md](references/authorization.md) | A private call is unauthorized, the user asks to re-authorize, or the client is Codex |
|
|
121
|
+
| [references/legacy-migration.md](references/legacy-migration.md) | Before opening authorization, or when old Bitget config is suspected |
|
|
122
|
+
| [references/troubleshooting.md](references/troubleshooting.md) | Any failure, or the user wants to delete an old account or API key |
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Authorization
|
|
2
|
+
|
|
3
|
+
Follow this when a private call returns unauthorized or HTTP 401, when the user asks to connect or re-authorize, or when the client is Codex.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- Sequence
|
|
8
|
+
- Opening authorization, by client
|
|
9
|
+
- On the authorization page
|
|
10
|
+
- Supported clients
|
|
11
|
+
- Codex notes
|
|
12
|
+
- Network and proxy
|
|
13
|
+
|
|
14
|
+
## Sequence
|
|
15
|
+
|
|
16
|
+
1. **Check for legacy MCP config** (`legacy-migration.md`). If you find any, send the reminder from that file and carry on. Stop only if the user explicitly says they do not want to upgrade.
|
|
17
|
+
2. **Warn the user:** authorizing replaces the token on this MCP connection. Ask them to deal with open positions and orders first.
|
|
18
|
+
3. **Open authorization** from the client, as described below. Tell the user a browser window will open and that no API key is involved. Never fill in passwords for them.
|
|
19
|
+
4. **Verify** with `do_request_open_api(operation_id="getAccountAssets", params={})` (or `getDeductInfo`). Finishing the web page is not proof of login. If the first attempt says `Authentication required`, wait a few seconds and retry once.
|
|
20
|
+
5. **Tell the user:**
|
|
21
|
+
|
|
22
|
+
> Authorization complete. An API Key will not be sent to you. Login state stays on the cloud MCP connection — you do not need to hand me any secret.
|
|
23
|
+
|
|
24
|
+
## Opening authorization, by client
|
|
25
|
+
|
|
26
|
+
The client opens authorization, not you. The client generates the request and receives the callback, so a link you assemble yourself cannot complete. Use any link exactly as the client or tool returns it, and never change the Bitget domain or the `redirect_uri`.
|
|
27
|
+
|
|
28
|
+
- **Cursor:** use the client's `mcp_auth` entry for this MCP (Connect / Authenticate). `mcp_auth` belongs to the client; it is not a server tool, so do not `tools/call` it on the server. Run one round only and do not click Authenticate repeatedly. The user logs in on the tab that just opened. If the page shows "Authorization session ended" while the callback URL already contains `code`, that session was invalidated: start one fresh round.
|
|
29
|
+
- **Codex:** run `codex mcp login bitget-mcp-server`. See "Codex notes" first.
|
|
30
|
+
- **Clients with no sign-in entry (including Claude Code):** make one private read-only call such as `getAccountAssets`. The 401 response makes the client start its own MCP login. If nothing happens, ask the user to sign in to this server in the client's MCP settings.
|
|
31
|
+
- **Clients with a native connector** (for example ChatGPT / Dot or Grok Bot): start the connector's own sign-in.
|
|
32
|
+
|
|
33
|
+
A client without `mcp_auth` is not disconnected. If the three server tools are present, only authorization is missing.
|
|
34
|
+
|
|
35
|
+
If no window opens but a link is returned, open it with whatever this environment uses to open a browser. If that also fails, send the link exactly as returned and say that this environment cannot open a window.
|
|
36
|
+
|
|
37
|
+
## On the authorization page
|
|
38
|
+
|
|
39
|
+
- **First authorization:** the user creates a new Agentic account. Accounts created by the old SDK or npm tools cannot be selected: choosing one fails, and Codex reports `invalid_request`.
|
|
40
|
+
- **Re-authorization:** an account created or connected through this flow before can be reused.
|
|
41
|
+
- **Account list full:** the user deletes a few unused old accounts, then creates a new one. Do not fall back to an old-SDK account.
|
|
42
|
+
|
|
43
|
+
## Supported clients
|
|
44
|
+
|
|
45
|
+
Authorization is accepted only from these clients. If the current client is not listed, tell the user it is not supported yet instead of retrying.
|
|
46
|
+
|
|
47
|
+
| Client | `client_id` | How it is set |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| Claude Code | `https://claude.ai/oauth/claude-code-client-metadata` | Automatic |
|
|
50
|
+
| Claude / Duet | `https://claude.ai/oauth/mcp-oauth-client-metadata` | Automatic |
|
|
51
|
+
| ChatGPT / Dot | `https://chatgpt.com/oauth/client.json` | Automatic |
|
|
52
|
+
| Cursor | `cursor` | `"auth": {"CLIENT_ID": "cursor"}` in `mcp.json` |
|
|
53
|
+
| Cursor (no `CLIENT_ID` set) / Grok Bot | `https://cursor.com/oauth/mcp-client.json` | Automatic |
|
|
54
|
+
| OpenAI Codex | `codex` | `--oauth-client-id codex` |
|
|
55
|
+
| Meta Muse | `muse` | The client's OAuth client id setting |
|
|
56
|
+
| MiniMax Code | `minimax` | `"auth": {"CLIENT_ID": "minimax"}` in `mcp.json` |
|
|
57
|
+
|
|
58
|
+
A wrong Cursor `CLIENT_ID` shows up as a flow that finishes but still reports not logged in, or as HTTP 403.
|
|
59
|
+
|
|
60
|
+
## Codex notes
|
|
61
|
+
|
|
62
|
+
These apply to Codex CLI and the Codex desktop app only. They are the standard path; if the real situation differs (version, proxy port, config path), diagnose and adapt, because the goal is a working connection.
|
|
63
|
+
|
|
64
|
+
- **Version:** Codex 0.147 or later (`codex --version`). Upgrade first if it is older.
|
|
65
|
+
- **Callback:** it must use `localhost` and a fixed port. `127.0.0.1` returns 403, and `localhost` without a port shows "localhost refused to connect". `codex mcp add` writes `127.0.0.1` by default, so edit `~/.codex/config.toml`:
|
|
66
|
+
|
|
67
|
+
```toml
|
|
68
|
+
[mcp_servers.bitget-mcp-server]
|
|
69
|
+
url = "https://agent.bitget.com/mcp"
|
|
70
|
+
|
|
71
|
+
[mcp_servers.bitget-mcp-server.oauth]
|
|
72
|
+
client_id = "codex"
|
|
73
|
+
callback_url = "http://localhost:59999/callback"
|
|
74
|
+
callback_port = 59999
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Any free port works, as long as `callback_url` and `callback_port` match.
|
|
78
|
+
- **Login:** `codex mcp login bitget-mcp-server`. The CLI opens the browser and handles the callback. Behind a proxy:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
HTTPS_PROXY=<proxy> HTTP_PROXY=<proxy> codex mcp login bitget-mcp-server
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- **On the page:** "Create a new Agentic account" → tick the agreement boxes → Authorize.
|
|
85
|
+
- **Desktop app:** it shares `~/.codex/config.toml` and the login state with the CLI. After one CLI login the app shows connected, with no extra click.
|
|
86
|
+
|
|
87
|
+
## Network and proxy
|
|
88
|
+
|
|
89
|
+
The authorization page and the callback both need to reach bitget.com. On a timeout, `ECONNREFUSED`, `ENOTFOUND`, a network or `fetch failed` error, or when the user says Bitget will not open, check the network before treating it as an authorization failure.
|
|
90
|
+
|
|
91
|
+
1. Look for a proxy that is already active in this environment. Do not assume a port or a config file.
|
|
92
|
+
2. If there is one, route through it and open authorization again.
|
|
93
|
+
3. If there is none, ask the user to turn one on, wait for them to confirm, then authorize.
|
|
94
|
+
|
|
95
|
+
Do not have the user click Allow again and again without checking the network first.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# First-time setup
|
|
2
|
+
|
|
3
|
+
Follow this when `guide`, `do_query`, and `do_request_open_api` are not available in the chat, or the user is connecting a Bitget Agentic account for the first time. Do everything in the current chat.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
Setup progress:
|
|
7
|
+
- [ ] 1. Skill installed and read
|
|
8
|
+
- [ ] 2. Cloud MCP registered in this client
|
|
9
|
+
- [ ] 3. guide() works in this chat
|
|
10
|
+
- [ ] 4. Legacy MCP config checked
|
|
11
|
+
- [ ] 5. Authorized and verified
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 1. Install the skill
|
|
15
|
+
|
|
16
|
+
Skip this step if you are already reading this file from an installed `bitget-agentic` skill.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @bitget-ai/bitget-agent-skill@latest --target all
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Read the `SKILL.md` path the installer prints, in full, yourself. Do not ask the user to open it. Keep `@latest`: versions before 4.0.0 install a discontinued skill by default.
|
|
23
|
+
|
|
24
|
+
## 2. Register the cloud MCP
|
|
25
|
+
|
|
26
|
+
There is one address: `https://agent.bitget.com/mcp`. Register it yourself, under the server name `bitget-mcp-server`. Do not change the domain and do not configure `BITGET_API_*`.
|
|
27
|
+
|
|
28
|
+
**Claude Code**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
claude mcp add -s user bitget-mcp-server --transport http https://agent.bitget.com/mcp
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then the user quits and reopens `claude`.
|
|
35
|
+
|
|
36
|
+
**Cursor** — merge this into `~/.cursor/mcp.json`. Keep the servers already there; do not overwrite the file. The key is `CLIENT_ID`, uppercase, and its value must be exactly `cursor`.
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"bitget-mcp-server": {
|
|
42
|
+
"url": "https://agent.bitget.com/mcp",
|
|
43
|
+
"auth": { "CLIENT_ID": "cursor" }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Codex (CLI and desktop)**
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
codex mcp add bitget-mcp-server --url https://agent.bitget.com/mcp --oauth-client-id codex
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Codex needs a callback setting changed before login works. Read "Codex notes" in `authorization.md` before step 5.
|
|
56
|
+
|
|
57
|
+
**Other clients**
|
|
58
|
+
|
|
59
|
+
- If the client has a custom MCP entry, register the same address its way.
|
|
60
|
+
- If it has no custom MCP entry but has a native connector or sign-in entry for this MCP (for example ChatGPT / Dot or Grok Bot), go straight to authorization. Not being able to add the URL by hand does not mean the client is unsupported, and is not a reason to ask the user to switch clients.
|
|
61
|
+
|
|
62
|
+
## 3. Check that the tools are available
|
|
63
|
+
|
|
64
|
+
Call `guide()` in this chat. In most clients the tools appear right away, so do not assume a new chat is needed.
|
|
65
|
+
|
|
66
|
+
If the tools are still missing:
|
|
67
|
+
|
|
68
|
+
1. The usual cause is legacy MCP config left in the same client. Run the check in `legacy-migration.md`, explain what you found, and guide the user through removing it. Do not just say "check again".
|
|
69
|
+
2. Only when there is no legacy config and the tools are still missing, ask the user to open a new chat and send:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
I added https://agent.bitget.com/mcp to my MCP config, but this chat still cannot call guide / do_query / do_request_open_api. Check whether an old @bitget-ai/bitget-agent-mcp server or a local MCP with hand-filled API keys is still configured. If so, tell me how to remove it, then confirm the new connection.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Missing tools are a connection problem. Do not open authorization, install `@bitget-ai/bitget-agent-mcp`, or reinstall this skill to fix them.
|
|
76
|
+
|
|
77
|
+
## 4. Check for legacy MCP config
|
|
78
|
+
|
|
79
|
+
Run the check in `legacy-migration.md` before opening authorization, even when the tools are already available.
|
|
80
|
+
|
|
81
|
+
## 5. Authorize and verify
|
|
82
|
+
|
|
83
|
+
Follow `authorization.md`. Setup is complete only when a read-only account call succeeds; finishing the web page is not enough.
|
|
84
|
+
|
|
85
|
+
Then return to `SKILL.md` for trading and queries.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Legacy MCP config
|
|
2
|
+
|
|
3
|
+
Run this check once before opening authorization, and whenever the three server tools are missing after the MCP was registered. It needs no state file and nothing to remember between chats: look at where the current client stores its MCP config.
|
|
4
|
+
|
|
5
|
+
## What counts as legacy
|
|
6
|
+
|
|
7
|
+
Either of these in the client's MCP config:
|
|
8
|
+
|
|
9
|
+
- A local stdio server that starts `@bitget-ai/bitget-agent-mcp`.
|
|
10
|
+
- An MCP entry with hand-filled `BITGET_API_KEY` / `BITGET_SECRET_KEY` / `BITGET_PASSPHRASE`.
|
|
11
|
+
|
|
12
|
+
Legacy config and the cloud MCP can sit in the same file without an error, but only one of them is recognized by the product. Keeping both causes calls to go to the wrong place, and the legacy entry is the usual reason the cloud tools do not appear.
|
|
13
|
+
|
|
14
|
+
## What does not count
|
|
15
|
+
|
|
16
|
+
- A config that contains only `https://agent.bitget.com/mcp`.
|
|
17
|
+
- This skill and its npm package, `@bitget-ai/bitget-agent-skill`.
|
|
18
|
+
- `@bitget-ai/bitget-signal` and its market-data MCP.
|
|
19
|
+
- The discontinued local tools listed in `SKILL.md` (`bgc`, the SDK with environment keys, the old UTA skill). They are not MCP config and do not block authorization.
|
|
20
|
+
|
|
21
|
+
## How to check
|
|
22
|
+
|
|
23
|
+
- Read the MCP config of the current client. Do not assume a fixed path.
|
|
24
|
+
- Judge only by the two items above. Which npm packages are installed is not evidence, so do not run `npm list` or `npm view`, and do not look packages up online.
|
|
25
|
+
- If you cannot find the config, do not conclude there is nothing. Tell the user you could not find it and ask whether this machine still has the old stdio package or a local MCP with hand-filled keys. If they say no, continue. If they are unsure or say yes, treat it as found.
|
|
26
|
+
|
|
27
|
+
## If you find legacy config
|
|
28
|
+
|
|
29
|
+
1. From now on use only the three cloud tools and the client's sign-in entry for the cloud MCP. Do not call tools from the old stdio server, and do not use API keys the old setup left behind.
|
|
30
|
+
2. Send the user this reminder:
|
|
31
|
+
|
|
32
|
+
> This computer's MCP config still has the old local stdio MCP package (@bitget-ai/bitget-agent-mcp), or a local MCP with hand-filled API Keys. Old and new cannot be used together — please clear the old config soon and upgrade to this cloud version, which uses OAuth login and no longer issues or requires hand-filled API Keys. Clearing old config is on you; I will not edit config files for you.
|
|
33
|
+
>
|
|
34
|
+
> Agentic accounts created by the old SDK / npm are not compatible with the new OAuth — selecting an existing sub-account on the auth page will fail. After the auth window opens, create a new account the first time you use the new OAuth — do not pick an old account. If you already connected an account with the new OAuth before and this is only a re-authorization, reuse that account. If the account list is full, delete a few unused old accounts first, then create a new one.
|
|
35
|
+
>
|
|
36
|
+
> Before continuing authorization, please finish handling positions and open orders in the old account, so monitoring and pending orders do not silently fail after the upgrade.
|
|
37
|
+
|
|
38
|
+
3. Continue to authorization. You do not need the user to reply "agree to upgrade" first. Stop, and do not open authorization, only if the user explicitly says they do not want to upgrade or deal with the old setup.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Find the situation in the table and take the action. If nothing matches and the cause is unclear, do not guess: tell the user what happened and ask whether to try again.
|
|
4
|
+
|
|
5
|
+
## Failure table
|
|
6
|
+
|
|
7
|
+
| Situation | Action |
|
|
8
|
+
|---|---|
|
|
9
|
+
| The three server tools are missing | Connection problem: follow `first-time-setup.md` from "Check that the tools are available". Do not open authorization, install `@bitget-ai/bitget-agent-mcp`, or reinstall this skill |
|
|
10
|
+
| Not logged in, and the user wants to trade or query the account | Follow `authorization.md` |
|
|
11
|
+
| A private call returns unauthorized or HTTP 401, or the user disconnected on the web | The token is invalid. Stop trading and follow `authorization.md` |
|
|
12
|
+
| The user cancelled, or the callback did not complete | Say "Authorization was not completed. Should I start again?" |
|
|
13
|
+
| Cursor: the flow finishes but still shows not logged in, or returns 403 | `auth.CLIENT_ID` in `mcp.json` is not exactly `cursor`. Fix it and run one fresh round |
|
|
14
|
+
| Selecting an existing account on the authorization page fails | The account was created by the old SDK or npm tools. The user creates a new account |
|
|
15
|
+
| Account list full | The user deletes a few unused old accounts, then creates a new one. Do not fall back to an old-SDK account |
|
|
16
|
+
| KYC incomplete | Wait for the user to finish KYC, then authorize |
|
|
17
|
+
| Device verification failed | Ask the user to confirm it is the same Bitget App account, then authorize again. This is not token expiry |
|
|
18
|
+
| Cannot reach bitget.com (timeout, `ECONNREFUSED`, `ENOTFOUND`, `fetch failed`) | "Network and proxy" in `authorization.md` |
|
|
19
|
+
| The authorization page returns JSON 422 and OAuth parameters such as `response_type`, `client_id`, `redirect_uri`, `state`, or `code_challenge` are missing | The web login redirect dropped the parameters; the MCP is fine. Run one fresh authorization round. If it repeats, the user clears the site's login state and tries again |
|
|
20
|
+
| The token exchange returns 403 with an HTML body | Usually a web firewall block, not an application error. Tell the user; do not treat it as an expired token |
|
|
21
|
+
| Rate limited | Retry later. Do not re-authorize |
|
|
22
|
+
| Insufficient balance | The user deposits from the main account on the Bitget website |
|
|
23
|
+
| A risk-type error on an order | Report it. Do not add size |
|
|
24
|
+
|
|
25
|
+
Never work around a failure by installing the old stdio package or by asking the user to hand-fill an API key.
|
|
26
|
+
|
|
27
|
+
## Deleting an old API key or account
|
|
28
|
+
|
|
29
|
+
The cloud MCP flow has no API key to delete, and a key cannot be deleted on its own on the website. The user removes the whole Agentic account instead. You cannot delete it for them.
|
|
30
|
+
|
|
31
|
+
1. Get the account name with `getAccountAssets` or another read-only account call. If the user is not logged in, authorize first so they do not delete blindly. If you cannot find the name, say so; do not invent one.
|
|
32
|
+
2. Tell the user:
|
|
33
|
+
|
|
34
|
+
> To remove the old API Key for account "{name}", you must first clear unfinished orders and transfer assets out, then manually delete this Agentic sub-account on the web. I cannot delete it for you.
|
package/references/auth-setup.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Bitget API Authentication Setup
|
|
2
|
-
|
|
3
|
-
Public market data (`bgc market ...`, `bgc discover`) needs no credentials.
|
|
4
|
-
Account, trading, transfer, and withdrawal operations are private and require
|
|
5
|
-
API credentials.
|
|
6
|
-
|
|
7
|
-
## Environment variables (recommended)
|
|
8
|
-
|
|
9
|
-
Set all three before running `bgc` — they must be provided together:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
export BITGET_API_KEY="your-api-key"
|
|
13
|
-
export BITGET_SECRET_KEY="your-secret-key"
|
|
14
|
-
export BITGET_PASSPHRASE="your-passphrase"
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Providing only some of them is an error (`Partial API credentials detected`).
|
|
18
|
-
|
|
19
|
-
## Optional environment variables
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
export BITGET_API_BASE_URL="https://api.bitget.com" # override the API host
|
|
23
|
-
export BITGET_TIMEOUT_MS="15000" # per-request timeout (default 15000)
|
|
24
|
-
export BITGET_MAX_RETRIES="3" # transient-error retries
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Get API credentials
|
|
28
|
-
|
|
29
|
-
1. Log in to https://www.bitget.com
|
|
30
|
-
2. Go to **Settings → API Management**
|
|
31
|
-
3. Create a new API key with the permissions you need:
|
|
32
|
-
- **Read Only** — market data and account queries
|
|
33
|
-
- **Trade** — placing/cancelling orders, transfers
|
|
34
|
-
- **Withdraw** — only if you intend to withdraw (and whitelist your IP)
|
|
35
|
-
|
|
36
|
-
## Verify
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
bgc account_overview # private — confirms credentials work
|
|
40
|
-
bgc market --action tickers --category SPOT --symbol BTCUSDT # public — no creds needed
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
If credentials are missing or wrong, the error payload's `error.category` is `auth`
|
|
44
|
-
and `error.suggestion` tells you which credential to fix.
|
|
45
|
-
|
|
46
|
-
## Read-only mode
|
|
47
|
-
|
|
48
|
-
To block every write for a session (reads still work):
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
bgc --read-only order --action open --category SPOT --symbol BTCUSDT
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
`--read-only` is mutually exclusive with `--paper-trading`.
|