# Gemini MCP server

The Gemini Model Context Protocol (MCP) server connects MCP clients to Gemini API tools. The open-source server runs locally over standard input and output (stdio).

## Install the local server

Use Node.js 22.4 or later and npm. Clone the [developer-platform repository](https://github.com/gemini/developer-platform), then build the server:

```bash
git clone https://github.com/gemini/developer-platform.git
cd developer-platform/packages/mcp-server
npm install
npm run build
```

Create an API key in [Gemini API Settings](https://exchange.gemini.com/settings/api). Add the server to Claude Code with the absolute path to the built entry point:

```bash
claude mcp add gemini -s user \
  -e GEMINI_API_KEY=YOUR_API_KEY \
  -e GEMINI_API_SECRET=YOUR_API_SECRET \
  -- node /absolute/path/to/developer-platform/packages/mcp-server/dist/index.js
```

The command registers the server for all projects. Remove `-s user` to register it for the current project only. Add `GEMINI_ACCOUNT=primary` when you use a Master API key. If your key uses time-based nonces, set `GEMINI_API_NONCE_MODE=time-based`. The default mode is `incremental`.

For Claude Desktop, ChatGPT, and all supported environment variables, follow the [MCP server README](https://github.com/gemini/developer-platform/tree/main/packages/mcp-server#setup). Do not put API secrets in source files, prompts, or logs.

## Tools

Gemini MCP's OAuth-backed tool catalog exposes public market data and authenticated account tools. The local open-source server uses API keys and has a separate tool catalog. See its README for package-specific names and operations.

| Tool group | MCP tool names | Access |
| --- | --- | --- |
| Market data | `gemini_get_ticker`, `gemini_get_ticker_v1`, `gemini_get_symbol_details`, `gemini_list_symbols`, `gemini_list_prices`, `gemini_get_order_book`, `gemini_list_candles`, `gemini_list_derivative_candles`, `gemini_list_market_trades` | Public read-only data. |
| Prediction markets | `gemini_list_prediction_events`, `gemini_get_prediction_event` | Public read-only event and contract data. Use `gemini_get_prediction_event` for full event details and terms. |
| Networks and assets | `gemini_get_network`, `gemini_get_assets_for_network` | Network metadata is public. Asset lookup requires `addresses:read`. |
| Connection status | `gemini_auth_status` | Reports authentication configuration without revealing secrets. |
| Account reads | `gemini_list_balances`, `gemini_list_orders`, `gemini_get_order_status`, `gemini_list_trades`, `gemini_list_derivative_positions` | Authenticated data. `gemini_list_derivative_positions` is for explicit derivatives or perpetuals position requests. |
| Sandbox Credit Card data | `gemini_sandbox_gemini_get_credit_card_balance`, `gemini_sandbox_gemini_get_credit_card_rewards`, `gemini_sandbox_gemini_list_credit_card_statements`, `gemini_sandbox_gemini_list_credit_card_transactions` | Sandbox only. Uses WebAPI Financial Data Exchange (FDX). |

Tool availability depends on the server and environment you connect. Use your MCP client's tool list to confirm exact names and available operations.

The sandbox exposes the standard tools under `gemini_sandbox_gemini_*` names. It also exposes the FDX tools listed above.

## Permissions and scopes

The local open-source server uses an API key and secret. It uses API-key roles, not OAuth scopes. The scope table applies to OAuth-backed Gemini MCP tools. Request only scopes needed for your workflow. See the [OAuth scope reference](/authentication/oauth#oauth-scopes) for standard API scopes.

| MCP tools | Required OAuth scope |
| --- | --- |
| `gemini_list_balances`, `gemini_list_derivative_positions` | `balances:read` |
| `gemini_list_orders`, `gemini_get_order_status` | `orders:read` |
| `gemini_list_trades` | `history:read` |
| `gemini_get_assets_for_network` | `addresses:read` |
| `gemini_sandbox_gemini_get_credit_card_balance` | `fdx:accountdetailed:read` |
| `gemini_sandbox_gemini_get_credit_card_rewards` | `fdx:rewards:read` |
| `gemini_sandbox_gemini_list_credit_card_statements` | `fdx:statements:read` |
| `gemini_sandbox_gemini_list_credit_card_transactions` | `fdx:transactions:read`; add `fdx:rewards:read` to include transaction rewards |

The tools listed here are read-only. They do not place orders or move funds. The local server repository also documents state-changing tools. Give its API key only the roles those tools need.

## Test with sandbox

Create a [demo account](/get-started/sandbox) and a sandbox API key in [sandbox API Settings](https://exchange.sandbox.gemini.com/settings/api). Add these variables to your MCP client configuration.

```text
GEMINI_API_BASE_URL=https://api.sandbox.gemini.com
GEMINI_SDK_ENV=sandbox
GEMINI_WS_URL=wss://ws.sandbox.gemini.com
```

FDX tools are available only in the sandbox MCP tool set. Use sandbox OAuth authorization and request only needed FDX scopes. Do not use production credentials or hosts for sandbox tests.

For the local server's complete environment-variable reference, see its [README](https://github.com/gemini/developer-platform/tree/main/packages/mcp-server#environment-variables).