Skip to main content
Glama
Antigravity MCP Bridge

Antigravity MCP Bridge

by Zythenth
README.md
![Black Gravity animated logo](assets/brand/logo.svg)

🌍 English / [Português](README.pt-BR.md)

[![MIT License](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2FZythenth%2Fblack-gravity%2Fmain%2Fpackage.json&query=%24.license&label=License)](LICENSE) [![Minimum Node.js version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2FZythenth%2Fblack-gravity%2Fmain%2Fpackage.json&query=%24.engines.node&label=Node.js)](package.json) [![CI](https://github.com/Zythenth/black-gravity/actions/workflows/ci.yml/badge.svg)](https://github.com/Zythenth/black-gravity/actions/workflows/ci.yml)

# Black Gravity

Black Gravity is a local MCP server that delegates programming tasks to Google Antigravity through its official `agy` CLI. It gives Codex tools to start tasks in isolated project copies, follow their progress, and review the results before applying changes. Black Gravity is independent of Google and OpenAI.

## Installation

Use one registration method per harness to avoid duplicate tools. Commands run from the repository root. A harness is **Supported** when its own command registered the build in this repository and listed it, without calling a model, or when the maintainer confirmed it working with the configuration shown. Anything else is marked **Not verified**.

| Harness | Status | What was checked |
|---|---|---|
| Codex plugin | Supported | Listed by `codex plugin list` and `codex mcp list` (Codex CLI 0.163.0, Windows) |
| Codex, MCP only | Supported | Listed by `codex mcp list` (same version) |
| Claude Code, MCP only | Supported | Shown as Connected by `claude mcp list` (Claude Code 2.1.319, Windows) |
| Claude Code plugin with skill | Planned | Not available yet |
| Claude Desktop | Supported | Confirmed by the maintainer with the configuration below |
| OpenCode | Supported | Confirmed by the maintainer with the configuration below |
| agy | Not verified | `agy mcp list` exists, but agy has no documented way to isolate its configuration |
| Other MCP clients (stdio) | Partial | The server answered `initialize` and `tools/list` with 50 tools; no other client was tested |
| Linux commands | Supported | Listed by `codex mcp list` (Codex CLI 0.171.0) and shown as Connected by `claude mcp list` (Claude Code 2.1.326, run by its absolute path), Ubuntu 26.04 |
| macOS commands | Not verified | No test machine |

### Codex plugin

**Supported.** Run these commands with the Codex CLI, then open a new conversation.

```powershell
codex plugin marketplace add Zythenth/black-gravity
codex plugin add black-gravity@black-gravity
```

### Codex, MCP only

**Supported.**

```powershell
$server = (Resolve-Path .\plugin\server.mjs).Path
codex mcp add black-gravity -- node $server
codex mcp list
```

### Claude Code, MCP only

**Supported.**

```powershell
$server = (Resolve-Path .\plugin\server.mjs).Path
claude mcp add --scope user black-gravity -- node $server
claude mcp list
```

### Claude Code plugin with skill

**Planned.** There is no plugin for Claude Code yet. Use the MCP-only registration above.

### Claude Desktop

**Supported.** Add the server to `claude_desktop_config.json` with the absolute path to `plugin/server.mjs`, then restart the app. The file is in `%APPDATA%\Claude` on Windows and in `~/Library/Application Support/Claude` on macOS; **Settings > Developer > Edit Config** opens it.

```json
{
  "mcpServers": {
    "black-gravity": {
      "command": "node",
      "args": ["<absolute path to plugin/server.mjs>"]
    }
  }
}
```

### OpenCode

**Supported.** Add the server under `mcp` in `opencode.json`, either in the project root or in `~/.config/opencode/opencode.json` for every project, with the absolute path to `plugin/server.mjs`, then restart OpenCode.

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "black-gravity": {
      "type": "local",
      "command": ["node", "<absolute path to plugin/server.mjs>"],
      "enabled": true
    }
  }
}
```

### agy

**Not verified.**

```powershell
$server = (Resolve-Path .\plugin\server.mjs).Path
agy mcp add black-gravity -- node $server
agy mcp list
```

### Other MCP clients

**Partial.** Only the server side was checked. Start `node <absolute path to plugin/server.mjs>` as a stdio server. The process reserves stdout for JSON-RPC.

### Linux and macOS

**Supported on Linux** for the Codex and Claude Code lines, checked on Ubuntu 26.04 by a user without root; the agy line is not verified. **Not verified on macOS.** These commands are the same registrations without PowerShell syntax. If `claude` is not on `PATH`, run the Claude Code CLI by its absolute path, as the check did.

```bash
server="$PWD/plugin/server.mjs"
codex mcp add black-gravity -- node "$server"
codex mcp list
claude mcp add --scope user black-gravity -- node "$server"
claude mcp list
agy mcp add black-gravity -- node "$server"
```

### OpenCode as a delegated write executor

OpenCode 2.4.3 can remove Git worktrees through its file-edit permission. The bridge denies edits to the worktree root and requires OS containment for writes. Use Linux with Bubblewrap that supports `--overlay`, working unprivileged user namespaces, and a kernel and filesystems that can mount the overlay. Windows and macOS support read-only delegation; `agy` remains available for writes there and when Linux containment is unavailable.

The bridge uses private configuration with fixed file-tool rules, without project/global MCP servers or plugins. Native account connections stored by OpenCode can be reused. A provider defined only in the user's global OpenCode configuration is unavailable to delegated writes. An explicit, saved or resumed model must be listed by the contained `models --standalone` catalog before the task is admitted (`MODEL_NOT_AVAILABLE` if absent).

Keep the project, bridge state, and native data in separate directories. The native `opencode` data directory and its SQLite files must belong to the current user, with no group/other write permissions; the files must be regular and have no aliases or extra links. The bridge mounts the native data as a read-only lower layer. The private writable upper layer can contain the database, session history and credentials; retained tasks keep it until discard. A task does not write a credential change back to the native store.

- `OPENCODE_WRITE_UNCONTAINED`: unsupported platform, unavailable Bubblewrap, or unsafe path overlap/alias. Use a supported Linux setup or separate the affected paths, as indicated.
- `OPENCODE_WRITE_RUNTIME_UNAVAILABLE`: the private overlay or native data could not be prepared. Check the mount requirements and the location, owner and types of the database files. `OPENCODE_NATIVE_DATA_UNSAFE_MODE` identifies group/other writability specifically; verify the owner and group before applying the suggested permission change.
- `OPENCODE_CONFIG_REFUSED`: the bridge could not verify that the effective configuration excludes inherited MCP servers and plugins. `OPENCODE_WRITE_RUNTIME_CLEANUP_FAILED` means the bridge could not remove the private overlay storage.
- `OPENCODE_COPY_DAMAGED`: the damaged copy cannot be previewed, integrated, reused, or removed by retention. Use `black_gravity_discard` for manual removal. If process cleanup is unverified, `PROCESS_CLEANUP_UNVERIFIED` can also block copy operations.
- `openCodeCredentialCheck` reports `unchanged`, `changed` with counts and available original account labels, or `unavailable` when the comparison could not be verified. Labels are bounded and filtered; a new connection without an original account cannot be identified, and legacy account rows may lack a provider. Affected connections may need a new login outside the task.

### Linux Bubblewrap test executor (`linux-bwrap`)

When `BRIDGE_TEST_EXECUTOR` is unset on Linux, `black_gravity_test` uses `linux-bwrap` only if startup detection finds `bwrap` and passes the user-namespace probe; otherwise it stays on `agy` (also selectable explicitly with `BRIDGE_TEST_EXECUTOR=agy`).

Use a distribution package if it supplies a usable Bubblewrap. For OpenCode writes, use the commands below only if the resulting version supports overlay mounts and the host can mount them. A version or `--help` check alone does not establish mount support. Without working Bubblewrap, `black_gravity_test` stays on `agy` when `BRIDGE_TEST_EXECUTOR` is unset.

```bash
sudo apt install bubblewrap    # Debian / Ubuntu
sudo dnf install bubblewrap    # Fedora / RHEL
sudo pacman -S bubblewrap      # Arch Linux
```

Then check, without root, whether Bubblewrap can create a user namespace:

```bash
bwrap --unshare-user --ro-bind / / true && echo ok
```

If it prints `ok`, skip the next step. On the verified Ubuntu 26.04.1 server, the `apparmor` package ships and loads a `bwrap` profile (`/etc/apparmor.d/bwrap-userns-restrict`) that allows user namespaces and confines the processes started by `bwrap`. Do not add the profile below where such a profile is loaded: `apparmor_parser -r` replaces any loaded profile with the same name, whatever the file name.

Where AppArmor restricts unprivileged user namespaces and no suitable profile is loaded, an administrator can grant `userns` specifically to `/usr/bin/bwrap`. This profile uses `flags=(unconfined)`, so it does not add AppArmor confinement to `bwrap` or its children. It leaves the system-wide user-namespace policy in place:

```bash
sudo tee /etc/apparmor.d/bwrap >/dev/null <<'EOF'
abi <abi/4.0>,
include <tunables/global>

