claude-to-agy
A lightweight MCP bridge that lets Claude Code delegate heavy tasks to the Antigravity CLI - saving context window and tokens for what matters.
README
claude-to-agy
A lightweight MCP bridge that lets Claude Code delegate heavy tasks to the Antigravity CLI (agy) - saving context window and tokens for what matters.
What It Does
Registers a delegate_to_agy MCP tool that Claude automatically uses when it encounters:
- Large files (>200 lines) - logs, dumps, generated code
- Multi-file analysis (>3 files at once)
- Deep searches -
git log,git diff,grep - Web lookups - documentation, external knowledge
- Adversarial review / plan critique - always delegated
Claude sends a prompt + file paths → the bridge runs agy CLI → returns the result.
Requirements
- Python 3.12+
agyCLI installed and authenticated- Claude Code
Installation
# 1. Clone anywhere on your machine
git clone https://github.com/rauls-kjarners/claude-to-agy.git ~/.claude-to-agy
# 2. Register the MCP server (global - works in any project)
claude mcp add -s user claude-to-agy python3 ~/.claude-to-agy/src/bridge.py
# 3. Copy the rules file into any project where you want delegation
cp ~/.claude-to-agy/CLAUDE.md /path/to/your/project/CLAUDE.md
# 4. (Optional) Add the PreToolUse hook to enforce delegation for subagents
Then merge the following into your ~/.claude/settings.json (or per-project .claude/settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude-to-agy/src/hooks/block-direct-commands.py",
"onError": "block"
}
]
}
]
}
}
That's it. Claude will now automatically delegate heavy tasks to Antigravity CLI in any project that has the CLAUDE.md file.
Tip: To enable globally without copying
CLAUDE.mdper project, add the rules to~/.claude/CLAUDE.mdinstead.
Why the Hook Matters
CLAUDE.md rules only apply to the main Claude agent. Subagents (spawned via run_subagent or similar) do not read CLAUDE.md and will run grep -r, git diff, etc. directly — wasting tokens and defeating the purpose of delegation.
The PreToolUse hook runs at the Claude Code platform level for all agents (main + sub), mechanically blocking banned commands before they execute.
Using as a Skill
This project also includes a SKILL.md file, which is the standard format for reusable Claude Code skills. If your setup supports skills, you can use it instead of manually copying CLAUDE.md:
claude skill add ~/.claude-to-agy/SKILL.md
Note: You still need the MCP server registered (step 2 above). The skill provides the rules, MCP provides the tool.
Configuration
All settings are optional environment variables:
| Variable | Default | Description |
|---|---|---|
AGY_CONNECT_TIMEOUT |
60 |
Seconds to start the agy process |
AGY_TOTAL_TIMEOUT |
600 |
Hard timeout for entire execution |
How It Works
User → Claude Code → MCP bridge (bridge.py) → agy CLI → Gemini API
← ← ←
CLAUDE.mdinstructs Claude when to delegate- Claude calls
delegate_to_agy(prompt, cwd, files?)via MCP bridge.pyprepends file paths to the prompt- Runs
agy --dangerously-skip-permissions --add-dir <cwd> -p "<prompt>" - Returns
{"success": true, "response": "..."}or{"success": false, "error": "..."}back to Claude
Development
python -m pytest tests/ -v
License
Apache 2.0
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.