antigravity-with-chatgpt
Provides a bridge to ChatGPT Web, enabling delegation of reasoning, planning, review, derivation, and diagnostic tasks from a local agent to OpenAI's models (GPT-4o, o1, o3) via a Chrome DevTools Protocol.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@antigravity-with-chatgptreview my latest git diff and flag any issues"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ο»Ώ
π antigravity-with-chatgpt
Zero-Dependency Dual-Brain Reasoning & Verification Architecture for Google Antigravity 2.0 & Gemini
Harness the full reasoning power of ChatGPT Web (GPT-4o, o1, o3, Canvas) as an independent cloud brain for your local Antigravity 2.0 IDE.
π Background & Design Philosophy
When developing with modern agentic coding assistants, local agents like Google Antigravity 2.0 IDE, Gemini CLI, and Claude Code have deep local authority (file I/O, terminal execution, running tests, Git version control). However, when tackling complex architectural refactoring, algorithmic derivation, subtle root-cause debugging, or rigorous code reviews, a single model within a shared context often suffers from confirmation bias and self-rationalizing hallucinations.
Inspired by the notable community project XiaoDuoYa/codex-with-chatgpt ("ChatGPT thinks. Codex works.") and shaped by ChatGPT's rigorous 38-point architectural code review, antigravity-with-chatgpt establishes a robust Proxy-Pull Context Broker pattern:
Local Agent Owns Execution: File edits, shell terminal commands, build pipelines, and unit tests strictly belong to Antigravity.
ChatGPT Owns Reasoning & Review: High-level task planning, mathematical derivations, and adversarial code reviews are delegated to ChatGPT Web.
Zero API Key Consumption: Reuses your existing authenticated ChatGPT Plus/Pro web session in a dedicated Chrome profileβunlimited access to GPT-4o, o1, and o3 without API costs.
Zero npm Dependencies: Written entirely in native Node.js 22+ standard library (native WebSocket, fetch, crypto, child_process)βlightning fast startup, zero supply-chain attack surface.
Related MCP server: cdp-tools-mcp
π Key Features
β‘ Sub-Millisecond DOM Injection: Utilizes
execCommand('insertText')combined with Base64 encoding to bypass ProseMirror per-character event overhead, injecting 10,000+ characters in under 5ms.π‘οΈ Production-Grade Security Boundary:
path_guard.mjs: Platform-aware relative path containment, strictly preventing../traversal, NUL byte injection, and symlink breakout.sensitive.mjs: Blocks.env*, SSH keys, and certificates; automatically redacts OpenAI API keys, GitHub tokens, AWS credentials, and Bearer tokens.Egress Sanitization: Ensures every character crossing the browser boundaryβincluding Git diffs and execution test outputβpasses through an ultimate redaction filter.
π Closed-Loop Independent Verification:
Automatically captures budgeted
git diffoutputs and persistent test execution records.Anti-flattery enforcement: Without empirical execution evidence, ChatGPT will actively refuse blind approval and issue an actionable
[CHANGES REQUESTED]report.
π Single-Flight Concurrency Mutex:
Built-in
AsyncMutexserializes concurrent MCP requests targeting the same Chrome tab, preventing prompt interleaving and signal crossing.
π― Five Specialized Operational Modes:
ask: Everyday technical questions and conversational reasoning.plan: Structured planning with RATIONALE, ACTIONS, RISKS, and CRITERIA.review: Closed-loop verification of real Git diffs and execution evidence.derive: Pure mathematical and algorithmic derivation (code files isolated to eliminate noise).diagnose: Root-cause failure analysis with minimal reproduction steps.
ποΈ Four-Layer Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Antigravity 2.0 / Gemini β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β JSON-RPC 2.0 stdio / CLI
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β 1. Access Layer (scripts/) β
β - ask_chatgpt.mjs: Thin, expressive CLI entrypoint β
β - mcp_server.mjs: Antigravity 2.0 Native MCP Server β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 2. Orchestration & Protocol (src/brain/) β
β - orchestrator.mjs: Proxy-Pull Context Broker β
β - prompts.mjs: [ANTIGRAVITY-BRIDGE/1] 5 Mode Envelopesβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 3. Security & Evidence Layer (src/security/, workspace/)β
β - path_guard.mjs: Canonical Realpath Traversal Guard β
β - sensitive.mjs: Secret Redaction & .env Blocking β
β - ignore.mjs: .brainignore Rule Parser β
β - context_provider.mjs: Safe Read-Only Slicing β
β - git_helper.mjs: Read-Only Budgeted Git Diff β
β - recorder.mjs: Execution Evidence Recorder β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 4. Transport Layer (src/transport/) β
β - cdp_transport.mjs: Native CDP Driver (Port 9222) β
β * AsyncMutex single-flight serialization β
β * Base64 fast ProseMirror text injection β
β * Double-hash multi-sampling + MutationObserver β
β * Event-driven WebSocket lifecycle & cleanup β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β Chrome DevTools Protocol
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β Dedicated Chrome Profile (127.0.0.1:9222) β
β βββ ChatGPT Web UI (https://chatgpt.com/) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββπ οΈ Configuring MCP in Antigravity 2.0
Google Antigravity 2.0 natively integrates external tools via the standard Model Context Protocol (MCP).
Step 1: Prerequisites
Node.js:
>= 22.0.0(uses global nativeWebSocketandfetchβno npm install needed).Google Chrome: Standard desktop installation.
Step 2: Start the Dedicated Chrome Session
To keep your daily browser data separate, launch Chrome with an isolated user profile (chrome-profile) and local CDP remote debugging on port 9222:
Windows PowerShell:
& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
--remote-debugging-port=9222 `
--remote-debugging-address=127.0.0.1 `
--remote-allow-origins=* `
--user-data-dir="D:\ChatGPT-Brain-Bridge\chrome-profile" `
https://chatgpt.comTip: On first launch, log in to your ChatGPT account once. Your session will be permanently preserved in
chrome-profile, requiring no future logins.
Step 3: Configure Antigravity 2.0 Global MCP Config
Edit your global MCP configuration file:
Windows:
C:\Users\<YourUsername>\.gemini\config\mcp_config.jsonLinux/macOS:
~/.gemini/config/mcp_config.json
Add antigravity-with-chatgpt under mcpServers:
{
"mcpServers": {
"antigravity-with-chatgpt": {
"command": "node",
"args": [
"D:\\ChatGPT-Brain-Bridge\\gemini-skill\\antigravity-with-chatgpt\\scripts\\mcp_server.mjs"
]
}
}
}Note: Update the path to match where you cloned the repository. Remember to use double backslashes
\\on Windows.
Step 4: Verification in Antigravity 2.0
Restart Antigravity 2.0. The agent will discover the tools automatically. You can instruct the agent naturally:
"Please ask ChatGPT in plan mode to design a high-throughput message queue architecture for this service."Antigravity will dispatch the MCP tool call:
{
"name": "ask_chatgpt",
"arguments": {
"mode": "plan",
"prompt": "Design a high-throughput message queue architecture"
}
}π» CLI Usage
You can also interact with the bridge directly from your terminal:
# 1. Ask a question (reuses active web session)
node scripts/ask_chatgpt.mjs "Explain the differences between Linux epoll LT and ET modes"
# 2. Start a fresh conversation (--new)
node scripts/ask_chatgpt.mjs --new "Evaluate Raft vs Paxos for distributed consensus"
# 3. Architectural Planning Mode (--plan)
node scripts/ask_chatgpt.mjs --plan "Refactor the authentication module to stateless JWT"
# 4. Closed-Loop Review Mode (--review, auto-injects real Git Diff & test evidence)
node scripts/ask_chatgpt.mjs --review "Review recent changes for security regressions"
# 5. Algorithmic Derivation Mode (--derive, noise-free math reasoning)
node scripts/ask_chatgpt.mjs --derive "Derive the variance formula for consistent hashing virtual nodes"
# 6. Root-Cause Diagnostics (--diagnose)
node scripts/ask_chatgpt.mjs --diagnose "Analyze ECONNRESET errors during test execution"
# 7. Attach Local Source Files (--attach, with automatic path guard & secret redaction)
node scripts/ask_chatgpt.mjs --attach src/auth.ts src/server.ts "Analyze thread-safety"
# 8. Run Environment Doctor (--doctor)
node scripts/ask_chatgpt.mjs --doctorπ§° MCP Tool Reference
Tool | Description | Key Parameters |
| Delegates complex reasoning, planning, or review to ChatGPT Web |
|
| Probes Chrome CDP 9222 connectivity and workspace readiness |
|
| Stores command execution and test results for closed-loop review |
|
π§ͺ Testing & Verification
Run the comprehensive test suite:
# Run baseline installation & component verification
node scripts/verify_install.mjs
# Run adversarial security & concurrency tests
node tests/security_adversarial.test.mjsResults:
β 48 / 48 Tests Passed (100%)
Path traversal, NUL injection & case-sensitivity: 5/5
Multi-line PEM, spaced secret assignment & Bearer token redaction: 5/5
Egress sanitization leakage prevention: 2/2
Orchestrator defensive contract validation: 2/2
Core component integrity & CDP live probing: 34/34
π License
Open-sourced under the MIT License. Contributions, feedback, and pull requests are warmly welcome!
This server cannot be deployed
Maintenance
Related MCP Connectors
Browser-backed QA with evidence and fix-ready reports for coding agents.
A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,
- openhelmOAuthai.openhelm
Autonomous cloud agent tasks: real browser + your tools, structured evidence-backed results.
Governance layer for AI coding agents: knowledge-graph grounding, session audit, policy controls.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser for automation, debugging, performance analysis, network monitoring, and DOM interaction through Chrome DevTools Protocol.1,516,489 npmApache 2.0
- AlicenseBqualityAmaintenanceEnables AI agents to debug code and automate browsers using Chrome DevTools Protocol, supporting breakpoints, variable inspection, and replayable interaction recording.35545 npm16MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser through Chrome DevTools for automation, debugging, and performance analysis.1,516,489 npmApache 2.0
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to declaratively control web pages using real mouse and keyboard events via Chrome DevTools Protocol, without executing page JavaScript.9 npm1-