Skip to main content
Glama

AGP MCP Server

Serverless inter-agent MCP mesh, Agent Teams, and zero-token reactive wakeup — exposing the full multi-agent coordination suite in standard Direct Mode (25 tools) or compact Code Mode (4 tools: whoami, docs, search, execute) with zero external runtime dependencies.

Token Comparison

Approach

Tools

Context Footprint

Raw transcript polling + full diffs inline

—

~40,000+ tokens/session

Direct Mode (full AGP + Teams MCP surface)

25

~6,500 tokens

Code Mode (--codemode / ?codemode=true)

4 (whoami, docs, search, execute)

~900 tokens (~86% reduction)

Related MCP server: agentroom

Get Started

Option 1: npx Stdio (Recommended — Zero HTTP Server Required)

Runs completely silently in the background over standard MCP stdio against shared local SQLite WAL (~/.gemini/agp/agp.db) and cross-process locked Team mailboxes (~/.gemini/agp/teams/). No daemon or browser needs to be open.

Add to your MCP client configuration (Antigravity, Claude Desktop, Claude Code, Cursor, Windsurf):

{
  "mcpServers": {
    "agp-broker": {
      "command": "npx",
      "args": ["-y", "github:TrBn17/agp-mcp"]
    }
  }
}

For VS Code (.vscode/mcp.json):

{
  "servers": {
    "agp-broker": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "github:TrBn17/agp-mcp"]
    }
  }
}

Or generate a client-specific config directly:

npx -y github:TrBn17/agp-mcp config cursor
npx -y github:TrBn17/agp-mcp config vscode --codemode

Option 2: Antigravity Auto-Hooks & Offline Runtime (One Command)

To let live Antigravity (agy) sessions automatically receive incoming messages mid-turn (PreInvocation, PostInvocation, Stop), register identity on startup (SessionStart), and enforce workspace file write leases (PreToolUse):

npx -y github:TrBn17/agp-mcp install
# Or enable 4-tool Code Mode by default:
npx -y github:TrBn17/agp-mcp install --codemode

This installs the agp-mesh plugin into ~/.gemini/config/plugins/agp-mesh, bundles the offline zero-dependency Python runtime inside it so hooks execute in <40ms even without network access, and wires agy automatically.

Option 3: Global npm or pip Install

# Node / npm (requires Node 18+ and Python 3.11+)
npm install -g github:TrBn17/agp-mcp
agp-mcp doctor

# Or pure Python (no Node required)
pip install git+https://github.com/TrBn17/agp-mcp.git
agp-mcp --doctor

Option 4: Streamable HTTP & Optional Live Monitor UI

Opening the Monitor UI is strictly optional — background MCP works identically whether the UI is open or closed. Start it only when you want to inspect sessions, teams, token usage, traces, or expose Streamable HTTP /mcp + A2A v1.0:

npx -y github:TrBn17/agp-mcp monitor
# Dashboard: http://127.0.0.1:47821
# Streamable HTTP MCP: http://127.0.0.1:47821/mcp
# Streamable HTTP Code Mode: http://127.0.0.1:47821/mcp?codemode=true

Code Mode

Enable ultra-compact 4-tool Code Mode (whoami, docs, search, execute) via --codemode (stdio), AGP_CODEMODE=1 (env), or ?codemode=true (Streamable HTTP):

{
  "mcpServers": {
    "agp-broker": {
      "command": "npx",
      "args": ["-y", "github:TrBn17/agp-mcp", "--codemode"]
    }
  }
}

Tool Result Truncation

