Skip to main content
Glama
README.md
# Antigravity MCP Server

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![MCP](https://img.shields.io/badge/MCP-compatible-purple.svg)](https://modelcontextprotocol.io)

Bridge a local **Google Antigravity** subscription to MCP coding agents — **Cursor**, **Claude Code**, **Codex**, and any other MCP client. No extra API bill. The call stays on your machine, on the session Antigravity already authenticated.

Antigravity must be installed, signed in, and running before the server starts. This project is not affiliated with Google.

## What you get

- **Existing subscription.** The server talks to the local Antigravity language server. It does not mint a separate API key.
- **Multi-turn memory.** Each reply ends with a session id. Pass it back as `conversation_id`.
- **Full replies.** Long answers are read from `transcript_full.jsonl`, not the truncated compact log.
- **Remote hosts.** An SSH `RemoteForward` lets a Linux dev machine reach the Mac server. Nothing extra is installed on the remote side.

## How a request moves

Every call takes the same last two steps. Only the first step changes, depending on where the agent is running.

1. The agent sends your prompt to `server.py`.
2. `server.py` hands it to the Antigravity app already open on your Mac.
3. Antigravity uses that signed-in session to reach Gemini, and the answer comes back.

**Agent on the same Mac.** Cursor, Claude Code, or Codex starts `server.py` itself. Nothing listens on a port.

**Agent on a remote machine.** Start `server.py --sse` on the Mac first. It listens at `http://127.0.0.1:8999/sse`. An SSH `RemoteForward` makes that same address work on the remote machine. The remote agent never talks to Gemini directly.

```mermaid
flowchart TB
  mac["Cursor, Claude Code, or Codex on the Mac"] --> server["server.py"]
  remote["Agent on a remote machine"] --> tunnel["SSH forwards port 8999"]
  tunnel --> server
  server --> app["Antigravity app on the Mac"]
  app --> gemini["Gemini"]
```

## Install

Requires macOS, Python 3.10+, and the Antigravity app open.

```bash
git clone https://github.com/qiansexingqiu/antigravity-mcp.git
cd antigravity-mcp

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

Print the two absolute paths the configs below expect. `~` is not expanded in most MCP `command` fields, so paste these values as-is.

```bash
echo "python  $(pwd)/.venv/bin/python"
echo "server  $(pwd)/server.py"
```

## Connect a client

Replace both `/ABS/PATH` values with the paths printed above. Start Antigravity first, then reload the client.

### Cursor

`~/.cursor/mcp.json`

```json
{
  "mcpServers": {
    "antigravity": {
      "command": "/ABS/PATH/.venv/bin/python",
      "args": ["/ABS/PATH/server.py"]
    }
  }
}
```

Reload the window: Command Palette → **Developer: Reload Window**. The tool name is `ask_antigravity`.

### Claude Code

User scope, available in every project:

```bash
claude mcp add --scope user --transport stdio antigravity -- \
  /ABS/PATH/.venv/bin/python \
  /ABS/PATH/server.py
```

The same entry, if you edit `.mcp.json` (this project) or `~/.claude.json` (all projects) by hand:

```json
{
  "mcpServers": {
    "antigravity": {
      "type": "stdio",
      "command": "/ABS/PATH/.venv/bin/python",
      "args": ["/ABS/PATH/server.py"]
    }
  }
}
```

### Codex

```bash
codex mcp add antigravity -- \
  /ABS/PATH/.venv/bin/python \
  /ABS/PATH/server.py
```

Or add this to `~/.codex/config.toml`:

```toml
[mcp_servers.antigravity]
command = "/ABS/PATH/.venv/bin/python"
args = ["/ABS/PATH/server.py"]
```

## Remote SSH

Use this when the agent runs on another machine and Antigravity stays on the Mac. Codex's HTTP MCP setting is streamable HTTP, not this server's SSE endpoint, so the remote example below is for Cursor and Claude Code.

**1. On the Mac**, leave Antigravity open and start the SSE server. It listens only on loopback: `http://127.0.0.1:8999/sse`.

```bash
cd /ABS/PATH
.venv/bin/python server.py --sse --port=8999
```

**2. On the Mac**, add a reverse forward to `~/.ssh/config`, then reconnect:

```ssh
Host dev-server
  HostName 203.0.113.10
  User ubuntu
  RemoteForward 8999 127.0.0.1:8999
```

**3. On the remote machine**, point the client at the forwarded port.

Cursor, `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "antigravity": {
      "url": "http://127.0.0.1:8999/sse"
    }
  }
}
```

Claude Code, `.mcp.json` or `~/.claude.json`:

```json
{
  "mcpServers": {
    "antigravity": {
      "type": "sse",
      "url": "http://127.0.0.1:8999/sse"
    }
  }
}
```

## Tool: `ask_antigravity`

| Parameter | Type | Default | Meaning |
| --- | --- | --- | --- |
| `prompt` | string | required | The question or code to send. |
| `model` | `flash` \| `pro` \| `flash_lite` | `flash` | `flash` is the fast default. `pro` is for longer reasoning. |
| `conversation_id` | string | omitted | Session id from an earlier reply. Omit it to start a new conversation. |

Ask for it by name. A first turn:

```text
Use ask_antigravity with model flash.

Design a high-throughput micro-batching buffer in Python asyncio
with graceful shutdown.
```

The reply ends with a session id. A follow-up in the same conversation:

```text
Use ask_antigravity.
conversation_id: 13278f76-619d-48dd-bf7a-14114c41146c

How should this buffer apply backpressure if the downstream flush fails?
Keep the answer to a few lines of code.
```

## License

[MIT](LICENSE)