@bitget-ai/bitget-agent-skill 4.0.0 → 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.
- package/CHANGELOG.md +27 -0
- package/README.md +9 -10
- package/VERSION +1 -1
- package/package.json +1 -1
- package/scripts/install.js +62 -17
- package/scripts/validate-skills.mjs +49 -0
- package/skills/bitget-agentic/SKILL.md +18 -9
- package/skills/bitget-agentic/references/authorization.md +21 -17
- package/skills/bitget-agentic/references/first-time-setup.md +9 -6
- package/skills/bitget-agentic/references/troubleshooting.md +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ All notable changes to `bitget-agent-skill` are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [4.0.1] - 2026-11-18
|
|
9
|
+
|
|
10
|
+
Corrections from the first days of 4.0.0 in real clients and from the server's
|
|
11
|
+
call logs. Publish after the authorization server with open admission is live:
|
|
12
|
+
the skill no longer tells a client that is not on a list that it is unsupported.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **Account rule.** 4.0.0 said that authorizing another agent for a connected account replaces the previous authorization. The server refuses it instead ("already connected to another agent") and the first client keeps working. `SKILL.md`, `authorization.md`, and `troubleshooting.md` now describe what happens and what the user can do.
|
|
17
|
+
- **Codex: the authorization link did not complete** in remote and headless environments, because the login command had exited by the time the user opened the link. The Codex notes now say to keep `codex mcp login` running, and how to finish the callback when the browser is on another machine.
|
|
18
|
+
- **Codex: the `localhost` callback setting is gone.** It was a workaround for a firewall rule that has been lifted. `codex mcp add` followed by `codex mcp login` is enough; existing `callback_url` settings keep working.
|
|
19
|
+
- **New session after registering.** Claude Code and Codex load a newly registered server at the start of the next session. `first-time-setup.md` said the tools appear right away, and also told Claude Code users to restart; it now says which clients need a new session and what to do before it.
|
|
20
|
+
- **Installer.** An unknown `--target` name stops the run instead of being skipped. An installed copy that differs from the new one is saved to `~/.bitget-agent-skill/backup/` before it is replaced. Old skill folders are reported for every client, not only the ones being installed to.
|
|
21
|
+
- **Publishing.** The publish step validates the skill again instead of skipping the check, the decrypted npm credentials are removed when publishing fails, and the validator compares the version in `VERSION`, `package.json`, `SKILL.md`, and the newest `CHANGELOG.md` entry.
|
|
22
|
+
- **README logo** removed: the image was not in the package and showed as broken on npm.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **Any MCP client with OAuth can connect.** The "supported clients" table is now a table of client ids to use where a client lets you set one. A client that is not listed is no longer told it is unsupported.
|
|
27
|
+
- **Writes carry a `note`:** one sentence on why, kept with the record of the call.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **`outcomeUnknown`.** When the exchange gives no readable answer to a write, the server returns `outcomeUnknown: true` with a `clientOid`. The skill says not to submit again and to look the order up first.
|
|
32
|
+
- **Parameter guidance, from the server call logs.** `SKILL.md` names the two parameters agents got wrong most (`category`, not `productType`; `qty`, not `size`), says which unit `qty` is in, and has the confirmation card show the unit. `troubleshooting.md` gains rows for the errors those mistakes produce (40019 / 400172, 40808, 45110), for 40016 (bind phone or Google first), for `Unknown action` with `suggestions`, and for results marked `retryable`.
|
|
33
|
+
- **Evaluation scenarios** for the spot market-buy unit, a precision error, an unknown outcome, suggestions after an unknown action, an account connected to another client, a headless Codex setup, and a client that is not in the table.
|
|
34
|
+
|
|
8
35
|
## [4.0.0] - 2026-11-16
|
|
9
36
|
|
|
10
37
|
The local API-key edition is discontinued, and the package is restructured to
|
package/README.md
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="assets/logo.png" alt="Bitget Agent Skill — connect AI agents to a Bitget Agentic account through the cloud MCP" width="120" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
1
|
<h1 align="center">bitget-agent-skill — Official Bitget AI Trading Skill</h1>
|
|
6
2
|
|
|
7
3
|
<p align="center">
|
|
@@ -61,7 +57,7 @@ graph LR
|
|
|
61
57
|
- **Three tools.** The MCP exposes `guide` (find what is available), `do_query` (market and reference data), and `do_request_open_api` (trading and account actions).
|
|
62
58
|
- **Market data needs no login.** Trading, account, and Reality / rToken actions need you to authorize once in the browser.
|
|
63
59
|
- **Login is an OAuth token held by your AI client's MCP connection.** It is not an API key, and it is not written into the skill files.
|
|
64
|
-
- **Writes are previewed first.** The skill has the AI preview a write with `dry_run`, show you a confirmation card, and only execute after you agree. High-risk actions such as cancel-all, close-all, set leverage, and repay also require an explicit `confirm` on the server.
|
|
60
|
+
- **Writes are previewed first.** The skill has the AI preview a write with `dry_run`, show you a confirmation card, and only execute after you agree. High-risk actions such as cancel-all, close-all, set leverage, and repay also require an explicit `confirm` on the server. When the exchange gives no answer to a write, the AI is told not to retry and to check whether the order exists.
|
|
65
61
|
- **Out of scope by design.** Withdrawals, transfers between main account and sub-account, and main-account security settings are not available through the MCP.
|
|
66
62
|
|
|
67
63
|
---
|
|
@@ -74,7 +70,7 @@ One skill, `bitget-agentic`, following the [Agent Skills](https://agentskills.io
|
|
|
74
70
|
|---|---|
|
|
75
71
|
| `SKILL.md` | The three tools, where to start, the `guide` → execute workflow, write safety, and account rules. |
|
|
76
72
|
| `references/first-time-setup.md` | Install the skill, register the MCP in each client, and check that the tools are available. |
|
|
77
|
-
| `references/authorization.md` | Opening authorization in each client,
|
|
73
|
+
| `references/authorization.md` | Opening authorization in each client, client ids, Codex notes, network and proxy. |
|
|
78
74
|
| `references/legacy-migration.md` | Detecting an old local Bitget MCP setup and what to tell the user. |
|
|
79
75
|
| `references/troubleshooting.md` | A failure table, and how to remove an old account. |
|
|
80
76
|
|
|
@@ -105,7 +101,7 @@ npx @bitget-ai/bitget-agent-skill@latest --interactive
|
|
|
105
101
|
| Cursor | `~/.cursor/skills/bitget-agentic/` |
|
|
106
102
|
| OpenClaw | `~/.openclaw/skills/bitget-agentic/` |
|
|
107
103
|
|
|
108
|
-
The installer replaces the whole `bitget-agentic` folder on each run. If an earlier version left a copy in `~/.codex/skills/`, it refreshes that copy too. `--skill` from older guides is still accepted and ignored.
|
|
104
|
+
The installer replaces the whole `bitget-agentic` folder on each run. When the installed copy differs from the new one, the old copy is saved to `~/.bitget-agent-skill/backup/` first, and the path is printed. If an earlier version left a copy in `~/.codex/skills/`, it refreshes that copy too. An unknown `--target` name stops the installer before anything is written. `--skill` from older guides is still accepted and ignored.
|
|
109
105
|
|
|
110
106
|
For an AI client without a skills directory, ask the agent to run the installer and read the `SKILL.md` path it prints.
|
|
111
107
|
|
|
@@ -141,7 +137,7 @@ codex mcp add bitget-mcp-server --url https://agent.bitget.com/mcp --oauth-clien
|
|
|
141
137
|
codex mcp login bitget-mcp-server
|
|
142
138
|
```
|
|
143
139
|
|
|
144
|
-
|
|
140
|
+
Any client that supports MCP with OAuth can connect. `references/authorization.md` inside the skill lists the client ids to use where a client lets you set one. In Codex, keep `codex mcp login` running until you have finished in the browser, and start a new session afterwards.
|
|
145
141
|
|
|
146
142
|
---
|
|
147
143
|
|
|
@@ -150,7 +146,7 @@ Authorization is limited to the clients listed in `references/authorization.md`
|
|
|
150
146
|
- **No API keys on your machine.** You approve access in the browser; the skill never asks you to create, paste, or store a key.
|
|
151
147
|
- **The skill files are inert.** Plain Markdown with no runtime process and no network access.
|
|
152
148
|
- **Scoped to an Agentic sub-account.** Withdrawals and main ↔ sub-account transfers are not exposed to the agent.
|
|
153
|
-
- **You can revoke at any time.** On the Bitget website go to "Sub-account management" → "Disconnect Agent". Clear open orders first.
|
|
149
|
+
- **You can revoke at any time.** On the Bitget website go to "Sub-account management" → "Disconnect Agent". Clear open orders first. This ends every login on that account.
|
|
154
150
|
|
|
155
151
|
---
|
|
156
152
|
|
|
@@ -204,6 +200,9 @@ No. Access is granted through browser authorization and can be revoked on the Bi
|
|
|
204
200
|
**Does the skill file need network access?**
|
|
205
201
|
No. It is Markdown. All requests are made by your AI client to the cloud MCP.
|
|
206
202
|
|
|
203
|
+
**Can I connect two AI clients to the same Agentic account?**
|
|
204
|
+
Not two different clients. An account is connected to one client at a time, and a second client is refused until you disconnect the first on the Bitget website. Give each client its own Agentic account.
|
|
205
|
+
|
|
207
206
|
**Can I still use `bgc` and the local API-key skill?**
|
|
208
207
|
No. That edition is no longer supported. See [Upgrading from 3.x](#upgrading-from-3x).
|
|
209
208
|
|
|
@@ -218,7 +217,7 @@ MIT-licensed and free to use.
|
|
|
218
217
|
npm run validate
|
|
219
218
|
```
|
|
220
219
|
|
|
221
|
-
checks `skills/` against the Agent Skills specification: the name matches its folder, the description is within 1,024 characters, the frontmatter uses only portable fields, the body stays under the size limits,
|
|
220
|
+
checks `skills/` against the Agent Skills specification: the name matches its folder, the description is within 1,024 characters, the frontmatter uses only portable fields, the body stays under the size limits, every reference file is linked from `SKILL.md`, and the version is the same in `VERSION`, `package.json`, `SKILL.md`, and the newest `CHANGELOG.md` entry. The build and the publish step run the same check.
|
|
222
221
|
|
|
223
222
|
`evals/` holds the scenarios the skill is expected to handle. Run them before and after changing the skill.
|
|
224
223
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.0.
|
|
1
|
+
4.0.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitget-ai/bitget-agent-skill",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"packageManager": "pnpm@8.14.1",
|
|
5
5
|
"description": "Official Bitget AI skill — teaches Claude Code, Codex, Cursor, OpenClaw and other AI agents to connect the Bitget cloud MCP (https://agent.bitget.com/mcp), authorize a Bitget Agentic account with browser OAuth, and trade or query from natural language. No local API keys. Run `npx @bitget-ai/bitget-agent-skill` to deploy into your AI tool's skill directory.",
|
|
6
6
|
"type": "module",
|
package/scripts/install.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* npx @bitget-ai/bitget-agent-skill --interactive # prompt to choose
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { cpSync, mkdirSync, existsSync, rmSync } from "node:fs";
|
|
16
|
-
import { join, dirname } from "node:path";
|
|
15
|
+
import { cpSync, mkdirSync, existsSync, rmSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
16
|
+
import { join, dirname, relative } from "node:path";
|
|
17
17
|
import { fileURLToPath } from "node:url";
|
|
18
18
|
import { homedir } from "node:os";
|
|
19
19
|
import { createInterface } from "node:readline";
|
|
@@ -25,6 +25,9 @@ const HOME = homedir();
|
|
|
25
25
|
const SKILL_NAME = "bitget-agentic";
|
|
26
26
|
const SKILL_SRC_DIR = join(PKG_ROOT, "skills", SKILL_NAME);
|
|
27
27
|
const DEFAULT_TARGET = "claude";
|
|
28
|
+
// Where a replaced copy is kept. Outside every skills directory, so a client
|
|
29
|
+
// never loads the old copy as a second skill.
|
|
30
|
+
const BACKUP_ROOT = join(HOME, ".bitget-agent-skill", "backup");
|
|
28
31
|
|
|
29
32
|
// Skill destinations per AI tool. Codex reads user skills from ~/.agents/skills,
|
|
30
33
|
// a location Cursor and OpenClaw also read.
|
|
@@ -59,29 +62,64 @@ const OBSOLETE_SKILL_DIRS = {
|
|
|
59
62
|
"the old first-time connect guide. It is now part of bitget-agentic and its copy is out of date",
|
|
60
63
|
};
|
|
61
64
|
|
|
62
|
-
function
|
|
65
|
+
function listFiles(dir, base = dir) {
|
|
66
|
+
const out = [];
|
|
67
|
+
for (const entry of readdirSync(dir)) {
|
|
68
|
+
const abs = join(dir, entry);
|
|
69
|
+
if (statSync(abs).isDirectory()) out.push(...listFiles(abs, base));
|
|
70
|
+
else out.push(relative(base, abs));
|
|
71
|
+
}
|
|
72
|
+
return out.sort();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// True when both folders hold the same files with the same content.
|
|
76
|
+
function sameContent(a, b) {
|
|
77
|
+
const filesA = listFiles(a);
|
|
78
|
+
const filesB = listFiles(b);
|
|
79
|
+
if (filesA.length !== filesB.length || filesA.some((f, i) => f !== filesB[i])) return false;
|
|
80
|
+
return filesA.every((f) => readFileSync(join(a, f)).equals(readFileSync(join(b, f))));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Returns where the previous copy was saved, or null when there was nothing to save.
|
|
84
|
+
function copySkill(skillsRoot, backupName) {
|
|
63
85
|
const dest = join(skillsRoot, SKILL_NAME);
|
|
64
86
|
mkdirSync(skillsRoot, { recursive: true });
|
|
87
|
+
let backup = null;
|
|
88
|
+
if (existsSync(dest) && !sameContent(dest, SKILL_SRC_DIR)) {
|
|
89
|
+
// The installed copy is an older version or was edited by the user. Keep
|
|
90
|
+
// one copy of it per location; the next run replaces that copy.
|
|
91
|
+
backup = join(BACKUP_ROOT, backupName);
|
|
92
|
+
rmSync(backup, { recursive: true, force: true });
|
|
93
|
+
mkdirSync(BACKUP_ROOT, { recursive: true });
|
|
94
|
+
cpSync(dest, backup, { recursive: true });
|
|
95
|
+
}
|
|
65
96
|
// Replace the whole folder so files removed in a newer version do not linger.
|
|
66
97
|
rmSync(dest, { recursive: true, force: true });
|
|
67
98
|
cpSync(SKILL_SRC_DIR, dest, { recursive: true });
|
|
68
|
-
return dest;
|
|
99
|
+
return { dest, backup };
|
|
69
100
|
}
|
|
70
101
|
|
|
71
102
|
function installTo(targetKey) {
|
|
72
103
|
const target = TARGETS[targetKey];
|
|
73
|
-
const
|
|
74
|
-
console.log(` ✓ ${target.label} → ${join(dest, "SKILL.md")}`);
|
|
104
|
+
const main = copySkill(target.skillsRoot, targetKey);
|
|
105
|
+
console.log(` ✓ ${target.label} → ${join(main.dest, "SKILL.md")}`);
|
|
106
|
+
if (main.backup) console.log(` previous copy saved to ${main.backup}`);
|
|
75
107
|
|
|
76
108
|
if (target.legacySkillsRoot && existsSync(join(target.legacySkillsRoot, SKILL_NAME))) {
|
|
77
|
-
const
|
|
78
|
-
console.log(` ✓ ${target.label} (older location) → ${join(
|
|
109
|
+
const legacy = copySkill(target.legacySkillsRoot, `${targetKey}-older-location`);
|
|
110
|
+
console.log(` ✓ ${target.label} (older location) → ${join(legacy.dest, "SKILL.md")}`);
|
|
111
|
+
if (legacy.backup) console.log(` previous copy saved to ${legacy.backup}`);
|
|
79
112
|
}
|
|
80
113
|
}
|
|
81
114
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
115
|
+
// Looks in every client's skills directory, not only the ones being installed
|
|
116
|
+
// to: an old skill left in any of them can still be picked up.
|
|
117
|
+
function reportObsolete() {
|
|
118
|
+
const roots = new Set();
|
|
119
|
+
for (const target of Object.values(TARGETS)) {
|
|
120
|
+
roots.add(target.skillsRoot);
|
|
121
|
+
if (target.legacySkillsRoot) roots.add(target.legacySkillsRoot);
|
|
122
|
+
}
|
|
85
123
|
for (const root of roots) {
|
|
86
124
|
for (const [dirName, why] of Object.entries(OBSOLETE_SKILL_DIRS)) {
|
|
87
125
|
const dir = join(root, dirName);
|
|
@@ -135,15 +173,22 @@ function parseTargets(args) {
|
|
|
135
173
|
const value = flagValue(args, "target");
|
|
136
174
|
if (!value) return null;
|
|
137
175
|
if (value === "all") return Object.keys(TARGETS);
|
|
138
|
-
const
|
|
176
|
+
const names = value
|
|
139
177
|
.split(",")
|
|
140
178
|
.map((s) => s.trim())
|
|
141
|
-
.filter(
|
|
142
|
-
|
|
143
|
-
|
|
179
|
+
.filter(Boolean);
|
|
180
|
+
// Own keys only: "constructor" and the like are not targets.
|
|
181
|
+
const unknown = names.filter((k) => !Object.hasOwn(TARGETS, k));
|
|
182
|
+
if (names.length === 0 || unknown.length > 0) {
|
|
183
|
+
// Nothing is installed: a misspelled name would otherwise leave one client
|
|
184
|
+
// without the skill and no sign of it.
|
|
185
|
+
console.error(
|
|
186
|
+
`Unknown target(s): ${unknown.join(", ") || value}. ` +
|
|
187
|
+
`Valid: ${Object.keys(TARGETS).join(", ")}, all. Nothing was installed.`
|
|
188
|
+
);
|
|
144
189
|
process.exit(1);
|
|
145
190
|
}
|
|
146
|
-
return
|
|
191
|
+
return [...new Set(names)];
|
|
147
192
|
}
|
|
148
193
|
|
|
149
194
|
// --skill is no longer needed: the package ships one skill. It is still
|
|
@@ -189,7 +234,7 @@ async function main() {
|
|
|
189
234
|
}
|
|
190
235
|
console.log(`\nDone — installed to ${ok} of ${targetKeys.length} target(s).`);
|
|
191
236
|
|
|
192
|
-
|
|
237
|
+
reportObsolete();
|
|
193
238
|
|
|
194
239
|
if (targetKeys.includes("claude")) {
|
|
195
240
|
console.log("\nClaude Code: restart Claude Code to pick up the skill.");
|
|
@@ -209,6 +209,45 @@ function validateSkill(dirName) {
|
|
|
209
209
|
return errors;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
// One version, written in four places. A release where they disagree publishes
|
|
213
|
+
// a package whose skill reports a different version than npm does.
|
|
214
|
+
function versionErrors(skillDirs) {
|
|
215
|
+
const errors = [];
|
|
216
|
+
const read = (file) => (existsSync(join(ROOT, file)) ? readFileSync(join(ROOT, file), "utf8") : null);
|
|
217
|
+
|
|
218
|
+
const versionFile = read("VERSION");
|
|
219
|
+
const version = versionFile === null ? null : versionFile.trim();
|
|
220
|
+
if (!version) return ["VERSION is missing or empty"];
|
|
221
|
+
if (!/^\d+\.\d+\.\d+$/.test(version)) errors.push(`VERSION is "${version}", expected x.y.z`);
|
|
222
|
+
|
|
223
|
+
const pkg = read("package.json");
|
|
224
|
+
if (pkg === null) {
|
|
225
|
+
errors.push("package.json is missing");
|
|
226
|
+
} else {
|
|
227
|
+
const pkgVersion = JSON.parse(pkg).version;
|
|
228
|
+
if (pkgVersion !== version) errors.push(`package.json version is ${pkgVersion}, VERSION is ${version}`);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
for (const dir of skillDirs) {
|
|
232
|
+
const skill = readFileSync(join(SKILLS_DIR, dir, "SKILL.md"), "utf8");
|
|
233
|
+
const found = skill.match(/^\s+version:\s*"([^"]+)"\s*$/m);
|
|
234
|
+
if (!found) errors.push(`skills/${dir}/SKILL.md has no metadata.version`);
|
|
235
|
+
else if (found[1] !== version) {
|
|
236
|
+
errors.push(`skills/${dir}/SKILL.md metadata.version is ${found[1]}, VERSION is ${version}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const changelog = read("CHANGELOG.md");
|
|
241
|
+
if (changelog !== null) {
|
|
242
|
+
const newest = changelog.match(/^## \[([^\]]+)\]/m);
|
|
243
|
+
if (!newest) errors.push("CHANGELOG.md has no version entry");
|
|
244
|
+
else if (newest[1] !== version) {
|
|
245
|
+
errors.push(`newest CHANGELOG.md entry is ${newest[1]}, VERSION is ${version}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return errors;
|
|
249
|
+
}
|
|
250
|
+
|
|
212
251
|
function main() {
|
|
213
252
|
if (!existsSync(SKILLS_DIR)) {
|
|
214
253
|
console.error("skills/ directory not found");
|
|
@@ -234,6 +273,16 @@ function main() {
|
|
|
234
273
|
console.error(`\n${failed} of ${dirs.length} skill(s) failed validation.`);
|
|
235
274
|
process.exit(1);
|
|
236
275
|
}
|
|
276
|
+
|
|
277
|
+
const mismatches = versionErrors(dirs);
|
|
278
|
+
if (mismatches.length) {
|
|
279
|
+
console.error(" ✗ version");
|
|
280
|
+
for (const e of mismatches) console.error(` - ${e}`);
|
|
281
|
+
console.error("\nThe version is not the same everywhere.");
|
|
282
|
+
process.exit(1);
|
|
283
|
+
}
|
|
284
|
+
console.log(` ✓ version ${readFileSync(join(ROOT, "VERSION"), "utf8").trim()} in VERSION, package.json, SKILL.md, CHANGELOG.md`);
|
|
285
|
+
|
|
237
286
|
console.log(`\nAll ${dirs.length} skill(s) are valid.`);
|
|
238
287
|
}
|
|
239
288
|
|
|
@@ -19,8 +19,8 @@ license: MIT
|
|
|
19
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
20
|
metadata:
|
|
21
21
|
author: "Bitget"
|
|
22
|
-
version: "4.0.
|
|
23
|
-
updated: "2026-11-
|
|
22
|
+
version: "4.0.1"
|
|
23
|
+
updated: "2026-11-18"
|
|
24
24
|
mcp-server: "https://agent.bitget.com/mcp"
|
|
25
25
|
---
|
|
26
26
|
|
|
@@ -63,7 +63,12 @@ Market data: guide(surface="market_data") → entry_id → do_query(e
|
|
|
63
63
|
Trade/account: guide(surface="open_api") → operation_id → do_request_open_api(operation_id, params)
|
|
64
64
|
```
|
|
65
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.
|
|
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`.
|
|
67
72
|
|
|
68
73
|
Not available through this MCP:
|
|
69
74
|
|
|
@@ -77,10 +82,12 @@ If the balance is insufficient, the user deposits from the main account on the B
|
|
|
77
82
|
Writes move real funds, so each one takes three steps:
|
|
78
83
|
|
|
79
84
|
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.
|
|
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`.
|
|
82
89
|
|
|
83
|
-
The
|
|
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.
|
|
84
91
|
|
|
85
92
|
- Check positions before closing one.
|
|
86
93
|
- After a risk-type error, do not add size.
|
|
@@ -89,9 +96,11 @@ The server refuses high-risk writes (cancel all, close all, set leverage, repay)
|
|
|
89
96
|
|
|
90
97
|
## Account rules
|
|
91
98
|
|
|
92
|
-
- **One Agentic account
|
|
93
|
-
- **
|
|
94
|
-
- **
|
|
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:
|
|
95
104
|
|
|
96
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.
|
|
97
106
|
|
|
@@ -7,14 +7,14 @@ Follow this when a private call returns unauthorized or HTTP 401, when the user
|
|
|
7
7
|
- Sequence
|
|
8
8
|
- Opening authorization, by client
|
|
9
9
|
- On the authorization page
|
|
10
|
-
-
|
|
10
|
+
- Client ids
|
|
11
11
|
- Codex notes
|
|
12
12
|
- Network and proxy
|
|
13
13
|
|
|
14
14
|
## Sequence
|
|
15
15
|
|
|
16
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
|
|
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
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
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
20
|
5. **Tell the user:**
|
|
@@ -37,12 +37,12 @@ If no window opens but a link is returned, open it with whatever this environmen
|
|
|
37
37
|
## On the authorization page
|
|
38
38
|
|
|
39
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.
|
|
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
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
42
|
|
|
43
|
-
##
|
|
43
|
+
## Client ids
|
|
44
44
|
|
|
45
|
-
|
|
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
46
|
|
|
47
47
|
| Client | `client_id` | How it is set |
|
|
48
48
|
|---|---|---|
|
|
@@ -55,33 +55,37 @@ Authorization is accepted only from these clients. If the current client is not
|
|
|
55
55
|
| Meta Muse | `muse` | The client's OAuth client id setting |
|
|
56
56
|
| MiniMax Code | `minimax` | `"auth": {"CLIENT_ID": "minimax"}` in `mcp.json` |
|
|
57
57
|
|
|
58
|
-
A
|
|
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".
|
|
59
61
|
|
|
60
62
|
## Codex notes
|
|
61
63
|
|
|
62
|
-
These apply to Codex CLI and the Codex desktop app only. They are the standard path; if the real situation differs (version, proxy
|
|
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.
|
|
63
65
|
|
|
64
66
|
- **Version:** Codex 0.147 or later (`codex --version`). Upgrade first if it is older.
|
|
65
|
-
- **
|
|
67
|
+
- **Register:**
|
|
66
68
|
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
```bash
|
|
70
|
+
codex mcp add bitget-mcp-server --url https://agent.bitget.com/mcp --oauth-client-id codex
|
|
71
|
+
```
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
|
75
78
|
```
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
- **Login:** `codex mcp login bitget-mcp-server`. The CLI opens the browser and handles the callback. Behind a proxy:
|
|
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:
|
|
79
81
|
|
|
80
82
|
```bash
|
|
81
83
|
HTTPS_PROXY=<proxy> HTTP_PROXY=<proxy> codex mcp login bitget-mcp-server
|
|
82
84
|
```
|
|
83
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.
|
|
84
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.
|
|
85
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.
|
|
86
90
|
|
|
87
91
|
## Network and proxy
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# First-time setup
|
|
2
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.
|
|
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
4
|
|
|
5
5
|
```
|
|
6
6
|
Setup progress:
|
|
@@ -31,9 +31,9 @@ There is one address: `https://agent.bitget.com/mcp`. Register it yourself, unde
|
|
|
31
31
|
claude mcp add -s user bitget-mcp-server --transport http https://agent.bitget.com/mcp
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Claude Code loads the server when the next session starts (step 3).
|
|
35
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
|
|
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
37
|
|
|
38
38
|
```json
|
|
39
39
|
{
|
|
@@ -52,7 +52,7 @@ Then the user quits and reopens `claude`.
|
|
|
52
52
|
codex mcp add bitget-mcp-server --url https://agent.bitget.com/mcp --oauth-client-id codex
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
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
56
|
|
|
57
57
|
**Other clients**
|
|
58
58
|
|
|
@@ -61,9 +61,12 @@ Codex needs a callback setting changed before login works. Read "Codex notes" in
|
|
|
61
61
|
|
|
62
62
|
## 3. Check that the tools are available
|
|
63
63
|
|
|
64
|
-
Call `guide()` in this chat.
|
|
64
|
+
Call `guide()` in this chat.
|
|
65
65
|
|
|
66
|
-
|
|
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:
|
|
67
70
|
|
|
68
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".
|
|
69
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:
|
|
@@ -10,7 +10,9 @@ Find the situation in the table and take the action. If nothing matches and the
|
|
|
10
10
|
| Not logged in, and the user wants to trade or query the account | Follow `authorization.md` |
|
|
11
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
12
|
| The user cancelled, or the callback did not complete | Say "Authorization was not completed. Should I start again?" |
|
|
13
|
-
|
|
|
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`) |
|
|
14
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 |
|
|
15
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 |
|
|
16
18
|
| KYC incomplete | Wait for the user to finish KYC, then authorize |
|
|
@@ -19,6 +21,13 @@ Find the situation in the table and take the action. If nothing matches and the
|
|
|
19
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 |
|
|
20
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 |
|
|
21
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 |
|
|
22
31
|
| Insufficient balance | The user deposits from the main account on the Bitget website |
|
|
23
32
|
| A risk-type error on an order | Report it. Do not add size |
|
|
24
33
|
|