gate-dex-trade
Gate DEX trading comprehensive skill. Supports MCP and OpenAPI dual modes: MCP mode calls through gate-wallet service (requires authentication), OpenAPI mode calls directly through AK/SK. Use when users mention swap, exchange, buy, sell, quote, trade. Automatically select the most suitable calling method based on environment.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-14
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- gate-dex-trade
- description
- Gate DEX trading comprehensive skill. Supports MCP and OpenAPI dual modes: MCP mode calls through gate-wallet service (requires authentication), OpenAPI mode calls directly through AK/SK. Use when users mention swap, exchange, buy, sell, quote, trade. Automatically select the most suitable calling method based on environment.
02 资源文件 8
- 参考文档_meta.json287 B
- 参考文档CHANGELOG.md1.7 KB
- 脚本install.sh5.5 KB
- 参考文档README.md3.2 KB
- 参考文档references/openapi.md65.3 KB
- 参考文档references/README-openapi.md3.1 KB
- 参考文档SOURCE.md330 B
- 参考文档TRUST.auto.yaml2.3 KB
03 SKILL.md 正文
Gate DEX Trade
Trading Comprehensive Skill — MCP + OpenAPI dual mode support, intelligent routing selects optimal trading method
Trigger Scenarios: Use when users mention "swap", "exchange", "buy", "sell", "trade", "quote" and other related operations.
? Dual Mode Architecture
| Mode | Connection Method | Advantages | Use Cases |
|---|---|---|---|
| ? MCP Mode | gate-wallet MCP Server | Unified authentication, wallet ecosystem integration | Complete trading process, cross-Skill collaboration |
| ⚡ OpenAPI Mode | AK/SK direct calls | Independent execution, complete lifecycle | Fast trading, full chain control |
? Smart Routing Rules
System automatically selects calling mode based on following priorities:
| Priority | Condition | Selected Mode | Routing Target |
|---|---|---|---|
| 1 | Explicitly mentions "OpenAPI", "AK/SK" | ⚡ OpenAPI | references/openapi.md |
| 2 | Exists ~/.gate-dex-openapi/config.json |
⚡ OpenAPI | references/openapi.md |
| 3 | From wallet Skills cross-Skill calls | ? MCP | Current SKILL.md main process |
| 4 | Default scenario | ? MCP | Current SKILL.md main process |
User Preferences:
- Pursue complete ecosystem integration → MCP mode
- Pursue independent fast execution → OpenAPI mode
MCP Server Connection Detection
First Session Detection
Before first MCP tool call in session, perform one connection probe to confirm Gate Wallet MCP Server availability. No need to repeat detection for subsequent operations.
CallMcpTool(server="gate-wallet", toolName="chain.config", arguments={chain: "eth"})
| Result | Handling |
|---|---|
| Success | MCP Server available, subsequent operations directly call business tools, no need to probe again |
| Failure | Display configuration guidance based on error type (see error handling below) |
Runtime Error Fallback
If business tool calls fail during subsequent operations (returning connection errors, timeouts etc.), handle according to following rules:
| Error Type | Keywords | Handling |
|---|---|---|
| MCP Server not configured | server not found, unknown server |
Display MCP Server configuration guidance |
| Remote service unreachable | connection refused, timeout, DNS error |
Prompt to check server status and network connection |
| Authentication failed | 401, unauthorized, x-api-key |
Prompt to contact administrator for API Key |
Authentication Description
All operations in MCP mode require mcp_token. Must confirm user is logged in before calling any tool.
- If currently no
mcp_token→ Guide togate-dex-wallet/references/authto complete login then return - If
mcp_tokenexpired (MCP Server returns token expired error) → First tryauth.refresh_tokensilent refresh, guide re-login if failed
MCP Tool Call Specification (Main Process)
1. tx.quote — Get Swap Quote
Get Swap quote from input token to output token.
| Field | Description |
|---|---|
| Tool Name | tx.quote |
| Parameters | { chain_id_in: string, chain_id_out: string, token_in: string, token_out: string, amount: string, slippage?: number, user_wallet: string, native_in?: boolean, native_out?: boolean, mcp_token: string } |
| Return | Quote details including exchange rate, slippage, routing path, estimated Gas etc |
2. tx.swap — Execute Swap
One-shot Swap execution (Quote→Build→Sign→Submit single call).
| Field | Description |
|---|---|
| Tool Name | tx.swap |
| Parameters | Same as tx.quote + account_id |
| Return | Transaction result |
3. tx.swap_detail — Query Swap Status
(Other MCP tool specifications...)
Sub-module Routing
Route to specific implementation based on mode detection result and user intent:
| Routing Condition | Target | Description |
|---|---|---|
| OpenAPI environment + related intent | references/openapi.md | Complete OpenAPI call specification |
| MCP environment + trading intent | Current SKILL.md main process | MCP tool calls and three-step confirmation process |
Operation Process
Process A: Smart Mode Selection
First session detection (if needed)
↓
Environment detection:
1. Check ~/.gate-dex-openapi/config.json
2. Check gate-wallet MCP Server
↓
Select calling mode based on detection result:
→ OpenAPI mode: references/openapi.md
→ MCP mode: Current main process
Process B: MCP Swap Execution (Main Process)
Authentication check → Balance verification → Trading pair confirmation
→ tx.quote → Quote display → Signature authorization confirmation
→ tx.swap → tx.swap_detail
Cross-Skill Collaboration
| Caller | Scenario | Tool Used |
|---|---|---|
gate-dex-wallet |
User views balance then wants to exchange tokens | MCP mode call |
gate-dex-market |
User views market then wants to buy certain token | MCP mode call |
Supported Chains
| Chain ID | Network Name | MCP Support | OpenAPI Support |
|---|---|---|---|
eth / 1 |
Ethereum | ✅ | ✅ |
bsc / 56 |
BNB Smart Chain | ✅ | ✅ |
polygon / 137 |
Polygon | ✅ | ✅ |
arbitrum / 42161 |
Arbitrum One | ✅ | ✅ |
optimism / 10 |
Optimism | ✅ | ✅ |
avax / 43114 |
Avalanche | ✅ | ✅ |
base / 8453 |
Base | ✅ | ✅ |
sol / 501 |
Solana | ✅ | ✅ |
Security Rules
- Mode selection transparency: Clearly inform users of current calling mode and reason
- Authentication isolation: MCP mode uses
mcp_token, OpenAPI mode uses AK/SK - Three-step confirmation gating: MCP mode includes trading pair confirmation → quote display → signature authorization confirmation
- Balance verification: Mandatory check asset sufficiency before trading
- Risk alerts: Mandatory warning when price difference > 5%, high slippage MEV risk alerts
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.