本项目是 Binance MCP 服务器的使用说明文档,旨在帮助用户完成服务器的安装、配置和使用,同时提供错误处理、安全提示等方面的指导。
若要使用 Binance MCP 服务器,你可以按照以下步骤进行操作:
git clone https://github.com/yourusername/binance-mcp-server.git
cd binance-mcp-server
在项目根目录运行以下命令:
npm install
设置环境变量后启动:
node build/index.js
创建一个 .env 文件并添加以下内容:
BINANCE_API_KEY=your_api_key
BINANCE_API_SECRET=your_api_secret
将启动命令添加到 package.json 的 scripts 部分:
{
"scripts": {
"start": "set BINANCE_API_KEY=your_api_key & set BINANCE_API_SECRET=your_api_secret & node build/index.js",
...
}
}
使用 get_account 命令获取账户详情:
node index.js get_account
列出所有可交易资产:
node index.js list_assets
通过 market_data 模块获取实时市场信息,例如:
node index.js market_data --symbol=BTCUSDT
node index.js get_orders --symbol=BTCUSDT
node index.js cancel_order --order_id=12345
node index.js place_order --symbol=BTCUSDT --side=sell --quantity=0.01 --type=market
const { BinanceMcpServer } = require('binance-mcp-server');
async function main() {
const server = new BinanceMcpServer({
apiKey: process.env.BINANCE_API_KEY,
apiSecret: process.env.BINANCE_API_SECRET
});
await server.start();
}
main().catch(err => console.error(err));
BINANCE_API_KEY 和 BINANCE_API_SECRET 环境变量是必需的。
git clone https://github.com/yourusername/binance-mcp-server.git
cd binance-mcp-server
npm install
node build/index.js
npm run build
export BINANCE_API_KEY=your_api_key
export BINANCE_API_SECRET=your_api_secret
node build/index.js start --production
| 错误代码 | 描述 |
|---|---|
| 403 | 权限不足 |
| 500 | 内部服务器错误 |
| 429 | 请求次数超过限制 |
如需帮助或报告问题,请联系:support@binance.com