> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.6mm.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.6mm.com/_mcp/server.

# 6MM CLI

6MM CLI is the command-line entrypoint for users, scripts, and AI Agents that can execute shell commands.

Use CLI when the AI environment can run terminal commands directly. This is often the simplest path for coding agents because no separate MCP server is required. The CLI should return stable JSON by default so agents can parse results without relying on terminal formatting.

<h2 id="what-the-cli-is-good-for">
  What the CLI is good for
</h2>

* Quick market-data queries from a terminal.
* Agent-driven analysis in Codex, Claude Code, Gemini CLI, or similar tools.
* CI or scheduled scripts that need 6MM data.
* Account-read checks when local credentials are configured.
* Order preview flows where the agent prepares parameters but does not place an order.

<h2 id="example-commands">
  Example commands
</h2>

```bash
6mm markets
6mm ticker BTC-USDT-PERP
6mm orderbook BTC-USDT-PERP --depth 20
6mm klines BTC-USDT-PERP --interval 1h --limit 100
6mm account summary
6mm positions
6mm orders open
6mm order preview --symbol BTC-USDT-PERP --side buy --type limit --price 65000 --size 0.01
6mm order create --symbol BTC-USDT-PERP --side buy --type limit --price 65000 --size 0.01
6mm order cancel --order-id xxx
```

<h2 id="output-modes">
  Output modes
</h2>

| Mode  | Use case                                        |
| ----- | ----------------------------------------------- |
| JSON  | Default for AI Agents, scripts, and automation. |
| Table | Human-readable terminal review.                 |
| Raw   | Debugging and integration tests.                |

<h2 id="recommended-safety-defaults">
  Recommended safety defaults
</h2>

* Default environment is testnet.
* Default output is JSON.
* Trading commands require explicit opt-in.
* Mainnet order creation requires confirmation.
* Preview mode is available before create.
* Errors include stable codes and clear messages.

<h2 id="agent-usage">
  Agent usage
</h2>

AI Agents should prefer read-only commands unless the user explicitly asks for preview or trading actions.

Example prompt:

```text
Use the 6MM CLI to fetch BTC-USDT-PERP orderbook depth and return a short liquidity summary.
```