Skip to main content

AI Agent Integration

Two integration options are available. Use either one, or configure both.

Option 1: Install skillsOption 2: Configure MCP
SetupRun one commandEdit the agent configuration file
Invocation pathThe agent runs mexc commands in the terminalThe agent calls directly, without going through the terminal
PrerequisitesThe agent can execute terminal commandsThe agent supports MCP

Option 1: Install Skills

mexc skills install                   # Install for Claude Code by default
mexc skills install --agent cursor # Install for a specific agent
mexc skills install --all-agents # Install for all detected agents
mexc skills update # Re-run after upgrading the CLI

This installs 25 capability reference documents. After installation, you can ask questions directly, such as "What is the current BTC contract funding rate?" or "What is my spot USDT balance?"

Each document includes a full capability table: command syntax, read/write behavior, whether a key is required, whether repeated execution is safe, and a description. It also includes practical workflows, such as how to confirm an order fill after placing a trade. For questions like "What can spot trading do?" or "Which command shows my positions?", the agent answers from local documents that you can verify.

The documents ship with the binary and match the installed version. After upgrading the CLI, run mexc skills update to sync them. If versions do not match, mexc doctor reports a warning.

Capability Coverage

Use the table below to confirm category coverage. For individual capabilities, query through the agent or mexc explore.

CategoryModuleCountDescription
Spotmarketv225Market data, including public real-time streams; 21 do not require a key
Spotkline2Klines; do not require a key
Spotmarket-search1Market search
Spottrade12Place, modify, cancel, and query orders; includes take-profit/stop-loss, trigger, trailing, and OCO orders
Spotasset32Overview, balances, deposit/withdrawal and transfer history, inter-account transfers, bills, PnL
Spotconvert8Flash convert
Spotdca21DCA / auto-invest
Spotfee9Fee rate center
Spotgrid16Grid trading
Spotaccount1Real-time stream of this account's trades
Contractmarket37Public market data; do not require a key
Contracttrade54Orders, plan orders, stop-loss, trailing, leverage, margin, positions
Contractaccount26Assets, fund records, multi-asset mode, fees, risk, preferences
Financialflexible18Flexible products and auto-pledge
Financialfixed12Fixed-term products and orders
Financialcontract-hold10Contract-hold yield
Financialcommon11Common product, asset, position, and order queries
Activityreward4Reward center
Activityonline3Activity discovery
Activityparticipate1Activity registration
Futures marketmarket3Public real-time streams; do not require a key
Futures marketaccount1Real-time stream of this account's trades

If skills are not installed, you can still discover capabilities yourself: mexc explore browses everything, mexc contract market --help lists all capabilities in a module, and mexc schema outputs all capability IDs for scripting.

Option 2: Configure MCP

Configure by category, one entry per category:

{
"mcpServers": {
"mexc-spot": { "command": "mexc", "args": ["mcp", "spot", "--read-only"] }
}
}

Most agents provide a configuration command, so you do not need to edit the file manually. Common agent setup examples:

claude   mcp add-json -s user mexc-spot '{"type":"stdio","command":"mexc","args":["mcp","spot","--read-only"]}'
codex mcp add mexc-spot -- mexc mcp spot --read-only
gemini mcp add -s user -t stdio mexc-spot mexc mcp spot --read-only
kiro-cli mcp add --name mexc-spot --command "mexc mcp spot --read-only" --scope global
code --add-mcp '{"name":"mexc-spot","type":"stdio","command":"mexc","args":["mcp","spot","--read-only"]}'
cursor --add-mcp '{"name":"mexc-spot","type":"stdio","command":"mexc","args":["mcp","spot","--read-only"]}'

Configure only what you need. Exposing all 307 capabilities to an agent lowers the chance it selects the right one and increases context usage.

args configurationCoverageTool count
["mcp", "spot", "--read-only"]All spot123
["mcp", "contract", "--read-only"]All contract117
["mcp", "financial-openapi", "--read-only"]Financial51
["mcp", "activity", "--read-only"]Activities and rewards8
["mcp", "spot", "marketv2", "--read-only"]Spot market only22

For market and account queries only, the first entry is enough. File upload/download and real-time streams cannot be transported over MCP, so the tool count is lower than the capability count. All futures capabilities are real-time streams, so configuring MCP for them exposes no tools; use the terminal instead.

MCP Server Fails to Start

Replace mexc in the configuration with the full path to the binary. On Windows, a full path is required. On macOS and Linux, agents launched from a terminal usually do not need this; agents launched from the Dock or Launchpad may, especially Claude Desktop.

npm root -g     # Append /@mexc-ai/cli-<platform>/bin/mexc to the output directory

<platform> values include win32-x64, darwin-arm64, linux-x64, and others. On Windows, the filename includes .exe, and backslashes must be escaped in JSON:

"command": "C:\\Users\\YourUsername\\AppData\\Roaming\\npm\\node_modules\\@mexc-ai\\cli-win32-x64\\bin\\mexc.exe"