Decapod Docs
Edit on GitHub

Model Context Protocol (MCP)

Decapod provides a CLI, a Decapod-specific structured RPC interface (decapod rpc --op <op>, plus an optional authenticated loopback HTTP server via decapod rpc --http-server), and a bounded, daemonless local stdio MCP JSON-RPC 2.0 adapter (src/decapod/core/agent_interop/mcp.rs).

Shipped MCP adapter (decapod mcp)

  • decapod mcp serve [--one-shot] [--max-requests <N>] [--max-frame-bytes <N>] [--framing auto|jsonl|content-length] [--allow-mutations]: Serves a bounded local stdio MCP JSON-RPC 2.0 session and exits cleanly on EOF, --one-shot, --max-requests, or shutdown (INV-DAEMONLESS, zero lingering daemons).
  • decapod mcp schema [--format json|text]: Exports the deterministic tool and resource schema catalog (decapod-mcp-stdio).
  • decapod mcp config [--root <DIR>] [--executable <PATH>]: Emits a conflict-safe mcpServers.decapod JSON entry for host wiring.

Protocol, framing, and size bounds

  • Supported MCP protocolVersion values: 2025-03-26 and 2024-11-05. Any other requested revision is rejected fail-closed with JSON-RPC error -32602 listing the supported revisions.
  • Stdio framing: auto (default), jsonl, or content-length. Incoming request frames default to a 262144-byte (256 KiB) limit (DEFAULT_MAX_FRAME_BYTES) and responses default to a 131072-byte (128 KiB) cap (DEFAULT_MAX_RESPONSE_BYTES).
  • Lifecycle methods: initialize, notifications/initialized, notifications/cancelled, ping, shutdown, tools/list, tools/call, resources/list, and resources/read.

Bounded tools (6) and redacted resources (4)

