Skip to main content
Glama
gemini4-mcp

gemini4-mcp

by Franky1107
README.md
# gemini4-mcp

An [MCP](https://modelcontextprotocol.io) server that lets **Claude Desktop** (or any MCP client) ask Google's **Gemini 4** models: Hydrogen, Neon and Carbon. You choose the thinking level for each request.

Most existing Gemini MCP servers target Gemini 2.x and send parameters Gemini 4 no longer uses. This one is built for the Gemini 4 API: no `temperature`/`top_p`, and `thinking_level` instead.

## Tool

`ask_gemini(prompt, model="gemini-4-hydrogen", thinking_level="high", system=None)`

| Model | Use it for |
|---|---|
| `gemini-4-hydrogen` | Fast everyday tasks (default) |
| `gemini-4-neon` | Harder coding, analysis, long documents |
| `gemini-4-carbon` | The hardest problems (thinking capped at `high`) |

Thinking levels: `low`, `medium`, `high` (default), `xhigh`.

## Requirements

- Python 3.10+
- A Gemini API key from [Google AI Studio](https://aistudio.google.com/api-keys)
- **Neon is paid-tier only.** Every token is billed, thinking tokens included. Check [pricing](https://aistudio.google.com/docs/pricing) before heavy use.

## Install

With [uv](https://docs.astral.sh/uv/) (no manual install needed):

```json
{
  "mcpServers": {
    "gemini4": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Franky1107/gemini4-mcp", "gemini4-mcp"],
      "env": { "GEMINI_API_KEY": "your-key-here" }
    }
  }
}
```

Or with pip:

```bash
git clone https://github.com/Franky1107/gemini4-mcp
cd gemini4-mcp
pip install .
```

```json
{
  "mcpServers": {
    "gemini4": {
      "command": "gemini4-mcp",
      "env": { "GEMINI_API_KEY": "your-key-here" }
    }
  }
}
```

Put the config in:
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`

Then fully restart Claude Desktop.

> ⚠️ Your API key lives in that config file. Never commit it or paste it into an issue.

## Usage

Ask Claude something like:

> Ask Gemini Neon with xhigh thinking to review this function for race conditions.

## Development

```bash
pip install -e . pytest
pytest
```

The tests use a fake client, so they don't call the API or need a key.

## Limitations

- Text prompts only (no images or files)
- One request at a time, no multi-turn memory
- Answers are capped at about 64K tokens (no background/long-decode mode)

## License

MIT