nandhakumar-murugan

⚡ Gemini Antigravity Bridge

Updated

⚡ Bridge connecting Google Gemini Spark & Cloud AI to your local machine via Model Context Protocol (MCP). Autonomous file creation, terminal execution, and subagent orchestration — all from a single chat prompt.

       

⚡ Gemini Antigravity Bridge

The Open-Source Bridge Connecting Google Gemini & Cloud AI to Your Local Machine via the Model Context Protocol

Model Context ProtocolGemini SparkGoogle CloudPythonngrokMIT LicenseCI/CDGitHub Stars

Verified Proof of Concept: A single Gemini Spark prompt — "Create a calculator with unit tests" — produced, ran, and committed working Python code to GitHub in under 3 seconds. Zero human copy-pasting.

Architecture • Tools API • Quickstart • Google Ecosystem • Developer Docs • Resources & Links • Benefits

🧩 What Is This Project?

Gemini Antigravity Bridge breaks the barrier between Cloud AI and your local machine. It runs a local Model Context Protocol (MCP) server that exposes your entire operating system — terminal, files, compilers, and Git — to any MCP-compatible AI orchestrator over a secure HTTPS tunnel.

Connect it to Google Gemini Spark and you get a fully autonomous AI Software Engineer that can plan, code, test, fix, and ship software directly on your disk.

🏗️ System Architecture

┌────────────────────────────────────────────────────────────────────┐
│                🌐  GOOGLE CLOUD ECOSYSTEM                          │
│                                                                    │
│  ┌─────────────────┐  ┌──────────────────┐  ┌─────────────────┐  │
│  │  Gemini Spark   │  │  Google Workspace │  │  Vertex AI /    │  │
│  │  (Orchestrator) │  │  Docs/Drive/Gmail │  │  Cloud Run      │  │
│  └────────┬────────┘  └──────────────────┘  └─────────────────┘  │
└───────────┼────────────────────────────────────────────────────────┘
            │  JSON-RPC 2.0 (Streamable HTTP / SSE)
            │  HTTPS via ngrok / Cloudflare Tunnel
┌───────────▼────────────────────────────────────────────────────────┐
│          ⚡  ANTIGRAVITY MCP BRIDGE  (Your Machine)                │
│                                                                    │
│   /mcp  (Streamable HTTP)    /sse  (Server-Sent Events)           │
│   CORS · Authentication · 7 Registered MCP Tools                  │
│                                                                    │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────────┐ │
│  │  File System │  │   Terminal   │  │  Antigravity Subagents   │ │
│  │  Read/Write  │  │  Shell/CMD   │  │  (Autonomous Tasks)      │ │
│  └──────────────┘  └──────────────┘  └──────────────────────────┘ │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────────┐ │
│  │   Python     │  │  Node.js/npm │  │   Git / Docker / CI      │ │
│  └──────────────┘  └──────────────┘  └──────────────────────────┘ │
└────────────────────────────────────────────────────────────────────┘

Transport Protocol

Endpoint Protocol Best For
/mcp Streamable HTTP (MCP 2.0) Google Gemini Spark, Vertex AI, all modern MCP clients
/sse Server-Sent Events (SSE) Legacy MCP clients, custom integrations
/messages HTTP POST Posting messages in SSE sessions

🧰 Complete Tools Reference

🔧 Tool 1: run_system_command

Execute any shell, PowerShell or Bash command. Captures exit code, stdout, stderr.

Param Type Required Description
command string Full shell command to execute
working_dir string Working directory path (defaults to CWD)
// Example: Run Python unit tests
{
  "name": "run_system_command",
  "arguments": {
    "command": "python -m pytest tests/ -v",
    "working_dir": "C:/Users/dev/myproject"
  }
}

Use for: Running Python/Node/Java/Rust, pip install, npm install, git operations, test runners, Docker, CI pipelines.

📝 Tool 2: write_file

Create or overwrite any file on disk with AI-generated content. Auto-creates directories.

Param Type Required Description
file_path string Absolute or relative file path
content string Full content to write
// Example: Write a FastAPI route
{
  "name": "write_file",
  "arguments": {
    "file_path": "src/api/routes.py",
    "content": "from fastapi import APIRouter\nrouter = APIRouter()\n\[email protected]('/health')\ndef health(): return {'status': 'ok'}"
  }
}

