Binance MCP
Provides a security-first MCP interface to Binance, enabling public market-data requests across Spot, USDⓈ-M Futures, COIN-M Futures, Options, and Portfolio Margin, as well as GET-only signed account access and optional order management when explicitly enabled.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Binance MCPWhat's the current Bitcoin price?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Binance MCP
A security-first Model Context Protocol server for Binance.
It provides a compact surface instead of mirroring hundreds of Binance endpoints as individual MCP tools:
binance_public_request— GET any public Spot, USDⓈ-M Futures, COIN-M Futures, Options, or Portfolio Margin REST path.binance_account_request— signed GET-only account access using credentials stored on the server.binance_order_request— standard create/cancel Spot, Futures, and Options order operations, disabled unless the deployment explicitly enables trading.binance_simple_earn_subscribe— subscribe Spot/Funding funds into a specified Simple Earn Flexible product.binance_simple_earn_redeem— redeem a specified Simple Earn Flexible amount to Spot or Funding.binance_dual_investment_subscribe— subscribe Spot funds into one exact Dual Investment product after live product revalidation and optional quote guards.binance_dual_investment_positions— read normalized Dual Investment positions.binance_dual_investment_from_flexible_earn— guarded orchestration from Flexible Earn → Spot → one exact Dual Investment product while preserving a configured Earn balance.binance_auth_status— redacted capability status. It never returns secrets.
The generic public request tool keeps pace with Binance adding new market-data endpoints without forcing a new MCP schema for every endpoint. Financial writes deliberately do not use a generic signed POST tool: each supported write is a named, purpose-specific action.
Security model
There are two independent authentication boundaries:
MCP client → Binance MCP uses the owner-approved OAuth model from the NsTut MCP stack: authorization code flow, PKCE S256, dynamic client registration, short-lived access tokens, rotating refresh tokens, persisted hashed grants, strict redirect validation, and fail-closed MCP access.
Binance MCP → Binance uses a Binance API key plus HMAC secret, Ed25519 private key, or RSA private key. Credentials, signatures, and private keys stay server-side and are never returned by tools.
Binance Login OAuth2 is not used for ordinary self-hosting because Binance currently limits that program to approved ecosystem partners. If Binance broadens access later, it can be added as another credential provider without changing the MCP OAuth boundary.
Safe defaults
MCP refuses protected requests when OAuth is not configured.
Generic account access is GET-only.
Trading and financial writes are disabled unless
BINANCE_TRADING_ENABLED=trueis set by the deployment owner.Withdrawals are intentionally unsupported.
Full URLs are rejected. Requests are pinned to known Binance API hosts.
recvWindowdefaults to 5000 ms and may not exceed 60000 ms.Boolean query parameters are normalized to Binance-compatible lowercase
true/falsebefore encoding and signing.Non-ASCII request parameters are percent-encoded before signing, matching current Binance signed-endpoint requirements.
Dual Investment auto-compounding defaults to
NONE; Standard or Advanced compounding is never silently enabled.Dual Investment writes re-fetch the exact product before subscribing and can enforce
minimumAprandminimumStrikeDistancePercent.The Earn → Dual Investment orchestration supports
preserveEarnAmountand refuses to redeem funds that would push the remaining Flexible Earn balance below that floor.After redemption, the orchestration re-fetches the exact product and re-runs quote guards. If the product disappears or a guard fails, it leaves the redeemed funds in Spot and does not substitute another product.
Secret/key files are excluded by
.gitignoreand.dockerignore.
For account keys, prefer a dedicated Binance API key with only the permissions you need and IP restrictions where practical. Binance recommends Ed25519 keys for performance and security.
Related MCP server: binance-mcp
Supported API hosts
Product | Base URL |
Spot and SAPI |
|
USDⓈ-M Futures |
|
COIN-M Futures |
|
Options |
|
Portfolio Margin |
|
Portfolio Margin reads use product = portfolio_margin. Its UM, CM, and margin order families use different paths, so they are deliberately not collapsed into the standard binance_order_request tool.
Example public call:
product = spot
path = /api/v3/ticker/price
params = {"symbol":"BTCUSDT"}Example account call:
product = spot
path = /api/v3/account
params = {"omitZeroBalances":true}Financial write tools
These actions can move funds. They all require BINANCE_TRADING_ENABLED=true and a Binance API key with the permissions required by Binance.
Subscribe Simple Earn Flexible
binance_simple_earn_subscribe accepts a Flexible Earn productId, a positive decimal amount, optional autoSubscribe (default true), and optional sourceAccount (SPOT, FUND, or ALL; default SPOT).
Redeem Simple Earn Flexible
binance_simple_earn_redeem accepts a Flexible Earn productId, a positive decimal amount, and an optional destAccount. The default destination is SPOT.
Subscribe Dual Investment
binance_dual_investment_subscribe accepts the exact product id plus the explicit investment pair and direction (investCoin, exercisedCoin, optionType). The server re-fetches the live product and obtains the Binance orderId itself, preventing callers from supplying stale or arbitrary order ids.
Optional quote guards:
minimumApr: decimal APR floor, e.g.0.18means 18%.minimumStrikeDistancePercent: minimum live distance between spot and strike, e.g.2.0.autoCompoundPlan: defaults toNONE;STANDARDorADVANCEDare accepted only when the selected live product advertises that plan.
Read Dual Investment positions
binance_dual_investment_positions wraps Binance's signed position endpoint and normalizes position/order id, available product id, invest/exercised assets, deposit amount, strike, APR, settlement date, purchase status, direction, and auto-compound plan.
Flexible Earn → Dual Investment orchestration
binance_dual_investment_from_flexible_earn is the preferred user-facing workflow when the source funds are in Simple Earn Flexible:
Read the exact Flexible Earn position.
Confirm it is redeemable and the requested amount is available.
Enforce
preserveEarnAmount.Fetch and validate the exact Dual Investment product and optional quote guards.
Record the Spot free balance.
Redeem the requested amount to Spot.
Verify Spot received the funds.
Re-fetch the exact Dual Investment product and re-run all guards.
Subscribe only if the same product still passes.
Read positions and verify the resulting subscription.
If the product becomes unavailable or fails a guard after redemption, the workflow returns a partial-completion result with subscribed=false and leaves the funds in Spot. It does not automatically choose a substitute product or re-subscribe the funds to Simple Earn.
Configuration
Copy .env.example and provide the MCP OAuth values. For Binance account access, configure BINANCE_API_KEY and one signer:
BINANCE_API_SECRETfor HMAC, orBINANCE_PRIVATE_KEY_PATHfor Ed25519/RSA PEM, optionally withBINANCE_PRIVATE_KEY_PASSPHRASE.
Set BINANCE_TRADING_ENABLED=true only on deployments where named financial write tools should be enabled.
Do not paste Binance credentials into a chat conversation or commit them to Git.
Local run
python -m venv .venv
. .venv/bin/activate
pip install -e '.[test]'
pytest
uvicorn main:app --host 127.0.0.1 --port 8080The MCP endpoint is /mcp/; health is /health.
Docker
docker build -t binance-mcp .
docker run --rm -p 8080:8080 --env-file .env binance-mcpMount /app/data persistently so OAuth grants survive container replacement. If using an asymmetric Binance key, mount the private key read-only and point BINANCE_PRIVATE_KEY_PATH at it.
CI/CD
This public repository intentionally contains no GitHub Actions workflows and no production deployment configuration. NsTut's CI/CD lives in the private UpperMoon0/NsTut-CICD repository so deployment credentials, runner policy, and infrastructure topology stay outside the public source tree.
Scope
The public reader intentionally exposes REST GET endpoints rather than WebSocket streams. Account User Data Streams can be added later as bounded MCP resources if a concrete use case needs event streaming.
This project is not affiliated with or endorsed by Binance.
This server cannot be deployed
Maintenance
Related MCP Connectors
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Real-time crypto market data: candles, tickers, orderbooks across 13+ exchanges via MCP.
Market Data App MCP — wraps the Market Data App API (marketdata.app)
Binance - 340 tools for market data, order books, and trading pairs
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server for Binance USDT-M Futures trading — exposes tools for market data, account state, order management, and position/margin control.236Apache 2.0
- AlicenseAqualityBmaintenanceMCP server for Binance market data, account insights, and Convert workflows.108 npmMIT
- FlicenseNot gradedqualityDmaintenanceProvides cryptocurrency market data, account management, and trading on Binance USDT-M perpetual contracts via MCP, with a local audit system for transaction recording.-
- FlicenseNot gradedqualityDmaintenanceHosted MCP server that provides agent-ready access to Binance APIs, with tools mapped 1:1 to real endpoints, no auth required, supporting crypto trading and market data operations via natural language.-