agy-codemode
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
agy-codemode
Zero-dependency Anthropic-style Code Execution with MCP plugin for Google Antigravity 2.x.
Features · Architecture · Installation · Usage · Configuration · Security · Development
Why agy-codemode?
Traditional MCP setups inject every connected server's tool list and JSON schemas into context on every turn, and force multi-step tool calls (loops, pagination, filtering) to round-trip raw payloads through the model.
agy-codemode collapses all upstream MCP servers — including installed Antigravity Marketplace plugins — into 2 lazy MCP tools:
codemode_search— BM25 + progressive disclosure over synced servers, instructions, skills, and typed tool stubs (names,summary, orfull).codemode_execute— executes model-written TypeScript/ESM in an isolated sandbox (bwrap --unshare-net+ Node--permission) so the agent batches calls withPromise.all, filters payloads locally, and returns only the compact summary.
Related MCP server: codemodekit
Features
Zero External Dependencies: Pure Node.js 22 ESM using native TypeScript stripping (
--experimental-strip-types),node:test, andnode:net.Antigravity Customizations & Marketplace Auto-Discovery: Read-only scanner for
~/.gemini/config/plugins/(plugin.jsonJSONC +mcp_config.json) and~/.gemini/config/config.json, expanding${PLUGIN_ROOT},${PLUGIN_DATA},${userHome}, and${env:VAR:-default}.Zero-Spawn Schema Fast-Path: Reads Antigravity's existing
~/.gemini/antigravity/mcp/<plugin>_<server>/cache for IDE-enabled plugins without spawning duplicate stdio processes or hitting file locks.Auto-Managed Server Roster (
AGENTS.md): Maintains a compact<!-- CODEMODE_ROSTER:START/END -->block (~15 tokens/server) so disabled/offloaded plugins remain discoverable without bloating<mcp_servers>.Zero-Symlink Skill Preservation (
keep-skills): Keepsskills/from disabled MCP plugins active via Antigravity's official~/.gemini/config/skills.jsonwithout editingconfig.json.Smart Safety Classification: Automatically skips self-recursion / meta-plugins, detects OAuth-protected HTTP servers (
401→oauth-keep-native), and preserves MCP App UI tools (_meta.ui.resourceUri→mcp-app-ui).Pre-Imported
nativeGlobals:readFile,runCommand,manageTask,writeFile, andeditFileare pre-imported incodemode_executefor multi-file audits, grep/filter pipelines, and batched test runs, while hybrid routing keeps user-facing edits on native Antigravity tools for Undo/diff UI support.Incremental Hash Sync & Idle Reaper: Per-server
configHashcaching, bounded sync concurrency, automatic mid-session delta resync on config changes, and a 10-minute.unref()'d idle reaper for stdio children.Layered Sandbox & Secret Redaction: Runs scripts under Bubblewrap (
bwrap --unshare-net) + Node--permission, keeps upstream credentials strictly inside the broker process, and dynamically redacts configured secrets from stdout/stderr.
Architecture
flowchart LR
AGY["Antigravity Agent"] -->|codemode_search / codemode_execute| BROKER["agy-codemode Broker (Node 22)"]
BROKER -->|Read-Only Scan| PLUGINS["~/.gemini/config/plugins/ + servers.json"]
BROKER -->|Generates Typed Stubs| STUBS["~/.gemini/codemode/servers/<server>/<tool>.ts"]
BROKER -->|Per-Run Auth UDS| SANDBOX["Sandbox (bwrap --unshare-net + node --permission)"]
SANDBOX -->|Imports .ts Stubs + Native Globals| BROKER
BROKER -->|Stdio / Streamable HTTP| UPSTREAM["Upstream MCP Servers (Broker-Held Credentials)"]Requirements
Node.js
>= 22.0.0(for native TypeScript execution and--permissionflag)Bubblewrap (
bwrap) on Linux (recommended; falls back tonode --permissionwith tightened FS read allowlists if unavailable)Google Antigravity 2.x (Desktop App, IDE, or CLI)
Installation
Quick Install (Linux / macOS)
git clone https://github.com/mochmizan/agy-codemode.git ~/agy-codemode
cd ~/agy-codemode
./install.shThe installer symlinks ./plugin to ~/.gemini/config/plugins/agy-codemode and runs doctor to verify your environment. It never modifies ~/.gemini/config/config.json.
Manual Install
mkdir -p ~/.gemini/config/plugins
ln -sfn "$(pwd)/plugin" ~/.gemini/config/plugins/agy-codemode
node plugin/bin/agy-codemode.mjs doctor
node plugin/bin/agy-codemode.mjs syncReload Antigravity (or start a new conversation) to activate the plugin.
Usage
CLI Commands
# Verify Node 22 TypeScript support, bwrap sandbox, and config paths
node plugin/bin/agy-codemode.mjs doctor
# Inspect installed Antigravity plugins and offload recommendations
node plugin/bin/agy-codemode.mjs discover
node plugin/bin/agy-codemode.mjs discover --json
# Sync discovered + configured MCP servers into typed .ts stubs
node plugin/bin/agy-codemode.mjs sync
node plugin/bin/agy-codemode.mjs sync --workspace /path/to/repo
# Keep a disabled plugin's skills active via official ~/.gemini/config/skills.json
node plugin/bin/agy-codemode.mjs keep-skills <plugin-name>
node plugin/bin/agy-codemode.mjs keep-skills --prune
# List synced servers and tool counts
node plugin/bin/agy-codemode.mjs listMCP Tools Exposed to Antigravity
Tool | Purpose | Key Arguments |
| Progressive BM25 search over synced MCP servers & tools |
|
| Execute TypeScript/ESM in the isolated sandbox |
|
Example codemode_execute Script
import { resolveLibraryId } from "./servers/context7/resolveLibraryId.ts";
import { queryDocs } from "./servers/context7/queryDocs.ts";
const libs = await resolveLibraryId({ libraryName: "next.js", query: "app router caching" });
const docs = await queryDocs({ libraryId: "/vercel/next.js", query: "revalidateTag" });
// Filter locally before printing to context
console.log(String(docs).slice(0, 1500));Configuration
User configuration lives at ~/.gemini/codemode/servers.json (auto-created with safe defaults). Explicit entries in servers.json take highest precedence over auto-discovered plugins.
{
"discovery": {
"mode": "all",
"excludePlugins": ["agy-codemode", "agy-prefill", "usage-monitor"]
},
"builtins": {
"native": true
},
"lifecycle": {
"idleTimeoutMs": 600000
},
"sandbox": {
"redactSecrets": true
},
"trustedWorkspaces": [
"${userHome}/projects/my-app"
],
"mcpServers": {
"serena": {
"optIn": true,
"description": "LSP semantic symbol navigation, cross-file references & diagnostics",
"command": "serena",
"args": ["start-mcp-server", "--context", "antigravity", "--agent-interface", "tools", "--project", "${WORKSPACE}"]
},
"custom-api": {
"description": "Internal REST/MCP service",
"url": "https://mcp.example.com/mcp",
"headers": {
"Authorization": "Bearer ${env:CUSTOM_API_TOKEN}"
}
}
}
}Per-Project Scoping (.agents/codemode.json)
Add <workspace>/.agents/codemode.json to customize active MCPs per repository with zero native schema bloat (Antigravity ignores this file; only agy-codemode reads it):
{
"enable": ["serena"],
"disable": ["custom-api"],
"mcpServers": {
"project-db": {
"description": "Read-only analytics DB",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "${env:DB_URL}"]
}
}
}enable/disablealways work (safe — only toggles servers defined in your globalservers.json).Repo-defined
mcpServersonly execute if the workspace is listed intrustedWorkspaces(or"trustProjectServers": true) in~/.gemini/codemode/servers.json.A
SessionStart+PreInvocationhook injects a compact 1-line-per-server roster for the active workspace (0 tokens on normal turns; auto re-injects after/compact).Truncated
codemode_executeoutput spills into<artifactDirectoryPath>/scratch/codemode-runs/inside the active conversation directory so deleting a conversation deletes its spill logs automatically.discovery.mode:"all"(default — discovers both enabled and disabled plugins),"disabled-plugins", or"off".Persist intermediate datasets in
./workspace/(~/.gemini/codemode/workspace/) and reusable scripts in~/.gemini/codemode/skills/<name>.ts(runnable viacodemode_execute(skill="<name>")).
Security & Sandbox Model
Layer | Protection |
Network Isolation |
|
Filesystem Isolation | Node |
Credential Isolation | Upstream |
IPC Authentication | Each sandbox run communicates with the broker over a per-run Unix domain socket guarded by a random bearer token. |
Output Redaction | Built-in secret patterns plus dynamically collected header/env secret values are redacted from stdout/stderr before returning to context. |
Development & Testing
# Run the full automated test suite (12 end-to-end & unit tests)
npm test
# Or invoke directly with Node 22
AGY_CODEMODE_NO_DISCOVERY=1 node --test plugin/tests/*.test.mjsRepository Structure
agy-codemode/
├── install.sh # Idempotent plugin symlink installer
├── package.json # Zero-dep package metadata & scripts
├── CHANGELOG.md
├── LICENSE
└── plugin/
├── plugin.json # Antigravity plugin manifest (v0.3.0)
├── mcp_config.json # Portable ${PLUGIN_ROOT} MCP entrypoint
├── assets/logo.svg # Plugin icon
├── rules/AGENTS.md # Hybrid routing rule + managed server roster
├── bin/agy-codemode.mjs # CLI (doctor, discover, sync, keep-skills, list)
├── src/
│ ├── mcp-server.mjs # MCP JSON-RPC server (codemode_search, codemode_execute)
│ ├── discovery.mjs # Antigravity plugin/cache scanner & skills.json helper
│ ├── config.mjs # Config loader, hash fingerprinting, secret extraction
│ ├── codegen.mjs # Typed .ts stub generator, BM25 search, roster updater
│ ├── upstream-pool.mjs # Stdio + Streamable HTTP MCP client pool & idle reaper
│ ├── sandbox.mjs # bwrap + Node --permission runner & secret redactor
│ ├── native-server.mjs # Host-bridged native globals (readFile, runCommand, ...)
│ └── format.mjs # Compact output formatting helpers
└── tests/
├── codemode.test.mjs # 12 end-to-end & unit tests
└── mock-mcp-server.mjs # Local mock MCP server for deterministic testsLicense
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Search, vet & assemble MCP servers from your agent: verified tools, risk labels, and trust scores.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Capability registry for the agentic economy. Semantic search over verified MCP server listings.
Search MCP servers, agent skills, tools and agents, with an install command for each.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAggregates tools from multiple MCP servers, generates TypeScript definitions, and executes custom TypeScript scripts to orchestrate cross-server tool calls.-
- AlicenseNot gradedqualityCmaintenanceEnables building safe, programmable Code Mode MCP servers from upstream tool sources, with model-authored TypeScript running in a sandbox and tool calls routed to trusted host-side providers.1Apache 2.0
- AlicenseNot gradedqualityCmaintenanceFronts every MCP server you have with two tools: search shortlists relevant tools, and execute runs sandboxed Python that calls upstream tools as mcp..(). It enables agents to make bulk, repeated, or conditional tool calls using calibrated decision-model choices instead of per-item LLM generation.3MIT
- AlicenseAqualityBmaintenanceEnables agents to accomplish multi-step work by writing a single sandboxed JavaScript program that drives shell, filesystem, HTTP, and every tool of any configured MCP server, returning only a small summary instead of raw JSON. This collapses dozens of advertised tool schemas into one tool, cutting per-request context by roughly 26× while keeping disabled upstream servers reachable.134 npmMIT