{
  "slug": "terragrunt-experimental-mcp-command-exposes-operations-to-coding-agents-35124adfe48b",
  "title": "Terragrunt experimental `mcp` command exposes operations to coding agents",
  "tools": [
    "terragrunt"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-10-21T12:37:54.000Z",
  "announced_at": "2026-10-21T12:37:54.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When an agent needs to inspect Terragrunt units, dependencies, validation, run order, or applied outputs, connect an MCP client to `terragrunt mcp` with the `mcp-command` experiment enabled. Grant only needed capabilities; use `--allow=exec --dangerously-allow-apply` to expose apply and destroy tools.",
    "examples": [
      "{\"mcpServers\":{\"terragrunt\":{\"command\":\"terragrunt\",\"args\":[\"mcp\",\"--working-dir\",\"<repository-or-environment-directory>\"],\"env\":{\"TG_EXPERIMENT\":\"mcp-command\"}}}}",
      "{\"mcpServers\":{\"terragrunt\":{\"command\":\"terragrunt\",\"args\":[\"mcp\",\"--working-dir\",\"<repository-or-environment-directory>\",\"--allow=exec\",\"--allow=http\",\"--allow=env\"],\"env\":{\"TG_EXPERIMENT\":\"mcp-command\"}}}}",
      "{\"mcpServers\":{\"terragrunt\":{\"command\":\"terragrunt\",\"args\":[\"mcp\",\"--working-dir\",\"<throwaway-environment-directory>\",\"--allow=exec\",\"--dangerously-allow-apply\"],\"env\":{\"TG_EXPERIMENT\":\"mcp-command\"}}}}"
    ],
    "gotchas": [
      "Version: v1.2.0",
      "Availability: The `mcp-command` experiment; the tool set, flag names, and result shapes are subject to change until v1.3.",
      "TG_EXPERIMENT=mcp-command (required): Enables the experimental `mcp` command; alternatively enable with `--experiment=mcp-command`.",
      "--working-dir <directory>: Sets the server root; defaults to its launch directory. Tool paths resolving outside the root are refused.",
      "--allow=exec: Allows Terragrunt-started `tofu`, `terraform`, and `git`; required for `plan`, and for enabling `apply` or `destroy`.",
      "--allow-cmd <pattern>: Allows a configuration-named command matching the pattern; repeatable and requires `--allow=exec`.",
      "--allow=http: Allows Terragrunt's own HTTP requests, including remote sources and cloud API calls.",
      "--allow=sops: Allows decryption of SOPS-encrypted files.",
      "--allow=env: Passes server environment variables to configurations and commands; otherwise tool calls start with an empty environment.",
      "--dangerously-allow-apply: Registers `apply` and `destroy`; requires `--allow=exec`, and calls wait for client elicitation acceptance.",
      "working_dir: MCP tool parameter: directory relative to the server root; defaults to root, but is required by `render_config` and `get_outputs`.",
      "filter: MCP tool parameter that narrows the units acted on for tools that support it.",
      "parallelism: For `plan`, `apply`, and `destroy`, caps the number of units run concurrently; no limit by default.",
      "discover: Lists units and stacks; can include dependency edges and hidden-directory units.",
      "render_config: Evaluates one unit's configuration; requires `working_dir`.",
      "validate: Reports syntax and evaluation errors for configurations under a directory.",
      "run_order: Reports unit run order and blockers.",
      "get_outputs: Reads one unit's applied outputs; requires `working_dir`.",
      "Prerequisite: Terragrunt with the `mcp-command` experiment enabled; the command is experimental.",
      "Prerequisite: An MCP client configured to launch the Terragrunt binary; set `TG_EXPERIMENT` in the client configuration environment.",
      "Prerequisite: By default, capabilities are denied. `get_outputs` needs `exec`, or `http` for direct reads from s3, gcs, and azurerm state; `plan` needs `exec`.",
      "By default the server refuses to start subprocesses; refused subprocesses can lead to stand-in outputs listed in a `degraded` field.",
      "Program names supplied by configuration through `run_cmd()`, `before_hook`, or `--auth-provider-cmd` remain refused unless allowed with `--allow-cmd`; read-only tools can request elicitation to retry after acceptance, but `plan`, `apply`, and `destroy` do not ask.",
      "Capabilities must be granted individually. `--allow=exec` permits Terragrunt-started `tofu`, `terraform`, and `git`; `--allow=http` permits Terragrunt's own HTTP requests; `--allow=sops` permits SOPS decryption; `--allow=env` passes server environment variables to configurations and commands.",
      "Without `--allow=env`, tool calls start with an empty environment, `get_env()` returns its default, and the server clears its own environment and points `HOME` at an empty directory, so cloud SDKs, SOPS decryption, and Terragrunt-run `git` commands find no credentials in environment variables or the home directory.",
      "Allowing Terragrunt a capability does not restrict subprocesses it starts; for example, `tofu init` can make network requests without `--allow=http`.",
      "The server root is its launch directory. Tool calls targeting outside it are refused, and graph traversal is bounded there; HCL `file()` can still read the real disk wherever it points.",
      "`--dangerously-allow-apply` requires `--allow=exec`; `apply` and `destroy` tools are not registered without it. With it, tool calls require client elicitation accepting the units to run; clients unable to ask are refused. Approval names units, not changes, and call starts only after acceptance.",
      "The engine tools use the binary named by `--tf-path` and ignore a unit's `terraform_binary` and `engine` block.",
      "The `mcp-command` experiment documentation lists criteria that must be met before stabilization."
    ]
  },
  "why_it_matters": "Connect an MCP client to a Terragrunt repository to inspect units, dependencies, validation, run order, or applied outputs.",
  "sources": [
    "https://github.com/gruntwork-io/terragrunt/releases/tag/v1.2.0",
    "https://docs.terragrunt.com/reference/cli/commands/mcp/"
  ],
  "rank": 0.98057,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "daily-20261026-04",
    "verdict_id": "daily-20261026-04:daily-20261026-04-15158ce73abbef5a-6:gate",
    "evidence_hash": "267e320c65a4f11b81d2051dcaf0bcc6abbb329bca3b817787fafed1b02ac903"
  },
  "review": {
    "draft_hash": "6d7b8233314bd6056058909ad272863ff40e8c9f4747422252b281f0cd4a4f53",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-21T12:37:54.000Z",
    "decision": "daily-20261026-04:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.66 (>= 0.6 needed)."
  }
}