SurfaceTypeAccess / Guard
decapod_interop_manifestToolRead-only; returns interoperability manifest (optional schema validation).
decapod_interop_negotiateToolRead-only; deterministic fail-closed capability negotiation.
decapod_rules_taxonomyToolRead-only; 8-domain coding-rule taxonomy and gap matrix.
decapod_overlap_classifyToolRead-only; 6-state semantic task-scope overlap classification.
decapod_envelope_verifyToolRead-only; evaluates external governance envelope v1 under local trust policy without importing authority.
decapod_governed_mutateToolDenied by default (read_only_session_denied). Opt-in --allow-mutations enforces an authenticated Decapod session (session_required), an isolated .decapod/workspaces/* worktree (worktree_isolation_required), registered RPC_OPS membership (unknown_op), and fail-closed cloud_backend_unavailable rejection on unsupported non-todo ops when [repo].backend = "cloud".
decapod://manifestResourceRedacted read-only application/json interoperability manifest.
decapod://constitution/core/DECAPODResourceRedacted read-only text/markdown excerpt of the core router contract.
decapod://rules/taxonomyResourceRedacted read-only application/json coding-rule taxonomy matrix.
decapod://harness/matrixResourceRedacted read-only application/json host compatibility matrix.

resources/read refuses path traversal (.., \), non-decapod:// URIs, hidden rubrics, secrets, .env, .db/SQLite stores, and token-bearing paths (resource_denied).

Important: The MCP adapter is a narrow transport adapter boundary over Decapod's local governance kernel. Discovering or calling MCP tools does not prove full code delivery, does not import remote authority, and does not waive decapod validate or repository custody gates.

Key interoperability distinctions

  • Local protocol conformance vs. real vendor-host activation: Passing local black-box stdio transcripts and schema tests (tests/agent_interop_conformance.rs, docs/conformance/observed-interop-receipts-v0.163.md) proves framing, redaction, and local gate parity only. Real vendor-host activation depends on each host's installed CLI/IDE runtime, protocol version negotiation, project trust prompt, and authentication state (tracked in #875 and #880).
  • Cooperative host hooks vs. independently enforced boundaries: Host lifecycle hooks (such as PreToolUse or harness plugins) are cooperative reminders that can be disabled, bypassed via direct shell/git commands, or fail open on hook errors. Independent enforcement lives in Decapod's kernel gates, isolated .decapod/workspaces/* worktrees, OS/container isolation, and Git/forge branch protection.
  • Bounded A2A adapter vs. hosted A2A task server: Decapod ships a bounded A2A Agent Card (decapod a2a card), fail-closed handoff validator (decapod a2a handoff), and opt-in authenticated loopback HTTP adapter (decapod a2a serve / decapod a2a send, bounded by --max-requests with imported_authority_granted: false). It does not run a persistent hosted A2A task server or import remote task authority.

Optional configuration example: Grok Build (grok 1.0.77)

Qualification & verification status: The commands below are a version-qualified configuration example verified offline against the grok 1.0.77 (50ca579fa996) CLI in a disposable repository with zero LLM API calls and zero secrets. A full live Grok Build agent-session host arm (under #875/#880) is not_run.

Setup, discovery, and opt-in project trust

Register Decapod in project scope (writes [mcp_servers.decapod] to .grok/config.toml without secrets or overwriting unrelated entries):

grok mcp add --scope project decapod -- decapod mcp serve
grok mcp list
grok mcp doctor decapod

Grok Build enforces opt-in project trust for repo-local MCP definitions in .grok/config.toml. Running grok mcp doctor decapod in an untrusted repository intentionally refuses to launch the project-scoped server (folder untrusted) until the operator explicitly trusts the folder (for example, grok --trust mcp doctor decapod).

Observed protocol revision boundary on grok 1.0.77: When invoked with grok --trust mcp doctor decapod --json against decapod mcp serve, grok 1.0.77 starts the stdio server and requests protocolVersion: "2025-11-25", which decapod mcp serve currently rejects fail-closed (-32602, supported: ["2025-03-26", "2024-11-05"]). Until protocol revision alignment ships or the host negotiates 2025-03-26, Decapod's conflict-safe harness package for Grok Build (decapod integration harness install --harness grok-build) wires .grok/decapod-rpc.json to decapod rpc --stdin instead.

Disable, enable, remove, and rollback

grok mcp disable decapod
grok mcp enable decapod
grok mcp remove --scope project decapod
  • grok mcp disable / enable toggles the server entry in ~/.grok/config.toml without deleting project files.
  • grok mcp remove --scope project decapod removes only [mcp_servers.decapod] from .grok/config.toml, preserving unrelated user configuration.
  • For clean rollback of .grok/config.toml, revert it via Git; for Decapod-managed .grok/decapod-rpc.json, run decapod integration harness rollback --harness grok-build (or decapod integration harness remove --harness grok-build). No secrets are stored in either file.

Hook enforcement warning for Grok Build

Grok Build's lifecycle hooks fail open on hook errors and run ahead of plan-mode gating. Because a failing or bypassed hook cannot stop an unapproved mutation, Grok Build hooks must be treated strictly as cooperative automation—never as the final security, custody, or publication barrier. Final authority always stays with Decapod's isolated worktree checks, decapod validate, and Git/forge branch protection.

Current local handshake

decapod session handshake --scope <scope> records local declarations, scope, proof declarations, document hashes, and a deterministic artifact hash. That hash provides tamper-evident integrity for the recorded handshake data; it does not authenticate a model provider, harness, binary, human principal, or organization.

The handshake's identity_assertions preserve identity claims separately from verification. An assertion carries its claim kind, subject type, value, evidence class, scope, lifecycle, authority/verifier slots, method, and result. Environment-provided agent and provider values are self-declared and unverified unless a configured trust root establishes stronger evidence.

The repository-local session credential establishes local custody and correlation for the current session. It is not external provider authentication. See BYOA & Interoperability for the live decapod.interop contract, and see the interoperability profile, capability negotiation, the native MCP adapter, the A2A adapter, the optional HTTP transport, and identity and provenance for the boundaries adapters must preserve.