mexc-openapi-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMEXC Spot API Skill
MEXC现货API Skill
Use this skill to run MEXC Spot REST operations through + OpenAPI.
uxcReuse the skill for shared execution, auth, and error-handling guidance.
uxc使用此Skill通过 + OpenAPI执行MEXC现货REST操作。
uxc复用 Skill以实现共享执行、认证和错误处理指引。
uxcPrerequisites
前置条件
- is installed and available in
uxc.PATH - Network access to .
https://api.mexc.com - Access to the curated OpenAPI schema URL:
https://raw.githubusercontent.com/holon-run/uxc/main/skills/mexc-openapi-skill/references/mexc-spot.openapi.json
- 已安装并可在
uxc中访问。PATH - 可访问网络。
https://api.mexc.com - 可访问精选OpenAPI schema的URL:
https://raw.githubusercontent.com/holon-run/uxc/main/skills/mexc-openapi-skill/references/mexc-spot.openapi.json
Scope
适用范围
This skill covers a curated MEXC Spot REST surface for:
- public market reads
- signed account reads
- signed order create, cancel, and lookup flows
This skill does not cover:
- futures APIs
- broader platform product families
此Skill涵盖精选的MEXC现货REST操作,包括:
- 公开市场数据读取
- 签名账户数据读取
- 签名订单的创建、取消和查询流程
此Skill 不涵盖:
- 期货API
- 更广泛的平台产品系列
Authentication
认证
Public market endpoints do not require credentials.
Signed Spot endpoints require:
- field for
api_keyX-MEXC-APIKEY - field for HMAC SHA256 query signing
secret_key
Create one credential:
bash
uxc auth credential set mexc-spot \
--auth-type api_key \
--field api_key=env:MEXC_API_KEY \
--field secret_key=env:MEXC_SECRET_KEYAdd one signer binding:
bash
uxc auth binding add \
--id mexc-spot \
--host api.mexc.com \
--path-prefix /api/v3 \
--scheme https \
--credential mexc-spot \
--signer-json '{"kind":"hmac_query_v1","algorithm":"hmac_sha256","signing_field":"secret_key","key_field":"api_key","key_placement":"header","key_name":"X-MEXC-APIKEY","signature_param":"signature","signature_encoding":"hex","timestamp_param":"timestamp","timestamp_unit":"milliseconds","canonicalization":{"mode":"preserve_order"}}' \
--priority 100Validate the active mapping when auth looks wrong:
bash
uxc auth binding match https://api.mexc.com/api/v3/account公开市场端点无需凭证。
签名现货端点需要:
- 字段,用于
api_keyX-MEXC-APIKEY - 字段,用于HMAC SHA256请求签名
secret_key
创建凭证:
bash
uxc auth credential set mexc-spot \
--auth-type api_key \
--field api_key=env:MEXC_API_KEY \
--field secret_key=env:MEXC_SECRET_KEY添加签名绑定:
bash
uxc auth binding add \
--id mexc-spot \
--host api.mexc.com \
--path-prefix /api/v3 \
--scheme https \
--credential mexc-spot \
--signer-json '{"kind":"hmac_query_v1","algorithm":"hmac_sha256","signing_field":"secret_key","key_field":"api_key","key_placement":"header","key_name":"X-MEXC-APIKEY","signature_param":"signature","signature_encoding":"hex","timestamp_param":"timestamp","timestamp_unit":"milliseconds","canonicalization":{"mode":"preserve_order"}}' \
--priority 100当认证出现问题时,验证当前映射:
bash
uxc auth binding match https://api.mexc.com/api/v3/accountCore Workflow
核心工作流
-
Use the fixed link command by default:
command -v mexc-openapi-cli- If missing, create it:
uxc link mexc-openapi-cli https://api.mexc.com --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/mexc-openapi-skill/references/mexc-spot.openapi.json mexc-openapi-cli -h
-
Inspect operation help before execution:
mexc-openapi-cli get:/api/v3/ticker/price -hmexc-openapi-cli get:/api/v3/account -hmexc-openapi-cli post:/api/v3/order -h
-
Prefer public reads first:
mexc-openapi-cli get:/api/v3/ticker/price symbol=BTCUSDTmexc-openapi-cli get:/api/v3/depth symbol=BTCUSDT limit=20
-
Use signed reads before writes:
mexc-openapi-cli get:/api/v3/account recvWindow=5000mexc-openapi-cli get:/api/v3/openOrders symbol=BTCUSDT recvWindow=5000
-
默认使用固定链接命令:
command -v mexc-openapi-cli- 若未找到,创建链接:
uxc link mexc-openapi-cli https://api.mexc.com --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/mexc-openapi-skill/references/mexc-spot.openapi.json mexc-openapi-cli -h
-
执行前查看操作帮助:
mexc-openapi-cli get:/api/v3/ticker/price -hmexc-openapi-cli get:/api/v3/account -hmexc-openapi-cli post:/api/v3/order -h
-
优先使用公开读取操作:
mexc-openapi-cli get:/api/v3/ticker/price symbol=BTCUSDTmexc-openapi-cli get:/api/v3/depth symbol=BTCUSDT limit=20
-
先使用签名读取操作,再执行写入操作:
mexc-openapi-cli get:/api/v3/account recvWindow=5000mexc-openapi-cli get:/api/v3/openOrders symbol=BTCUSDT recvWindow=5000
Operation Groups
操作分组
Public Market
公开市场
get:/api/v3/pingget:/api/v3/exchangeInfoget:/api/v3/ticker/priceget:/api/v3/ticker/24hrget:/api/v3/depth
get:/api/v3/pingget:/api/v3/exchangeInfoget:/api/v3/ticker/priceget:/api/v3/ticker/24hrget:/api/v3/depth
Signed Reads
签名读取
get:/api/v3/accountget:/api/v3/openOrdersget:/api/v3/order
get:/api/v3/accountget:/api/v3/openOrdersget:/api/v3/order
Signed Writes
签名写入
post:/api/v3/orderdelete:/api/v3/order
post:/api/v3/orderdelete:/api/v3/order
Guardrails
防护机制
- Keep automation on the JSON output envelope; do not use .
--text - Parse stable fields first: ,
ok,kind,protocol,data.error - Treat signed write operations as high-risk and require explicit confirmation before execution.
- and
timestampare injected by the signer binding; users normally provide business parameters plus optionalsignature.recvWindow - Query before placing orders so symbol filters and lot sizes are known.
exchangeInfo - is equivalent to
mexc-openapi-cli <operation> ....uxc https://api.mexc.com --schema-url <mexc_spot_openapi_schema> <operation> ...
- 自动化操作基于JSON输出格式;请勿使用参数。
--text - 优先解析稳定字段:,
ok,kind,protocol,data。error - 将签名写入操作视为高风险操作,执行前需明确确认。
- 和
timestamp由签名绑定自动注入;用户通常只需提供业务参数及可选的signature。recvWindow - 下单前查询,了解币种过滤规则和下单数量限制。
exchangeInfo - 等效于
mexc-openapi-cli <operation> ...。uxc https://api.mexc.com --schema-url <mexc_spot_openapi_schema> <operation> ...
References
参考资料
- Usage patterns:
references/usage-patterns.md - Curated OpenAPI schema:
references/mexc-spot.openapi.json - Official MEXC Spot v3 docs: https://mexcdevelop.github.io/apidocs/spot_v3_en/
- 使用模式:
references/usage-patterns.md - 精选OpenAPI schema:
references/mexc-spot.openapi.json - MEXC现货v3官方文档:https://mexcdevelop.github.io/apidocs/spot_v3_en/