# Antigravity

Installing SurrealDB Agent Memory as an MCP server in Google Antigravity.

Installing SurrealDB Agent Memory in [Google Antigravity](https://antigravity.google/) gives the agent persistent memory across sessions, so it can recall previous decisions and project context without you repeating them.

For integration rules your agent should follow (auth, scope, endpoints, common mistakes), see **[Agent guide (AGENTS.md)](/docs/agent-memory/reference/agents.md)**.

## Configure

The `install-mcp` helper does not cover Antigravity, so configure the server by hand. Antigravity's IDE and CLI share a central MCP configuration at `~/.gemini/config/mcp_config.json`. In the IDE you can reach it through **Manage MCP servers → View raw config**.

> [!NOTE]
> Antigravity uses a stricter schema than most MCP clients: remote Streamable HTTP servers use **`serverUrl`**, not `url`.

```json
{
  "mcpServers": {
    "spectron": {
      "serverUrl": "https://<your-context-host>/mcp",
      "headers": {
        "Authorization": "Bearer <your-api-key>",
        "X-Spectron-Context": "acme-prod"
      }
    }
  }
}
```

On **SurrealDB Cloud**, use your context host from SurrealDB Studio **API keys** (not a generic shared domain). **Self-hosted:** replace the URL with your SurrealDB Agent Memory server's base URL + `/mcp`.

> [!NOTE]
> `X-Spectron-Context` is a client-side convenience for templating. Each API key is bound to one Context, so **`context_id` is optional** on every tool call; omit it to use the key's Context. An explicit value that does not match the key still returns **`401`**.

## Verify the installation

1. Open Antigravity
2. Open the MCP store and confirm **spectron** appears with a healthy indicator
3. In a chat, ask "What MCP tools do you have available?" Antigravity should report the SurrealDB Agent Memory tools

If the server is unhealthy, check that `serverUrl` (your context host + `/mcp`) and the API key in `mcp_config.json` are correct.

## Usage examples

**Store project context:**

> "Remember that this repo uses a monorepo layout with apps in `apps/` and shared packages in `packages/`."

Antigravity calls `memory_store` with a suitable `scope`.

**Recall before answering:**

> "Where should a new shared utility live in this project?"

Antigravity calls `memory_recall` before composing its response.

## Scope per tool call

Narrow reads and writes with the per-tool **`scope`** argument (slash paths, for example `["org/acme/project/platform"]`). Register paths with `spectron scopes create` before first use. For project isolation, use separate contexts or distinct scope paths.

## Removing SurrealDB Agent Memory

Open `mcp_config.json` and delete the `"spectron"` key from `mcpServers`.