profile bwrap /usr/bin/bwrap flags=(unconfined) {
  userns,

  include if exists <local/bwrap>
}
EOF
sudo apparmor_parser -r /etc/apparmor.d/bwrap
```

The mounts, seccomp filter, FIFO checks, refusals and threat model of the executor are described in [Linux Bubblewrap test executor](documentation/linux-executor.md).

### Build from source

```powershell
git clone https://github.com/Zythenth/black-gravity.git
cd black-gravity
npm.cmd ci
npm.cmd run build:plugin
```

The PowerShell examples use `npm.cmd`. Use `npm` on other platforms. See [installation and migration](documentation/setup.md) for standalone MCP registration, local tarballs, and upgrades. The published legacy package `antigravity-mcp-bridge` uses `antigravity_*` tools. See [available versions](documentation/setup.md#available-versions) for the Black Gravity names. If you use Windows LPAC, see [portable Node setup](documentation/windows-runtime.md#portable-node-runtime).

## First use

In a new Codex conversation, try:

> Use `$black-gravity` to inspect the selected files and report findings in read-only mode.

The skill guides model selection, waiting, and review. For a standalone MCP setup, call `black_gravity_health` to check the CLI, tool profile, and approval mode, then call `black_gravity_list_models` before choosing a model. See [task management](documentation/task-management.md) and [review and integration](documentation/review-and-integration.md).

Managed `agy` tasks can create and reuse a project even when the Antigravity app has unrelated records named like `owner/repo`. Those names cannot be selected through `BRIDGE_AGY_PROJECTS`, but the records still count in ID and folder conflict checks. The bridge reads the registry without editing it and never falls back to the default project. See [Antigravity project setup](documentation/configuration-and-security.md#register-an-antigravity-project-for-a-repository).

## Requirements

- Node.js 24 or newer, with npm. Windows LPAC has [additional runtime requirements](documentation/windows-runtime.md).
- Git 2.32 or newer on an absolute `PATH` entry.
- The [official Antigravity CLI](https://www.antigravity.google/docs/cli/install/) on `PATH` or configured by absolute `AGY_PATH`, with authentication completed in `agy`.

Black Gravity [disables automatic updates](https://antigravity.google/docs/cli/troubleshooting/) only for `agy` processes it starts. To update the CLI outside the bridge, open `agy` directly in your terminal or run `agy update`.

## Host permissions

`black-gravity permissions` prints host rules to review and merge into the host configuration. From the source checkout:

```powershell
node plugin/server.mjs permissions --host claude-code
node plugin/server.mjs permissions --host codex
```

Host approval and the bridge’s `BRIDGE_APPROVAL_MODE` apply independently. The default `auto` mode applies verified patches without a bridge confirmation form. Set `BRIDGE_APPROVAL_MODE=ask` to require the form. See [host permissions](documentation/configuration-and-security.md#host-permissions) for presets, placement, and the verification limit for per-tool Codex approvals.

## Links

- [Installation and migration](documentation/setup.md)
- [Portable Node on Windows](documentation/windows-runtime.md)
- [Task management](documentation/task-management.md)
- [Task groups, workflows, and specialist controls](documentation/groups.md)
- [Tool profiles and catalog](documentation/tools.md)
- [Review, integration, and testing](documentation/review-and-integration.md)
- [Configuration, isolation, and security](documentation/configuration-and-security.md)
- [Changelog](CHANGELOG.md) · [MIT License](LICENSE) · [Security policy](SECURITY.md) · [Privacy policy](PRIVACY.md) · [Dependency notices](THIRD_PARTY_NOTICES.md)

TDQS

B3.4/5.0

Scored across 23 tools

Disambiguation4/5

Tools generally target distinct lifecycle stages (run/resume/cancel, preview/read_patch/read_result, test/verify/integrate), but several reading/status tools have adjacent purposes. The descriptions help separate result vs read_result and preview vs read_patch, though an agent could still confuse them.

Naming Consistency4/5

All tools consistently use the antigravity_ prefix with snake_case, which makes the set predictable. Most names are verb_noun or verb_noun-phrase, but some are noun-only query tools (usage, status, tasks, events, result, sessions), a minor deviation from a strict pattern.

Tool Count3/5

23 tools is heavy for a single MCP server and sits in the borderline 16-25 range. The domain is complex, but several output-reading and status tools could be consolidated, making the surface feel somewhat over-scoped.

Completeness4/5

The surface covers model selection, task lifecycle, file listing, patch/result reading, testing, verification, integration, and cleanup. Minor gaps exist, such as no explicit authentication/login tool or direct source-file read outside task artifacts, but core workflows are covered.

Maintenance

ActivityActive
ResponsivenessNo recent community issues