io.github.gateio-dev/gate-mcp

Gate API v4 MCP server — spot, futures, options, wallet, and more.

1MITdevtools

Install

Config snippet generator goes here (5 client tabs)

README

# gate-local-mcp

A local (stdio) MCP server that exposes the full [Gate](https://www.gate.com) API v4 to any MCP-compatible client (Claude Desktop, etc.).

**Quickstart guides:** [English](docs/quickstart.md) · [中文](docs/quickstart_zh.md)

> **Looking for the remote MCP server?** If you need HTTP/SSE-based remote access instead of local stdio, see [gate/gate-mcp](https://github.com/gate/gate-mcp).

## Features

- **384 tools** covering Spot, Futures, Delivery, Margin, Wallet, Account, Options, Earn, Flash Swap, Unified, Sub-Account, Multi-Collateral Loan, P2P, TradFi, CrossEx, Alpha, Rebate, Activity, Coupon, Launch, Square, and Welfare APIs
- **Zero config for public endpoints** — market data, tickers, order books work without any credentials
- **Authenticated endpoints** — trading, wallet, and account tools activate automatically when `GATE_API_KEY` + `GATE_API_SECRET` env vars are set
- **Testnet support** — set `GATE_BASE_URL` to use the testnet endpoint
- **Module filtering** — load only the modules you need via `GATE_MODULES` or `--modules`; use `GATE_READONLY` or `--readonly` to restrict to read-only tools

## Quick Start (Claude Desktop)

### Public endpoints only (no auth required)

```json
{
  "mcpServers": {
    "gate": {
      "command": "npx",
      "args": ["-y", "gate-mcp"]
    }
  }
}
```

### With authentication (trading, wallet, account)

```json
{
  "mcpServers": {
    "gate": {
      "command": "npx",
      "args": ["-y", "gate-mcp"],
      "env": {
        "GATE_API_KEY": "your-api-key",
        "GATE_API_SECRET": "your-api-secret"
      }
    }
  }
}
```

### Testnet with credentials

```json
{
  "mcpServers": {
    "gate": {
      "command": "npx",
      "args": ["-y", "gate-mcp"],
      "env": {
        "GATE_BASE_URL": "https://api-testnet.gateapi.io",
        "GATE_API_KEY": "your-testnet-key",
        "GATE_API_SECRET": "your-testnet-secret"
      }
    }
  }
}
```

## Module Filtering

By default all 384 tools (22 modules) are registered. To reduce the tool count (e.g. Cursor warns above 80), restrict to specific modules:

**CLI flags:**
```bash
# Load only spot and futures tools (95 tools)
GATE_API_KEY=... npx gate-mcp --modules=spot,futures

# Load futures tools in read-only mode (36 tools)
npx gate-mcp --modules=futures --readonly
```

**MCP config (env vars):**
```json
{
  "mcpServers": {
    "gate": {
      "command": "npx",
      "args": ["-y", "gate-mcp"],
      "env": {
        "GATE_MODULES": "spot,futures",
        "GATE_READONLY": "true",
        "GATE_API_KEY": "your-api-key",
        "GATE_API_SECRET": "your-api-secret"
      }
    }
  }
}
```

**Available modules:** `spot`, `futures`, `delivery`, `margin`, `wallet`, `account`, `options`, `earn`, `flash_swap`, `unified`, `sub_account`, `multi_collateral_loan`, `p2p`, `tradfi`, `crossex`, `alpha`, `rebate`, `activity`, `coupon`, `launch`, `square`, `welfare`

| Module | Total | Read-only |
|---|---|---|
| spot | 31 | 19 |
| futures | 64 | 36 |
| delivery | 29 | 20 |
| margin | 20 | 17 |
| wallet | 22 | 18 |
| account | 10 | 6 |
| options | 29 | 22 |
| earn | 29 | 22 |
| flash_swap | 7 | 5 |
| unified | 22 | 17 |
| sub_account | 11 | 5 |
| multi_collateral_loan | 12 | 9 |
| p2p | 17 | 10 |
| tradfi | 18 | 12 |
| crossex | 31 | 21 |
| alpha | 9 | 7 |
| rebate | 9 | 9 |
| activity | 3 | 3 |
| coupon | 2 | 2 |
| launch | 5 | 3 |
| square | 2 | 2 |
| welfare | 2 | 2 |

## Environment Variables

| Variable | Required | Default | Description |
|---|---|---|---|
| `GATE_API_KEY` | No | — | API key for authenticated endpoints |
| `GATE_API_SECRET` | No | — | API secret for authenticated endpoints |
| `GATE_BASE_URL` | No | `https://api.gateio.ws` | Override base URL (e.g. for testnet) |
| `GATE_MODULES` | No | all modules | Comma-separated list of modules to load (e.g. `spot,futures`) |
| `GATE_READONLY` | No | `false` | Set to `true` to disable all write (order/transfer) tools |

## Available Tools

Tools marked `*` require authentication (`GATE_API_KEY` + `GATE_API_SECRET`).

### Spot (31 tools)
`cex_spot_list_currencies`, `cex_spot_get_currency`, `cex_spot_list_currency_pairs`, `cex_spot_get_currency_pair`, `cex_spot_get_spot_tickers`, `cex_spot_get_spot_order_book`, `cex_spot_get_spot_trades`, `cex_spot_get_spot_candlesticks`, `cex_spot_get_spot_insurance_history`, `cex_spot_get_spot_fee`\*, `cex_spot_get_spot_accounts`\*, `cex_spot_list_spot_orders`\*, `cex_spot_create_spot_order`\*, `cex_spot_get_spot_order`\*, `cex_spot_cancel_spot_order`\*, `cex_spot_amend_spot_order`\*, `cex_spot_cancel_all_spot_orders`\*, `cex_spot_list_spot_my_trades`\*, `cex_spot_list_all_open_orders`\*, `cex_spot_list_spot_price_triggered_orders`\*, `cex_spot_list_spot_account_book`\*, `cex_spot_get_spot_batch_fee`\*, `cex_spot_create_spot_batch_orders`\*, `cex_spot_amend_spot_batch_orders`\*, `cex_spot_cancel_spot_batch_orders`\*, `cex_spot_create_cross_liquidate_order`\*, `cex_spot_create_spot_price_triggered_order`\*, `cex_spot_get_spot_price_