Use for: Writing source code, configs, Dockerfiles, GitHub Actions YAML, Markdown docs, .env files.

📖 Tool 3: read_file

Read and return the full content of any local file.

Param Type Required Description
file_path string Path to the file
{
  "name": "read_file",
  "arguments": { "file_path": "src/main.py" }
}

Use for: Inspecting code before refactoring, reading logs, auditing configs, reading datasets.

📂 Tool 4: list_directory

Enumerate files and directories with type and size.

Param Type Required Description
directory_path string Directory to list (defaults to CWD)
{
  "name": "list_directory",
  "arguments": { "directory_path": "C:/Users/dev/myproject" }
}

Use for: Discovering project structure, verifying files were created, auditing repos.

🤖 Tool 5: run_agent_task

Spawn an autonomous long-running Antigravity AI subagent for complex multi-step goals. Returns instantly with a task_id.

Param Type Required Description
prompt string High-level natural language objective
workspace_dir string Directory for the agent to operate in
{
  "name": "run_agent_task",
  "arguments": {
    "prompt": "Refactor all Python files to use async/await. Run tests after each file.",
    "workspace_dir": "C:/Users/dev/myproject"
  }
}

Use for: Large-scale refactoring, full feature development, autonomous TDD, security audits.

📊 Tool 6: get_agent_status

Poll the live progress, output, and errors of a background subagent task.

Param Type Required Description
task_id string Task ID from run_agent_task
{
  "name": "get_agent_status",
  "arguments": { "task_id": "a1b2c3d4" }
}
// Returns: { "status": "completed", "output": "...", "error": null }

📦 Tool 8: create_full_project (1-Click Composite)

Creates an entire project directory, writes all code files, and executes initial setup/test commands in a single tool call with 1 permission confirmation.

Param Type Required Description
project_name string Folder name of the new project
files object Dictionary of {"filename": "content"}
setup_commands array List of shell commands to run after creation

⚡ Tool 9: batch_write_files (Composite)

Writes or updates multiple files at once in a single dictionary mapping. Reduces permission prompts from N to 1.

Param Type Required Description
files object {"src/app.py": "...", "tests/test.py": "..."}
base_dir string Root directory for files

💻 Tool 10: run_batch_commands (Composite)

Executes a sequence of shell/PowerShell commands in order within a single tool call.

Param Type Required Description
commands array ["pip install -r requirements.txt", "pytest"]
working_dir string Target working directory
stop_on_error boolean Halts sequence if a command fails (default: true)

✏️ Tool 11: edit_file

Performs surgical search-and-replace on existing files without rewriting the entire file.

Param Type Required Description
file_path string Path to file to modify
find_text string Exact string to search for
replace_text string Replacement content

➕ Tool 12: append_file

Appends content to the end of a file (or creates it if missing).

Param Type Required Description
file_path string File path
content string Text to append

💬 Tool 13: list_antigravity_conversations

Lists all active Antigravity conversations and projects with real sidebar titles, message counts, task counts, and conversation IDs.

📨 Tool 14: inject_message

Injects instructions directly into any Antigravity conversation inbox, waking the Antigravity Language Server engine.

Param Type Required Description
conversation_id string Target Antigravity conversation UUID
message string Message content
title string Message title notification

🧠 Tool 15: get_bridge_history / save_session_note

Cross-client persistent memory shared between Gemini Spark and Antigravity.

🔗 Google Ecosystem Integration

Gemini Spark

Connect your bridge to Gemini via Custom Connected Apps.

Google Cloud

Deploy the bridge to Cloud or integrate with Cloud AI.

Vertex AI

Enterprise-grade AI orchestration with local execution.

Google Workspace

Use Docs, Drive, Gmail as AI context sources.

📚 Official Documentation & External Resources

🔵 Model Context Protocol (MCP)

Resource Link
🏠 MCP Official Website modelcontextprotocol.io
📖 MCP Introduction modelcontextprotocol.io/introduction
📖 MCP Quickstart Guide modelcontextprotocol.io/quickstart
📖 MCP Specification spec.modelcontextprotocol.io
🐍 Python MCP SDK (Official) github.com/modelcontextprotocol/python-sdk
📦 MCP on PyPI pypi.org/project/mcp
🐙 MCP GitHub Organization github.com/modelcontextprotocol
📖 MCP Transports Reference modelcontextprotocol.io/docs/concepts/transports
📖 MCP Tools Reference modelcontextprotocol.io/docs/concepts/tools