In Code Mode, large tool responses from execute are structurally truncated to ~6,000 tokens (~24,000 chars) while always producing valid JSON with --- TRUNCATED --- markers and omitted item/key counts (modeled on @cloudflare/mcp's structural truncator).

To inspect full un-truncated output when needed:

  • Per call: pass "truncate": false in execute arguments.

  • Per session (stdio): pass --no-truncate.

  • Per request (HTTP): append ?truncateToolResult=false to /mcp.

The Problem

Running multiple AI coding sessions in parallel (CLI, IDE, subagents, Claude Code, Cursor) hits four recurring failure modes:

  1. One-way blind messaging & token burn — Session A sends a message to Session B, B is idle or mid-turn and never sees it, and A burns tokens looping inbox polls waiting on a dead reply.

  2. Concurrent file edit collisions — Two agents edit the same file simultaneously with no advisory/enforced write lock or monotonic fencing tokens against stale writers.

  3. Context window bloat — Loading 25+ tool schemas, raw transcripts, or 100 KB diffs inline exhausts model context before actual coding starts.

  4. Daemon friction — Requiring a manually started HTTP server just for agents to coordinate breaks standard plug-and-play MCP ergonomics.

agp-mcp solves all four with a serverless SQLite WAL + cross-process file-locked architecture, deterministic two-way receive & wakeup channels, 4-tool Code Mode, and pass-by-reference SHA-256 artifacts.

How Two-Way Receive & Wakeup Works

Target Session State

Delivery Mechanism

Token Cost While Waiting

Active turn (thinking / calling tools)

Lifecycle hooks (PreInvocation, PostInvocation, Stop) atomically drain both AGP SQLite and Team mailboxes and inject <agp_untrusted_message> / <team_message> with exact [REPLY ROUTING] commands

0 extra polls

Idle interactive session (CLI / IDE)

Zero-token reactive background listener (agp-listen --agent <uri>) watches SQLite PRAGMA data_version + all Team mailboxes (including teams joined later), exits with messages on arrival to trigger Reactive Wakeup

0 LLM tokens

Added to a team (team_join)

Immediately writes a Team Handshake (team_welcome) containing the exact reply_call and listen_command, mirrored to both team mailbox and AGP SQLite

0 extra polls

Autonomous teammate (team_spawn / auto_cli / force_cli)

Spawns a self-terminating detached worker (agp.worker) that drains unread messages, executes the turn, and auto-bridges a reply back if the model responds in plain text

On-demand only

Unreachable idle peer (agp_ask)

Every agp_send, agp_ask, and team_send returns an honest delivery.will_auto_receive field; agp_ask fails fast in 0 ms instead of blocking until timeout

0 wasted tokens

Tools

Code Mode (4 Tools)

Tool

Purpose

whoami

Returns current session identity, URI, role, active listener state, unread AGP/Team counts, active leases, and teams. Includes OpenAI profile metadata (_meta: {"openai/profile": true}) and structuredContent.

docs

Searches built-in AGP v2.1, Agent Teams, two-way wakeup, security, and tool schema documentation by topic or query.

search

Discovers matching tools (with full schemas), live peer agents, and teams in a single compact call.

execute

Executes a single tool or chains a multi-step steps[] pipeline in one roundtrip with $prev.* and $steps[i].* output interpolation and structural JSON truncation.

Agent ──► search({ query: "team task" })
            │ returns matching tool schemas + live peers
            ▼
Agent ──► execute({ steps: [
            { action: "team_create", args: { team: "checkout", description: "API + UI" } },
            { action: "team_task",   args: { team: "checkout", action: "create", title: "Build API", owner: "backend" } },
            { action: "team_task",   args: { team: "checkout", action: "create", title: "Wire UI", owner: "frontend", blocked_by: ["$prev.task.id"] } }
          ] })
            │ runs in-process against SQLite WAL + CrossProcessFileLock
            ▼
       Valid JSON result (~6,000-token structural truncation, or full via truncate: false)

Direct Mode (25 Tools)

When running without --codemode, all 25 tools are exposed directly:

  • Identity & Docs (2): whoami, docs

  • Agent Teams (9): team_create, team_join, team_spawn, team_send, team_inbox, team_task (list|create|claim|unclaim|complete|fail|cancel|update|delete with DAG cycle detection & auto-unblocking), team_list, team_shutdown, team_delete

  • AGP v2.0 Mesh (14): agp_status, agp_register, agp_unregister, agp_discover, agp_ask, agp_send, agp_inbox, agp_ack, agp_task, agp_lease (acquire|renew|release|list|check|force_release with monotonic fencing tokens), agp_artifact_put, agp_artifact_get, agp_artifact_list, agp_trace_inspect

  • Resources & Prompts: 6 static agp:// resources, 5 resource templates, 6 guided workflow prompts, logging/setLevel, completion/complete, and notifications/cancelled.

Skills

agp-mcp implements the MCP Skills extension (io.modelcontextprotocol/skills), advertising skills/list, skills/get, and skill://<name>/<path> resources with SHA-256 content digests:

Skill

URI

Contents

agp-protocol

skill://agp-protocol/SKILL.md

Full serverless AGP v2.1 & Agent Teams collaboration playbook

two-way-wakeup

skill://two-way-wakeup/SKILL.md

Zero-token reactive wakeup, team_join handshake, and anti-polling rules

Supported Clients & Protocols

  • MCP Protocol Versions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28 (stateless-first)

  • MCP Extensions: io.modelcontextprotocol/tasks, io.modelcontextprotocol/skills

  • A2A Gateway (HTTP mode): A2A v1.0 signed Agent Card (/.well-known/agent-card.json), task endpoints, and webhook delivery

  • Security & Provenance: Ed25519 JWS message signing, RFC 8693 delegation chains, DLP secret redaction, prompt-injection taint screening, monotonic fencing tokens, circuit breakers, hop-limit loop protection

  • Clients: Antigravity (agy), Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, and any standard MCP stdio or Streamable HTTP client

Usage

Ask your agent naturally:

  • "Check whoami and discover which agents are currently working on backend/**."

  • "Create a team auth-refactor, join conversation <cid> as frontend, create a task DAG where UI waits on the API contract, and wait for their reply at zero token cost."

  • "Acquire an exclusive write lease on src/payments/** before editing, then hand off the git diff via agp_artifact_put."

Example multi-step Code Mode execute call:

{
  "steps": [
    {
      "action": "agp_register",
      "args": {
        "display_name": "Backend API (Auth)",
        "role": "backend",
        "owned_paths": ["services/auth/**"]
      }
    },
    {
      "action": "agp_lease",
      "args": {
        "action": "acquire",
        "owner_uri": "$prev.agent.agent_uri",
        "paths": ["services/auth/jwt.py"],
        "ttl_sec": 300
      }
    }
  ]
}

Optional Live Monitor UI

The web dashboard is purely a read/control companion over the exact same ~/.gemini/agp/ SQLite WAL and Team mailboxes. Agents keep working seamlessly when you close it.

npx -y github:TrBn17/agp-mcp monitor
# Or without auto-opening a browser tab:
npx -y github:TrBn17/agp-mcp monitor --no-browser

Development

git clone https://github.com/TrBn17/agp-mcp.git
cd agp-mcp

# Run full unit + multi-process MCP test suite
npm test
# or: python -m unittest discover -s tests -v

# Run environment, SQLite WAL & lock diagnostics
node bin/agp-mcp.mjs doctor

Requirements

  • Python 3.11+ (stdlib only — 0 external Python packages)

  • Node.js 18+ (for npx / npm CLI wrapper — 0 external npm packages)

License

MIT

Available Tools

25 tools
agp_ackB
Idempotent

Acknowledge, accept, reject, complete, or mark failed an incoming AGP message.

Inputs: msg_id (required), status (required), reason, actor_uri.

agp_artifact_getA
Read-onlyIdempotent

Retrieve a SHA-256 verified artifact by artifact_id, supporting offset_bytes chunk pagination.

Inputs: artifact_id (required), max_bytes, offset_bytes.

agp_artifact_listC
Read-onlyIdempotent

List stored artifacts in the local AGP Artifact Store (optionally filtered by kind or owner_uri).

Inputs: kind, limit, owner_uri.

agp_artifact_putA
Idempotent

Store a large diff, log, OpenAPI spec, or code file in the local SHA-256 Artifact Store (with DLP secret redaction) and receive a pass-by-reference descriptor to attach to agp_send.

Inputs: kind (required), redact, content, mime_type, +2 more.

agp_askB

Send a structured request to a peer AND wait in ONE tool call for the correlated reply (correlation_id). Includes an anti-token-burn guard: if the recipient cannot auto-receive (will_auto_receive=false), returns immediately in 0ms with remediation advice instead of waiting blindly.

Inputs: to_uri (required), summary (required), type, payload, +7 more.

agp_discoverA
Read-onlyIdempotent

Discover other AI sessions currently active or recently seen on the AGP mesh. Filter by role, capability, workspace/path ownership, surface, search query, or online status. Shows whether each peer has an active zero-token listener (listening) or wakeup_mode.

Inputs: role, query, status, surface, +4 more.

agp_inboxA

Read or peek incoming AGP messages addressed to this AI session (and subscribed channels). Supports filtering by correlation_id, trace_id, msg_type, priority, and bounded cross-process long-polling (wait_timeout_sec up to 60s). Set mark_delivered=false to peek without consuming.

Inputs: limit, channels, msg_type, priority, +8 more.

agp_leaseB

Acquire, renew, release, check (dry-run), force_release, or list workspace file/path leases with monotonic fencing_token protection to prevent concurrent edit conflicts.

Inputs: action (required), mode, paths, ttl_sec, +1 more.

agp_registerB
Idempotent

Register or update this AI session's Agent Card (display_name, role, owned_paths, capabilities, channels, wakeup_mode, status) so peers can discover and route messages to it.

Inputs: cwd, role, status, channels, +8 more.

agp_sendA

Send an AGP structured message to another AI session or channel (@handle, URI, conversation_id, 'all', or 'channel:'). Enforces schema validation, DLP secret redaction, Ed25519 JWS, token budget, DAG cycle guard, idempotency, and circuit breakers. Returns honest delivery status (will_auto_receive, mode, remediation) so you never burn tokens waiting on an unreachable idle peer.

Inputs: type (required), payload (required), summary (required), wake, +17 more.

agp_statusB
Read-onlyIdempotent

Inspect your bound AGP identity, unread AGP & Team message counts, held file leases, open circuit breakers, active async tasks, zero-token listener command, and optional Monitor UI status. Optionally reset a recovered circuit breaker.

Inputs: agent_uri, reset_circuit_uri.

agp_taskA

Manage durable async tasks (io.modelcontextprotocol/tasks & A2A v1.0 Tasks): list tasks, get task state/history/result, wait for state transition, supply mid-flight clarification/HITL input (update), or cancel a running task.

Inputs: action (required), input, limit, state, +5 more.

agp_trace_inspectA
Read-onlyIdempotent

Inspect the full multi-hop distributed trace spans and messages for a trace_id, OR omit trace_id to list recent traces.

Inputs: limit, trace_id.

agp_unregisterA
Idempotent

Gracefully sign off (peer.bye) from the AGP mesh, mark this agent offline, and release all workspace file leases it holds.

Inputs: reason, agent_uri, release_leases.

docsSearch AGP Protocol & Tool DocsA
Read-onlyIdempotent

Search built-in AGP v2.1 documentation: protocol contracts, error codes, two-way wakeup patterns (agp.listen, team_join, agp_ask), workspace leases, and tool schemas.

Inputs: query (required), limit.

team_createB
Idempotent

Create a Claude-style AGY Agent Team under ~/.gemini/agp/teams// with a shared task list (tasks.json), team roster (config.json), and per-member mailboxes (inboxes/).

Inputs: team (required), cwd, lead_name, description, +1 more.

team_deleteA
DestructiveIdempotent

Shut down all teammates and delete a finished team's state directory cleanly.

Inputs: team (required).

team_inboxA

Read or peek your team mailbox (~/.gemini/agp/teams//inboxes/.json). Supports cross-process fast wait (wait_sec 0-30s) and mark_read=false peek mode.

Inputs: name (required), team (required), wait_sec, mark_read, +1 more.

team_joinA
Idempotent

Attach an existing live AGY session (by conversation_id) into a Team roster AND immediately open its receive/reply channel (sends structured Team Welcome handshake with exact team_send reply route and zero-token agp.listen command; optional auto_wake=true for detached CLI wakeup).

Inputs: name (required), team (required), cwd, role, +5 more.

team_listA
Read-onlyIdempotent

List all AGP Agent Teams or inspect a specific team's roster, live member statuses, unread mailbox counts, zero-token listener commands, and task board counts.

Inputs: team.

team_sendA

Send a direct peer-to-peer message to a teammate by short name (or 'all' to broadcast). Writes to ~/.gemini/agp/teams//inboxes/.json, mirrors to live session hooks/listeners, auto-wakes managed teammates, and returns honest delivery status.

Inputs: to (required), team (required), message (required), hop, +4 more.

team_shutdownB
Idempotent

Gracefully shut down a spawned teammate (or pass name='all' to shut down all teammates).

Inputs: name (required), team (required), reason.

team_spawnB

Spawn a real autonomous AGY teammate (e.g. 'backend', 'frontend', 'reviewer') in a team. Runs via self-terminating detached worker with persistent conversation_id, automatically wakes on team_send, auto-bridges replies if needed, and sends idle_notification when done.

Inputs: name (required), role (required), team (required), prompt (required), +3 more.

team_taskA

Manage the team's cross-process atomic Shared Task List (tasks.json): list, create (with DAG cycle check), claim (omitting task_id auto-claims next unblocked task), unclaim, complete (auto-unblocks dependents), fail, cancel, update, or delete.

Inputs: team (required), action (required), owner, title, +5 more.

whoamiCurrent AGP Agent IdentityA
Read-onlyIdempotent

Return the stable AGP agent identity bound to this MCP connection. Takes no arguments. The id stays consistent across reconnections and metadata updates.

Inputs: no named parameters. Returns: id, name, role, surface, +1 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 25 tools

    Disambiguation3/5

    The agp_ vs team_ prefix split is real and documented, but three tool pairs overlap heavily: agp_send/team_send, agp_inbox/team_inbox, and agp_task/team_task all address 'messaging or tasks' with only scope differences that an agent must infer. Multi-action tools like agp_lease and agp_task (list/get/wait/update/cancel) further blur which call to reach for, though descriptions do help separate them.

    Naming Consistency3/5

    Most tools follow prefix_verb_noun (agp_register, team_create, team_send), but there are visible deviations: resource-first ordering in agp_artifact_get/put/list and agp_trace_inspect, plus two unprefixed bare names (whoami, docs). The patterns are readable but not uniform.

    Tool Count3/5

    At 25 tools the surface is at the heavy end, spanning mesh identity, messaging, artifacts, tasks, leases, tracing, and teams. Domain breadth justifies many of them, but several multi-action tools bundle 5-6 operations each, so the count sits right at the borderline of feeling overloaded.

    Completeness4/5

    Coverage is broad and lifecycle-complete: register/unregister, send/inbox/ack/ask, artifacts put/get/list, tasks, leases, traces, and full team create/join/spawn/send/shutdown/delete. Minor gaps remain, such as no team_leave, no channel subscribe/unsubscribe despite channels being a routing concept, and no artifact delete.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables multi-agent and human collaboration through MCP with scoped rooms, invites, @mentions, task claims, file locks, and push delivery to Claude Code, Codex, and Cursor. Provides cross-company safety, human review, and MCP/A2A protocols for coordinated agent work.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables teams of AI coding agents (Claude Code, Cursor, Codex) to share persistent, time-aware graph memory and coordinate their work via MCP, so agents recall verified fixes at the moment of failure, learn procedures automatically, avoid file conflicts, claim tasks race-free, and hand off facts and decisions between sessions.
      2
      MIT