convez.ai
MCP ServerAutomaçãoAvançado
tphakala

Agy MCP Server

tphakala/agy-mcp

Executa prompts Antigravity como jobs gerenciados e resilientes via MCP

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP que encapsula a CLI Antigravity (agy) para executar prompts e revisões de código como jobs assíncronos e resilientes a reinicializações. Funciona tanto via stdio quanto HTTP Streamable, permitindo que qualquer cliente MCP (Claude Code, Cursor, Cline) acesse nativamente ferramentas de automação agy sem problemas de bloqueio ou timeouts.

Instalação

$npx convez-ai tphakala/agy-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
25
Forks
5
Acompanhando
2
Saúde
42%
Último commit
há 6 dias
Versão
v2.12.0
Issues abertas
4
Contribuidores
2

Casos de uso

  • Automação de prompts Antigravity em fluxos de trabalho MCP
  • Revisões de código assíncronas que resistem a desconexões
  • Integração de agy em múltiplos clientes MCP via HTTP

Veredito

Solução robusta e bem arquitetada para integrar Antigravity em ecossistemas MCP, resolvendo problemas reais de bloqueio e timeouts. Excelente para equipes que automatizam código com agy e precisam de orquestração confiável.

README

A tradução para o português deste README ainda está na fila.

agy-mcp

CI CodeQL Version Go Reference Go Report Card License: MIT

An MCP (Model Context Protocol) server that wraps the Antigravity CLI (agy), so any MCP client (Claude Code, Cursor, Cline, and others) can run agy prompts, peer reviews, and follow-up turns as native tools.

Status: feature complete (stdio and HTTP transports, async and sync job lifecycle, model and session discovery, cross-platform builds) and verified against a live agy (1.0.7).

Why

Driving agy from a shell for automation has two recurring problems:

  • agy -p (print mode) reads stdin even when the prompt is passed with -p. If stdin is an open pipe that never closes, it blocks indefinitely. The fix is to always close stdin (</dev/null), which is easy to forget.
  • A review can run for many minutes. A single blocking call ties up the caller and can exceed a client's tool-call timeout with nothing recoverable.

agy-mcp solves both by running agy as managed, asynchronous jobs behind a small, typed tool surface, and by capturing output to disk so a run survives a client disconnect or a server restart.

What it provides

  • agy_run / agy_status / agy_cancel: start an agy prompt, poll for completion, cancel if needed.
  • agy_run_sync: start a prompt and wait for it inline (bounded, with MCP progress notifications); returns the job_id to poll if it outlives the wait cap.
  • list_models: enumerate available agy models.
  • list_sessions: list known conversations so review threads can be continued.

Session continuation rides agy's own durable conversation store (--conversation <id>), so threads survive across calls without keeping a process warm.

Two transports run the same core:

  • stdio (default): zero-config, one line in your MCP client config.
  • Streamable HTTP (opt-in): a long-lived, loopback-only daemon for multi-client use. See HTTP mode.

Requirements

  • The agy binary on PATH (or configured explicitly via AGY_MCP_AGY_PATH).
  • Go 1.26+ to build.
  • The server builds and runs on Linux, macOS, and Windows. Job supervision (running agy as managed jobs via agy_run / agy_run_sync / agy_status / agy_cancel) relies on process groups, /proc, and the kernel boot id, so it runs on Linux only; on macOS and Windows those tools return a clear "job supervision is only supported on Linux" error, while stdio/HTTP serving, list_models, and list_sessions work everywhere.

Note: every job spawns a fresh agy process, which on startup launches whatever MCP servers are configured in agy's own mcp_config.json. Peer-review and automation runs usually do not need those servers, and a slow or hanging one adds latency to every job. agy 1.0.7+ bounds this with a per-server launch timeout (set -1 to disable it). If startup is slow, give the unneeded servers a timeout in agy's mcp_config.json, or point agy at a trimmed config.

Install

go install github.com/tphakala/agy-mcp@latest

Use with Claude Code (stdio)

claude mcp add agy -- agy-mcp

Or add to your MCP client config:

{
  "mcpServers": {
    "agy": { "command": "agy-mcp" }
  }
}

Tools

  • agy_run(prompt, model?, dirs?, conversation_id?, continue_latest?, cwd?, timeout?) -> { job_id, conversation_id?, state }
  • agy_run_sync(prompt, model?, dirs?, conversation_id?, continue_latest?, cwd?, timeout?, wait?) -> { job_id, state, elapsed, result?, error?, conversation_id?, note? }
  • agy_status(job_id) -> { state, elapsed, result?, error?, conversation_id? }
  • agy_cancel(job_id) -> { state }
  • list_models() -> { models }
  • list_sessions(dir?) -> { sessions }

A fresh agy_run (no conversation_id, no continue_latest) starts with an empty conversation_id; agy assigns one as the run proceeds, and agy_status reports it once the run completes, so the thread can be continued later. To keep that capture unambiguous, fresh runs sharing a cwd are serialized: while one fresh run is active, a second fresh run in the same directory is refused (agy_run returns a conflict error rather than queuing it), so run them in separate directories or retry once the first finishes. Runs in different directories, and runs continuing distinct conversations, still run concurrently up to the configured cap. The gate that enforces this is rebuilt at startup from jobs whose supervisor outlived a server restart, so the cap and serialization hold across restarts.

HTTP mode

agy-mcp -http 127.0.0.1:8765

HTTP mode is opt-in and only accepts a loopback bind address (localhost, 127.0.0.1, or ::1). A non-loopback address (including :8765, which binds all interfaces) is refused at startup, so it cannot be accidentally exposed.

Two extra hardening layers are always available:

  • Origin/CSRF protection is always on. A state-changing cross-origin browser request (one carrying a cross-site Sec-Fetch-Site or a mismatched Origin) is rejected with 403. Normal non-browser MCP clients (Claude Code, Cursor, the go-sdk client) send no Origin header and are unaffected.
  • Optional bearer token. Set -http-token <token> (or AGY_MCP_HTTP_TOKEN) to require Authorization: Bearer <token> on every request; a missing or wrong token gets 401. The flag overrides the env var. Off by default, so the bare loopback mode stays unauthenticated.
agy-mcp -http 127.0.0.1:8765 -http-token "$(openssl rand -hex 32)"

Configuration

EnvDefaultMeaning
AGY_MCP_AGY_PATHagy on PATHpath to the agy binary
AGY_MCP_STATE_DIR$XDG_STATE_HOME/agy-mcpjob state directory
AGY_MCP_DEFAULT_MODELagy defaultdefault model
AGY_MCP_HTTP_TOKEN(none)optional bearer token for HTTP mode; empty = unauthenticated

Development

go build ./...
go test ./... -race
golangci-lint run

CI builds and vets on Linux and macOS, runs the race-enabled test suite on Linux, and cross-compiles for Windows.

License

MIT. See LICENSE.

Ver o original no GitHub

Bom para

Relacionados