Gemini Agentic Trading with Claude Code: Hands-On Setup Guide

intermediate 30 min · · By Alpha Guy · claude-code chatgpt

Short Answer

Gemini’s Agentic Trading, announced in late April 2026, lets you connect Claude Code or ChatGPT to your Gemini trading account through MCP. It is the first regulated US exchange to ship a native AI agent integration. Setup takes about 30 minutes: enable the feature in your Gemini account, generate an agent-scoped API key, install the Gemini MCP server, point Claude Code at it, and place a first paper-trade order. Permission scopes are stricter than a normal API key, withdrawals are off by default, and every agent action lands in a separate audit log.

What Gemini Actually Released

Gemini calls the feature Agentic Trading. Under the hood it is an MCP server that exposes Gemini’s trading API as a set of structured tools any MCP client can call. The pitch from Gemini is that it is the first regulated US exchange to do this natively, rather than relying on a community wrapper.

The interesting part for builders is the Trading Skills layer. Instead of raw REST endpoints, the MCP server exposes named functions that match how a trader talks: find_the_spread, retrieve_candles, place_limit_order, cancel_order, query_open_positions. Claude Code picks the right one based on your prompt.

Trading SkillWhat It Returns
find_the_spreadLive bid/ask spread for any pair
retrieve_candlesHistorical OHLCV at the timeframe you ask for
place_limit_orderSubmits a limit order with size and price
place_market_orderSubmits a market order with size
query_open_positionsLists current holdings and unrealized PnL
cancel_orderCancels a single order by ID
cancel_all_ordersBulk cancel for one trading pair
query_order_historyLast N orders with status and fills

Gemini’s docs list more, and the set will grow. The point of the skill layer is that a model does not have to memorize endpoint paths or query parameters. It calls retrieve_candles("BTCUSD", "1h", 100) and the MCP server handles the rest.

Prerequisites

  • A Gemini account, verified for trading in your region (US, UK, EU, Canada, Singapore are supported at launch)
  • Claude Code installed and working
  • Node.js 18+
  • Spare USD or USDC in your Gemini account if you want to test live, or paper-trading enabled if you just want to test the wiring

Step 1: Enable Agentic Trading on Your Gemini Account

The feature is opt-in. You have to turn it on before the API exposes the agent endpoints:

  1. Log into gemini.com on the web
  2. Open Account Settings then API
  3. Click Agentic Trading in the left sidebar (new section as of April 2026)
  4. Read the risk disclosure and accept
  5. Choose between Paper and Live mode for the first key — paper is sandboxed against a simulated order book with real market data

Paper mode is the right starting point. The MCP server, the skills, and the audit logs all behave the same in paper as in live, but no actual fills hit the exchange.

Step 2: Generate an Agent-Scoped API Key

Standard Gemini API keys do not work with the Agentic Trading endpoints. You need a key with the Agent scope:

  1. Inside the Agentic Trading section, click Create Agent Key
  2. Pick the permissions:
PermissionDefaultNotes
Read account stateOnRequired for query_open_positions
Read market dataOnRequired for retrieve_candles
Place ordersOffTurn on only when you trust the bot
Cancel ordersOffTurn on with placement
Withdraw fundsLocked offCannot be enabled on agent keys
Transfer between accountsLocked offSame
  1. Set a daily trading volume cap (start at $1,000 for a first bot)
  2. Pin the key to your machine’s outbound IP
  3. Copy the key, secret, and signing key — Gemini shows them once

The withdrawal lock is structural. Gemini does not let you flip it on for an agent key, even from the web UI. If you want a bot that can withdraw, you have to use a normal API key, which Gemini explicitly warns against for AI agent use.

Step 3: Install the Gemini MCP Server

Gemini publishes the server as an npm package:

npm install -g @gemini/mcp-server

Or clone the repo if you want to read the source:

git clone https://github.com/gemini/agentic-trading-mcp.git ~/gemini-mcp
cd ~/gemini-mcp
npm install

The official repo also includes a tools.json manifest that lists every Trading Skill the server exposes. Worth reading once before you start prompting, so you know what is available.

Step 4: Configure Claude Code

Edit ~/.claude/.mcp.json and add the Gemini block:

{
  "mcpServers": {
    "gemini": {
      "command": "node",
      "args": ["/path/to/gemini-mcp/src/index.js"],
      "env": {
        "GEMINI_API_KEY": "your-agent-key",
        "GEMINI_API_SECRET": "your-agent-secret",
        "GEMINI_SIGNING_KEY": "your-signing-key",
        "GEMINI_MODE": "paper"
      }
    }
  }
}

Switch GEMINI_MODE to live only after you have validated the bot in paper. The mode flag is sticky — the MCP server logs a warning every time it starts up in live mode so you know.

If you already run other MCP servers, add the Gemini block alongside them. The MCP servers for AI trading guide covers how multiple servers share a session.

Step 5: First Connection Test

Restart Claude Code and try a read-only call:

Use the Gemini MCP to get the current spread on BTCUSD.

