@bitget-ai/bitget-agent-skill 3.4.1 → 4.0.1

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.
@@ -0,0 +1,131 @@
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.1"
23
+ updated: "2026-11-18"
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. When an error carries `suggestions`, pick from those.
67
+
68
+ Parameters for `do_request_open_api` use Bitget UTA v3 names. The two that go wrong most:
69
+
70
+ - **`category`**, not `productType`: `SPOT`, `MARGIN`, `USDT-FUTURES`, `COIN-FUTURES`, or `USDC-FUTURES`. Most trade and account actions need it.
71
+ - **`qty`**, not `size`. It is in base coin (for example BTC), except spot / margin market buys and `COIN-FUTURES`, where it is in quote coin (for example USDT). Round it to the symbol's precision from `getInstruments`.
72
+
73
+ Not available through this MCP:
74
+
75
+ - Withdrawals, transfers from the main account into the sub-account, and changes to main-account email, phone, or 2FA.
76
+ - US stock direct, CFD, tax, staking / lending, and institutional lending.
77
+
78
+ If the balance is insufficient, the user deposits from the main account on the Bitget website.
79
+
80
+ ## Writes
81
+
82
+ Writes move real funds, so each one takes three steps:
83
+
84
+ 1. **Preview** with `dry_run: true`.
85
+ 2. **Show a confirmation card:** symbol, side, size with its unit (see `qty` above: "0.01 BTC" and "0.01 USDT" are different orders), price type, account, mainnet, liquidation price when available, and "Confirm execution?".
86
+ 3. **Execute** with `confirm: true` only after the user clearly replies "yes" or "confirm". "Just do it for me" is not confirmation. Pass `note` with the write: one sentence on why. It is kept with the record of the call.
87
+
88
+ The server refuses high-risk writes (cancel all, close all, countdown cancel-all, set leverage, repay, holding mode, account mode) without `confirm: true`.
89
+
90
+ **If a write returns `outcomeUnknown: true`, do not submit it again.** The exchange gave no readable answer, so the order may or may not exist, and a second submission can become a second order. Look it up with the `clientOid` from the result (`getOrderDetails`), or list open orders and positions, then tell the user what you found.
91
+
92
+ - Check positions before closing one.
93
+ - After a risk-type error, do not add size.
94
+ - Batch place, cancel, or modify (`batchOrder`, `batchCancel`, `batchModifyOrders`): pass `params` as a JSON array of order objects, or as `{"orderList": [...]}` / `{"orders": [...]}`.
95
+ - When rate limited, retry later. Do not re-authorize.
96
+
97
+ ## Account rules
98
+
99
+ - **One Agentic account is connected to one client at a time.** While an account is connected to one client (for example Codex), authorizing a different client (for example Cursor) for that account is refused with "already connected to another agent". Nothing is replaced, and the first client keeps working. The user picks or creates another Agentic account for this client, or disconnects the first client on the website.
100
+ - **Authorizing the same client again keeps the earlier login valid.** Two installs of the same client can therefore act on one account without seeing each other's chat. Check positions and open orders on the exchange before a write; do not rely on what you remember.
101
+ - **This client holds one login.** Authorizing it for a different account switches this client to that account. Anything it was watching on the old account stops, so warn the user before you switch and never switch the login silently.
102
+ - **Several agents can run at once,** each with its own Agentic account. If the user wants one agent to manage several accounts, or several clients on one account, point them to the [product feedback group](https://telegram.me/+o1tYqQ_lXxllYjgy). Use the same link for product-level questions this skill cannot answer.
103
+ - **Disconnecting** happens on the Bitget website, not through the MCP, and you cannot do it for the user. It ends every login on that account. Tell them:
104
+
105
+ > 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.
106
+
107
+ - **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.
108
+
109
+ ## Old setups
110
+
111
+ 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.
112
+
113
+ - **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).
114
+ - **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.
115
+
116
+ Cleaning up either kind is the user's job. Explain what to remove, and do not edit their config or delete files for them.
117
+
118
+ `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.
119
+
120
+ ## When something fails
121
+
122
+ 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.
123
+
124
+ ## Reference files
125
+
126
+ | File | Read it when |
127
+ |---|---|
128
+ | [references/first-time-setup.md](references/first-time-setup.md) | The three tools are missing, or the user is connecting for the first time |
129
+ | [references/authorization.md](references/authorization.md) | A private call is unauthorized, the user asks to re-authorize, or the client is Codex |
130
+ | [references/legacy-migration.md](references/legacy-migration.md) | Before opening authorization, or when old Bitget config is suspected |
131
+ | [references/troubleshooting.md](references/troubleshooting.md) | Any failure, or the user wants to delete an old account or API key |
@@ -0,0 +1,99 @@
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
+ - Client ids
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 if this client is already logged in:** authorizing switches this client to the account they pick. If that is a different account, ask them to deal with what this client was managing on the old one 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 this client created or connected through this flow before can be reused. An account that is connected to a different client is refused ("already connected to another agent"): the user picks or creates another account, or disconnects the other client on the website first.
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
+ ## Client ids
44
+
45
+ Any client that supports MCP with OAuth can connect; it does not have to be on a list. Do not tell the user their client is unsupported because it is missing here. Where a client lets you set its client id, use the one below, so Bitget recognizes the client:
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 client that is not in the table presents its own id or registers itself; nothing needs to be set by hand.
59
+
60
+ Keep the id the same from one authorization to the next. An id spelled differently counts as a different client, and the account then refuses it as "already connected to another agent".
61
+
62
+ ## Codex notes
63
+
64
+ These apply to Codex CLI and the Codex desktop app only. They are the standard path; if the real situation differs (version, proxy, config path), diagnose and adapt, because the goal is a working connection.
65
+
66
+ - **Version:** Codex 0.147 or later (`codex --version`). Upgrade first if it is older.
67
+ - **Register:**
68
+
69
+ ```bash
70
+ codex mcp add bitget-mcp-server --url https://agent.bitget.com/mcp --oauth-client-id codex
71
+ ```
72
+
73
+ No callback setting is needed. If `~/.codex/config.toml` already has `callback_url` and `callback_port` for this server, leave them; they still work.
74
+ - **Login:**
75
+
76
+ ```bash
77
+ codex mcp login bitget-mcp-server
78
+ ```
79
+
80
+ The command prints the authorization link, opens the browser, and waits for the callback. **Keep it running until the user has finished in the browser.** The link only works while this command is waiting, so do not stop the command, or let it time out, and hand the link over afterwards. Behind a proxy:
81
+
82
+ ```bash
83
+ HTTPS_PROXY=<proxy> HTTP_PROXY=<proxy> codex mcp login bitget-mcp-server
84
+ ```
85
+
86
+ - **No browser on this machine** (remote or headless): start the login in the background and give the user the link it printed. After they approve, their browser lands on an address that starts with `http://127.0.0.1:` or `http://localhost:` and cannot load, because the callback is waiting on this machine and not on theirs. Ask them to paste that full address, then request it here (for example `curl '<address>'`). The login command then finishes.
87
+ - **On the page:** "Create a new Agentic account" → tick the agreement boxes → Authorize.
88
+ - **New session:** Codex loads a newly registered server when the next session starts. `codex mcp list` shows whether the server is registered and logged in. After a first-time setup, ask the user to start a new session before trading.
89
+ - **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.
90
+
91
+ ## Network and proxy
92
+
93
+ 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.
94
+
95
+ 1. Look for a proxy that is already active in this environment. Do not assume a port or a config file.
96
+ 2. If there is one, route through it and open authorization again.
97
+ 3. If there is none, ask the user to turn one on, wait for them to confirm, then authorize.
98
+
99
+ Do not have the user click Allow again and again without checking the network first.
@@ -0,0 +1,88 @@
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. Stay in the current chat unless step 3 says a new session is needed.
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
+ Claude Code loads the server when the next session starts (step 3).
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. Use exactly `cursor` as its value, so the connection is recognized as 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
+ Nothing else needs to be configured. Codex loads the server when the next session starts (step 3); the login in step 5 is a shell command and can be done before that.
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.
65
+
66
+ - **Cursor and most other clients** load a newly registered server right away.
67
+ - **Claude Code and Codex** load it when the next session starts. If you registered the server in this session, the tools will not appear here. First do what does not need them: step 4, and in Codex also the login from step 5. Then ask the user to start a new session and send "continue the Bitget setup". In the new session, start again from this step.
68
+
69
+ If the tools are missing in a session that started after the server was registered:
70
+
71
+ 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".
72
+ 2. Only when there is no legacy config and the tools are still missing, ask the user to open a new chat and send:
73
+
74
+ ```
75
+ 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.
76
+ ```
77
+
78
+ Missing tools are a connection problem. Do not open authorization, install `@bitget-ai/bitget-agent-mcp`, or reinstall this skill to fix them.
79
+
80
+ ## 4. Check for legacy MCP config
81
+
82
+ Run the check in `legacy-migration.md` before opening authorization, even when the tools are already available.
83
+
84
+ ## 5. Authorize and verify
85
+
86
+ Follow `authorization.md`. Setup is complete only when a read-only account call succeeds; finishing the web page is not enough.
87
+
88
+ 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,43 @@
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
+ | Authorization is refused with "already connected to another agent" | The account is connected to a different client. A client id spelled differently counts as a different client, so in Cursor check that `auth.CLIENT_ID` in `mcp.json` is exactly `cursor`. Otherwise the user picks or creates another Agentic account, or disconnects the other client on the website. Do not retry the same account |
14
+ | The flow finishes but a private call still says not logged in | Wait a few seconds and retry the read-only call once. If it still fails, run one fresh authorization round |
15
+ | Codex: the authorization link does not complete | The `codex mcp login` command that printed it is no longer running. Run it again and keep it running until the user finishes ("Codex notes" in `authorization.md`) |
16
+ | 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 |
17
+ | 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 |
18
+ | KYC incomplete | Wait for the user to finish KYC, then authorize |
19
+ | Device verification failed | Ask the user to confirm it is the same Bitget App account, then authorize again. This is not token expiry |
20
+ | Cannot reach bitget.com (timeout, `ECONNREFUSED`, `ENOTFOUND`, `fetch failed`) | "Network and proxy" in `authorization.md` |
21
+ | 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 |
22
+ | 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 |
23
+ | Rate limited | Retry later. Do not re-authorize |
24
+ | `Parameter ... cannot be empty` (40019) or `Parameter verification failed` (400172) | A required parameter is missing or has an old name. Check `category` and `qty` ("Calling the MCP" in `SKILL.md`), then the action's detail from `guide(surface="open_api", operation_id=...)`. Do not re-authorize |
25
+ | `checkBDScale` / `checkScale` error on an order (40808) | `qty` has more decimals than the symbol allows. Read the precision with `getInstruments`, round down, preview again |
26
+ | `less than the minimum amount` (45110) | The order is below the symbol's minimum. Often `qty` was given in the wrong unit: a spot market buy takes quote coin. Tell the user the minimum; do not raise the size on your own |
27
+ | `The user must bind the phone or Google` (40016) | The user binds a phone number or Google Authenticator in their Bitget account security settings, then retries. You cannot do it for them |
28
+ | `Unknown action` | Use a name from the error's `suggestions`, or list the domain with `guide`. Do not guess again |
29
+ | A write returns `outcomeUnknown: true` | It may or may not have been executed. Do not submit it again. Look it up with the returned `clientOid` (`getOrderDetails`) or list open orders and positions, then tell the user what you found |
30
+ | A result has `retryable: true` (`upstreamUnreachable`, `upstreamTimeout`, `authUnavailable`) | Nothing changed. Retry in a few seconds. Do not re-authorize |
31
+ | Insufficient balance | The user deposits from the main account on the Bitget website |
32
+ | A risk-type error on an order | Report it. Do not add size |
33
+
34
+ Never work around a failure by installing the old stdio package or by asking the user to hand-fill an API key.
35
+
36
+ ## Deleting an old API key or account
37
+
38
+ 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.
39
+
40
+ 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.
41
+ 2. Tell the user:
42
+
43
+ > 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.
@@ -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`.