> ## Documentation Index
> Fetch the complete documentation index at: https://docs.2extract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini CLI

> Connect the 2extract MCP server to Google's Gemini CLI so it can provision proxies from the terminal.

Gemini CLI reads its MCP servers from a `settings.json` file, or adds them through its own `mcp` subcommand.

***

## Global or per project?

| File | Scope | Use when |
| :- | :- | :- |
| `~/.gemini/settings.json` | Every project | It is your personal key and you want it everywhere |
| `.gemini/settings.json` | One repository | The whole team should get the same tools |

<Warning>
  A project-level `.gemini/settings.json` may end up committed. Do not put a real API key in it - add the file to `.gitignore`, or use the user-level file instead.
</Warning>

***

## Add the server

The quickest route is the CLI. `-s user` writes to your user-level file; without it, the server is added to the current project:

```bash icon="terminal" theme={null}
gemini mcp add -s user --transport http \
  --header "Authorization: Bearer 2xt_YOUR_API_KEY" \
  2extract https://mcp.2extract.com/mcp
```

Or edit `settings.json` directly:

```json settings.json icon="brackets-curly" theme={null}
{
  "mcpServers": {
    "2extract": {
      "httpUrl": "https://mcp.2extract.com/mcp",
      "headers": {
        "Authorization": "Bearer 2xt_YOUR_API_KEY"
      }
    }
  }
}
```

Already have servers configured? Add `2extract` as another key inside the existing `mcpServers` object.

<Note>
  Use `httpUrl`, not `url`. In Gemini CLI, `httpUrl` selects Streamable HTTP, while `url` selects the older SSE transport.
</Note>

***

## Verify

```bash icon="terminal" theme={null}
gemini mcp list
```

`2extract` should be listed as connected. Then start Gemini CLI and ask:

> What is my 2extract balance?

<Check>
  A number comes back, and no proxy was created. Inside a session, `/mcp` lists the server with its tools and prompts.
</Check>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Server is listed but disconnected">
    Check the key is `httpUrl` and the URL keeps the `/mcp` path. `https://mcp.2extract.com` on its own serves a web page, not the protocol.
  </Accordion>

  <Accordion title="Unauthorized on every call">
    The `Authorization` header must read `Bearer 2xt_...` - the word, a space, the key. The server shows as connected even with a wrong key; the error appears on the first tool call.
  </Accordion>

  <Accordion title="Some tools fail, others work">
    A scope problem rather than a connection problem. The key is missing the scope those tools need - see [Overview](/ai/mcp-server/overview#scopes-an-agent-needs).
  </Accordion>
</AccordionGroup>

***

## Next steps

<CardGroup cols={2}>
  <Card title="Tools" icon="wrench" href="/ai/mcp-server/tools">
    Everything the agent can call.
  </Card>

  <Card title="Other clients" icon="plug" href="/ai/clients/other">
    Any other MCP client.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.