🟣 Google Antigravity (AGY)

Resource Link
🏠 Antigravity Home antigravity.google
📖 Antigravity Docs antigravity.google/docs
📖 MCP Integration Guide antigravity.google/docs/mcp
📖 Skills System antigravity.google/docs/skills
📖 Python SDK antigravity.google/docs/sdk
📖 Hooks & Plugins antigravity.google/docs/hooks
📖 Agent Permissions antigravity.google/docs/permissions
📖 Changelog antigravity.google/changelog

🔵 Google Gemini & AI APIs

Resource Link
🏠 Google Gemini App gemini.google.com
📖 Gemini API Documentation ai.google.dev/gemini-api/docs
📖 Gemini API Quickstart ai.google.dev/gemini-api/docs/quickstart
📖 Gemini for Google Workspace workspace.google.com/intl/en/products/gemini
📖 Google AI Studio aistudio.google.com
📖 Connected Apps (MCP) Help support.google.com/gemini?p=lm_custom_mcp_trust
🐙 Google Generative AI GitHub github.com/google-gemini

☁️ Google Cloud Platform

Resource Link
🏠 Google Cloud Console console.cloud.google.com
📖 Vertex AI Documentation cloud.google.com/vertex-ai/docs
📖 Cloud Run Documentation cloud.google.com/run/docs
📖 Cloud Build Documentation cloud.google.com/build/docs
📖 Google Cloud APIs Explorer cloud.google.com/apis
📖 AI & Machine Learning Products cloud.google.com/products/ai

🐍 Python & Core Libraries

Resource Link
🏠 Python Official Website python.org
📖 Python Docs docs.python.org/3
📦 PyPI Package Index pypi.org
📖 pip Documentation pip.pypa.io/en/stable
📖 asyncio Documentation docs.python.org/3/library/asyncio.html
📖 subprocess Documentation docs.python.org/3/library/subprocess.html

🌐 Web & ASGI Framework

Resource Link
🏠 Uvicorn (ASGI Server) uvicorn.org
📖 Uvicorn Docs uvicorn.org/settings
🏠 Starlette Framework starlette.io
📖 Starlette Docs starlette.io/applications
📖 Starlette Routing starlette.io/routing
📖 CORS Middleware starlette.io/middleware/#corsmiddleware
🏠 FastAPI fastapi.tiangolo.com
📖 FastAPI Docs fastapi.tiangolo.com/tutorial

🔒 Tunneling & Secure Exposure

Resource Link
🏠 ngrok Official Website ngrok.com
📖 ngrok Documentation ngrok.com/docs
📖 ngrok HTTP Tunnels ngrok.com/docs/http
📦 pyngrok (Python SDK) pypi.org/project/pyngrok
📖 pyngrok Docs pyngrok.readthedocs.io
🏠 Cloudflare Tunnel cloudflare.com/products/tunnel
📖 Cloudflare Tunnel Docs developers.cloudflare.com/cloudflare-one/connections/connect-networks

📡 JSON-RPC & SSE Specifications

Resource Link
📖 JSON-RPC 2.0 Specification jsonrpc.org/specification
📖 Server-Sent Events (SSE) — MDN developer.mozilla.org/en-US/docs/Web/API/Server-sent_events
📖 HTTP Status Codes — MDN developer.mozilla.org/en-US/docs/Web/HTTP/Status

🔧 Development Tools

Resource Link
🏠 Git git-scm.com
📖 Git Documentation git-scm.com/doc
🏠 GitHub github.com
📖 GitHub CLI (gh) cli.github.com
🏠 Python IDLE docs.python.org/3/library/idle.html
📖 pytest Testing Framework docs.pytest.org
📖 unittest (Built-in) docs.python.org/3/library/unittest.html

🚀 Quickstart

Prerequisites

PythonngrokGit

Step 1 — Clone & Install

git clone https://github.com/nandhakumar-murugan/antigravity-mcp-bridge.git
cd antigravity-mcp-bridge
pip install -r requirements.txt

Step 2 — Add Your ngrok Token

Get your token at dashboard.ngrok.com/get-started/your-authtoken

Edit run_with_tunnel.py:

AUTHTOKEN = "your_ngrok_authtoken_here"

Step 3 — Launch

# Windows (Double-click or run):
start_server.bat

# macOS / Linux:
python run_with_tunnel.py

Output:

