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

# Connect to Gemini

> Use Ascend Gateway V5 with Google Gemini CLI or SDK.

# Connect to Gemini

Use the Ascend Gateway V5 with Google Gemini via CLI or programmatic SDK.

## Option 1: Gemini CLI

### Setup

Add to `~/.gemini/settings.json`:

```json theme={null}
{
  "mcpServers": {
    "ascend-gateway": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://ascend-gateway-v5.ascendgtm.workers.dev/mcp",
        "--header",
        "Authorization: Bearer YOUR_TOKEN_HERE"
      ]
    }
  }
}
```

### Test It

```bash theme={null}
gemini "List my connected APIs using discover_apis"
```

## Option 2: Gemini API / SDK (Programmatic)

Google's Gemini SDK supports MCP natively as of March 2026.

### Python

```python theme={null}
from google import genai

client = genai.Client()

# Connect to Ascend Gateway MCP
mcp_tools = client.mcp.connect(
    url="https://ascend-gateway-v5.ascendgtm.workers.dev/mcp",
    headers={"Authorization": "Bearer YOUR_TOKEN_HERE"}
)

# Use in a chat session
response = client.models.generate_content(
    model="gemini-2.5-pro",
    contents="Search HubSpot for contacts created this month",
    tools=mcp_tools,
)
print(response.text)
```

### JavaScript/TypeScript

```typescript theme={null}
import { GoogleGenAI } from '@google/genai';

const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const mcpTools = await ai.mcp.connect({
  url: 'https://ascend-gateway-v5.ascendgtm.workers.dev/mcp',
  headers: { Authorization: `Bearer ${process.env.ASCEND_TOKEN}` },
});

const response = await ai.models.generateContent({
  model: 'gemini-2.5-pro',
  contents: 'List connected APIs',
  tools: mcpTools,
});
```

## Platform Availability

| Platform              | MCP Support               | Status                                 |
| --------------------- | ------------------------- | -------------------------------------- |
| Gemini CLI            | ✅ Via mcp-remote shim     | Available now                          |
| Gemini API/SDK        | ✅ Native MCP in Python/JS | Available now                          |
| Gemini Web (consumer) | ❌ No custom MCP           | Not available for non-Enterprise       |
| Gemini Enterprise     | ✅ Conditional             | Requires Google account team allowlist |

## Troubleshooting

| Issue                          | Fix                                                              |
| ------------------------------ | ---------------------------------------------------------------- |
| `mcp-remote` not found         | Run `npm install -g mcp-remote`                                  |
| SDK connection fails           | Verify token: `curl -H "Authorization: Bearer TOKEN" .../health` |
| "Model does not support tools" | Use `gemini-2.5-pro` or `gemini-2.5-flash` (tool use required)   |