Claude should call find_the_spread("BTCUSD") and return the bid, ask, and spread in basis points. If you get an authentication error, the most common cause is a mismatched signing key — the agent key uses a different signature scheme than a normal Gemini key.

Next, try a market data pull:

Pull the last 50 1-hour candles for ETHUSD from Gemini and tell me the 20-period RSI value at the most recent close.

Claude will fetch the candles through MCP and compute the RSI itself. Useful sanity check before you trust it with orders.

Step 6: First Paper Order

Now place a small order. In paper mode this hits Gemini’s simulated book:

Place a limit buy on Gemini for 0.001 BTC at $1,000 below the current ask price.

Two things to verify:

  1. The order ID Claude returns shows up in your Gemini paper account under Open Orders
  2. The order does not fill, because the limit price is far below market — confirms the order routing works without consuming paper balance

Cancel it:

Cancel the Gemini paper order you just placed.

The full round trip — quote, place, cancel — should take under five seconds. If it takes longer, the MCP server is probably retrying through Gemini’s rate limiter; check the server logs.

Step 7: Wire In a Strategy

Once the plumbing works, the actual trading logic is the easy part. A minimal RSI-based bot:

Build a Python script that, every 15 minutes:
1. Calls the Gemini MCP to pull the last 50 1-hour BTCUSD candles
2. Computes the 14-period RSI in pandas
3. If RSI < 30, places a paper limit buy of 0.001 BTC at the current ask
4. If RSI > 70 and we hold a position, places a paper limit sell at the current bid
5. Logs every action to a CSV with timestamp, signal, order ID
6. Never opens more than one position at a time

Claude Code will scaffold the loop. For the strategy itself, the backtest your AI trading strategy guide walks through how to verify the parameters on historical data before turning on the live signal.

What Gemini Restricts (And Why It Matters)

Gemini’s compliance team built rails around what an agent can do. The hard limits:

RestrictionLimitOverride?
Trading volume per dayPer-key cap, default $10KAdjustable up to your account’s tier
Orders per minute60No
New trading pairsWhitelisted onlySubmit request via support
WithdrawalDisabledNo, hard block
Account transferDisabledNo, hard block
Margin/leverageOff for agent keysNo, spot only for now

The margin restriction is the one most builders trip on. If your strategy depends on leverage, you cannot run it through Gemini Agentic Trading right now. Gemini said in the launch announcement that margin support is on the roadmap but did not commit to a date.

For perpetuals and futures, the Bybit MCP bot or the Hyperliquid bot are the alternatives.

How It Compares to Other Agent-Enabled Exchanges

The exchange-side AI integration story changed a lot between April and May 2026:

ExchangeAgent ModeRegulated USMCP NativeMargin
GeminiAgentic Trading (April 2026)Yes (NYDFS)YesNo (spot only)
BybitAI Sub-Account (May 2026)No (offshore)YesYes
AlpacaPaper + live APIYes (FINRA)Yes (V2)Yes (Reg-T)
CoinbaseStandard API onlyYesNoNo (US retail)
Binance.USStandard API onlyYesNoNo

If regulatory standing matters for your use case (taxes, reporting, compliance with an employer’s restrictions), Gemini is currently the only US-regulated exchange with a native MCP integration. For broader feature coverage and margin, Bybit and Hyperliquid still lead.

The Bybit AI Sub-Account setup guide covers the equivalent setup on Bybit. The Alpaca MCP stock trading bot covers Alpaca for US equities.

What to Watch For

A few real concerns the launch raised:

  • Multiple agents reacting to the same signal. Critics on Twitter pointed out that if many bots use the same model and prompt, they place correlated orders and can amplify volatility. Use unconventional timeframes or signal logic to avoid the herd.
  • Latency. MCP adds a hop between your bot and the exchange. Gemini’s MCP server is fast (under 200ms round trip from US-east) but you will not win a latency race against a direct WebSocket bot.
  • API stability. The Trading Skills API is new. Gemini reserves the right to add or rename skills. Pin the MCP server version in your config and update on a schedule, not automatically.
  • Cost. Each MCP call hits Claude API tokens for the agent’s reasoning step. For a polling bot that runs every 15 minutes, this is cents per day. For a sub-second strategy, it adds up fast.

Where to Go Next

Gemini’s launch is the clearest signal that AI-native trading is moving from hobby code to regulated rails. The setup is more friction than a raw REST integration but the fund isolation and audit trail are worth the 30 minutes once. Start in paper mode, verify the round trip, and only flip to live when your strategy has at least 30 paper trades you can read line by line.

Disclaimer: This article is for educational purposes only and is not financial advice. Trading cryptocurrencies involves substantial risk of loss. Past performance does not guarantee future results. Always do your own research before making any trading decisions. Read full disclaimer →
Alpha Guy
Alpha Guy

Founder of VibeTradingLab. Ex-Goldman Sachs engineer, 2025 Binance Top 1% Trader. Writes about using AI tools to build trading systems that actually work. Currently nomading between Bali, Dubai, and the Mediterranean.

Got stuck? Have questions?

Join our Telegram group to ask questions, share your bots, and connect with other AI traders.

Join Telegram