[INFO] NGROK MCP TUNNEL IS LIVE!
[LINK] PASTE THIS IN GEMINI SPARK: https://xxxx.ngrok-free.dev/mcp

Step 4 — Connect to Gemini Spark

  1. Open gemini.google.com
  2. Go to Settings → Custom Connected Apps
  3. Paste: https://xxxx.ngrok-free.dev/mcp
  4. Accept permissions → Click Save
  5. Type @Antigravity System Bridge in any chat to activate!

💻 Developer Integration Guide

Python (Official MCP SDK)

import asyncio
from mcp.client.session import ClientSession
from mcp.client.streamable_http import streamable_http_client

async def main():
    url = "https://xxxx.ngrok-free.dev/mcp"
    async with streamable_http_client(url) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print([t.name for t in tools.tools])

            # Run a command
            result = await session.call_tool("run_system_command", {
                "command": "python --version"
            })
            print(result.content[0].text)

asyncio.run(main())

cURL (Any Language)

curl -X POST https://xxxx.ngrok-free.dev/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"my-app","version":"1.0"}}}'

Claude Desktop Config

{
  "mcpServers": {
    "antigravity-bridge": {
      "command": "python",
      "args": ["run_with_tunnel.py"],
      "env": { "NGROK_AUTHTOKEN": "your_token" }
    }
  }
}

👥 Who Benefits

🎓 Students

  • See real code written and run on your disk — not in fake sandboxes
  • AI handles pip install, virtual environments, and PATH setup for you
  • Learn debugging by watching the AI fix real terminal errors live

💻 Engineers

  • Full autonomous TDD: AI writes code → runs tests → fixes failures → repeats
  • Delegate entire features: "Build a REST API with auth" → done in minutes
  • No more copy-pasting between chat and editor

🔬 Researchers

  • Run local Python pipelines without uploading sensitive data to the cloud
  • Automate experiment scripts, benchmarks, and data analysis conversationally
  • Use local GPU compute via terminal commands

📁 Project Structure

antigravity-mcp-bridge/
├── server.py               # Core MCP server with all 7 tool definitions
├── run_with_tunnel.py      # One-click launcher (server + ngrok tunnel)
├── start_server.bat        # Windows double-click starter
├── test_client.py          # MCP connection verification script
├── calculator.py           # Example: AI-generated code via Gemini Spark
├── test_calculator.py      # Example: AI-generated tests (all 6 passed)
├── requirements.txt        # Python dependencies
├── .gitignore
├── LICENSE                 # MIT
└── README.md

📦 requirements.txt

mcp>=2.0.0
uvicorn
fastapi
pyngrok
python-dotenv

🛡️ Security

  • All traffic is TLS-encrypted via ngrok HTTPS
  • ngrok Authtoken prevents unauthorized access
  • 180-second command timeout on all terminal executions
  • terminate_task immediately halts any running subagent
  • All operations are fully visible in your local terminal

📄 License

MIT License — see LICENSE for details.

Built with the Google Ecosystem. Powered by Open Standards.

GeminiCloudMCPPythonngrokGitHub

⭐ Star this repo if it helped you! | 🍴 Fork to customize for your team

🐛 Report Issues · 💬 Discussions · 🤝 Contribute

MCP Server · Populars

MCP Server · New

    weed33834

    🛡️ AgentSeed

    AgentSeed - anti-hallucination guardrails for AI coding agents: hybrid Skill + MCP plugin (Agent Plugins 1.0.0) that forces spec-driven development and verifies code before it is marked done.

    Community weed33834
    geolens-io

    GeoLens

    Self-hosted geospatial data catalog with semantic search (pgvector), OGC/STAC APIs, and map builder. Built on FastAPI, PostGIS, React, and MapLibre.

    Community geolens-io
    leonardosepulvedat

    MCP n8n Server

    Complete n8n API integration for Claude Desktop and Cursor - 100 workflow templates with intelligent matching

    Community leonardosepulvedat
    maximhq

    Bifrost AI Gateway

    The Fastest LLM Gateway with built in OTel observability and MCP gateway

    Community maximhq
    crisnahine

    rails-ai-context

    45 MCP tools that give AI coding agents ground truth about your Rails app: schema, models, routes, controllers, views, jobs, conventions. Works with Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI. MCP or CLI, in-Gemfile or standalone, and it still answers when the app can't boot.

    Community crisnahine