tfplan-mcp
Reads OpenTofu plan JSON from tofu show -json to summarize planned changes, identify risky changes, explain replacements, compare plans, and inspect drift without executing OpenTofu or contacting cloud providers.
Reads Terraform plan JSON from terraform show -json tfplan to summarize planned changes, rank risky changes, diff resources, explain replacements, compare plans, and inspect drift without executing Terraform or contacting cloud providers.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tfplan-mcp Summarize plan.json — is anything being destroyed?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
tfplan-mcp
Let your AI agent risk-review a Terraform / OpenTofu plan, without ever touching your cloud.
tfplan-mcp is an MCP server that reads the JSON from
terraform show -json tfplan (or tofu show -json) and answers the questions you ask before
apply: what is being destroyed, what is being replaced and why, did an IAM policy just get
broader, is something now open to 0.0.0.0/0, what changed outside Terraform.
What is different about it. Other plan-review MCP servers exist (for example
tfmcp, which also runs terraform for you, and
tf-review-mcp / cloud-devops-mcp-server, which return findings). This one is built around
two things:
It is a plan reader, not a runner. It never executes terraform/tofu, never contacts a provider or cloud, depends only on the
mcppackage, and can be fenced into one directory with--dir.Two-layer secret masking. Values Terraform marks sensitive (
before_sensitive/after_sensitive) and values whose names look like credentials (password,token,secret,key...) are always printed as(sensitive), even when the plan did not flag them. Findings only ever contain addresses, attribute names and network ranges, never attribute values. It also gives you attribute-level diffs,replace_pathsexplanations, dependents, and a two-plan comparison, not only a score.
Install
Claude Code:
claude mcp add tfplan -- uvx tfplan-mcp --dir /path/to/your/plansClaude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"tfplan": {
"command": "uvx",
"args": ["tfplan-mcp", "--dir", "C:\\Users\\you\\infra\\plans"]
}
}
}Make a plan file first:
terraform plan -out=tfplan
terraform show -json tfplan > plan.jsonRelated MCP server: blastcheck-mcp
Tools
Tool | What it does |
| Counts of create/update/delete/replace/read/forget/no-op by resource type and module; empty or destroy plan; moved/imported; drift; output changes; failing checks; terraform version; warnings (errored, incomplete, deferred). |
| Ranked findings with reasons: destroy/replace of databases, buckets, disks, KMS keys, DNS zones; which attribute forced a replacement; IAM |
| Attribute-level |
| Filter by action, type glob, module, address glob; capped and paged. |
| Why it is replaced ( |
| Two plans of the same config: new, removed, different action, different planned values. |
| Output changes and |
Try asking
"Summarize
plan.json. Is anything being destroyed?""What are the riskiest changes in
plan.json? Rank them.""Why is
aws_db_instance.mainbeing replaced, and what depends on it?""Show me exactly what changes on
module.network.aws_security_group.web.""Did anyone change anything outside Terraform? (check drift)"
"Compare
plan-before.jsonandplan-after.json: what did my refactor change?""List every deleted resource under
module.legacy."
Limits and behaviour
Size: plan files up to 256 MB are accepted by default (
--max-mb Nchanges it). Bigger files are refused with a clear message. The file is read once and parsed in one pass; expect roughly 5-10x the file size in RAM. The last two parsed plans are cached.Input checks: a state file (
terraform show -jsonof a state), a raw.tfstate, a binarytfplan, or the streaming log ofterraform plan -jsoneach get a specific explanation of what to run instead.NaN/Infinityare rejected; integers over 1000 digits are shown as "(huge integer)"; absurd nesting is a clean error.Understands:
format_version1.x (Terraform 1.5 to 1.9, OpenTofu),count/for_eachaddresses with quotes, brackets and unicode, nested modules,moved/import/forget(no-op withprevious_address/importing),deferred_changes,errored, empty plans.Heuristics are heuristics. The risk table covers common aws/azurerm/google/kubernetes types plus generic name patterns. It will miss things and over-flag a few. Read the diff for anything that matters.
The plan JSON does not record
lifecyclesettings, socreate_before_destroyis inferred from the action order.
Security
Read-only. No terraform/tofu execution, no network, no provider calls, nothing is written.
Sandbox. Only files under
--dir(default: the working directory) can be read. Paths are resolved with symlinks followed, and anything outside is refused.Secrets. Terraform's own sensitivity masks and a name heuristic are both applied before any value is shown; connection-string passwords, private key blocks, cloud access key ids and JWTs are scrubbed from displayed strings. The plan's top-level
variablesandgenerated_configare never printed. Heuristics can over-mask (asecret_idis masked) which is the safe side; a secret stored under an innocuous name inside a larger string (for example inside a JSON policy document) is shown as part of that string, so treat plan output like the plan file.A plan contains real infrastructure details. Anything an agent reads goes to your model provider: only point it at plans you are willing to share with it.
Development
uv sync --extra test
uv run pytest tests
uv run ruff check src tests
uv run mypy --strict srcThe fixtures in tests/fixtures/plans are generated by tests/fixtures/make_plans.py
(hand-shaped Terraform 1.5-1.9 plans). An optional test that makes a real plan with a local
binary (terraform_data only, no provider download) runs with TFPLAN_REAL_TERRAFORM=1.
Want to build it yourself? See tfplan-mcp-the-hard-way.
MIT licensed.
Available Tools
7 toolscompare_plansB
Compare two plans of the same configuration (for example before and after a code change, or two environments): resource changes new in B, gone in B, with a different action, or the same action but different planned values (shown as masked attribute diffs).
Inputs: path_a (required), path_b (required), limit. Returns: result
diff_resourceA
Attribute-level diff (before -> after) for one resource, with nested paths such as ingress[0].cidr_blocks[0]. Unknown values show as (known after apply). Sensitive values are ALWAYS shown as (sensitive): by Terraform's sensitivity masks and, as a second layer, by attribute names that look like credentials (password, secret, token, key...).
address: exact address as in the plan, e.g. aws_instance.web["a b"] or module.net.aws_vpc.main[0]. Use list_changes to find addresses; unknown addresses return close matches.
Inputs: path (required), address (required), max_attributes. Returns: result
explain_replaceB
Explain why a resource is being replaced: the action_reason, the forcing attribute(s) from replace_paths with their before -> after values, the order (destroy-then-create vs create_before_destroy), what that means (downtime, name collisions), the lifecycle hint from the plan's configuration when present, and the dependents that reference it.
Inputs: path (required), address (required). Returns: result
list_changesB
List resource changes, filtered and capped.
action: create | update | delete | replace | read | forget | no-op | import | move | other (default: everything except plain no-ops). type: glob such as aws_s3_*. module: 'root' or a module address prefix such as module.network (includes nested modules). address: glob where only * and ? are wild (brackets in addresses are literal).
Inputs: path (required), type, limit, action, +3 more. Returns: result
outputs_and_driftB
Output changes and resource_drift: what changed OUTSIDE Terraform (console edits, other tools) since the last apply, with masked attribute diffs. Sensitive outputs are masked.
Inputs: path (required), limit. Returns: result
plan_summaryA
Overview of a plan: counts of create/update/delete/replace/read/forget/no-op by resource type and module, whether it is an empty or destroy plan, moved/imported resources, drift, output changes, failing checks, terraform version and warnings (errored, incomplete, deferred changes). Call this first.
path: plan JSON from terraform show -json tfplan (relative to the server's --dir).
Files over the size limit (256 MB default, --max-mb) are refused with a clear error.
Inputs: path (required). Returns: result
risky_changesA
Ranked list of risky changes with reasons. Flags: destroy/replace of stateful resources (databases, buckets, disks, KMS keys, DNS zones, secrets; aws/azurerm/google/kubernetes plus generic name heuristics), which attribute forces a replacement, IAM wildcards and admin policies, security groups / firewalls opening 0.0.0.0/0 or ::/0 (admin and database ports rated highest), public access enabled, encryption disabled or key changed, deletion protection off, backup retention reduced. Tags-only updates are listed as low.
min_severity: info | low | medium | high | critical. Only the findings are listed; resources not mentioned had nothing notable. Values of attributes are never printed here.
Inputs: path (required), limit, min_severity. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct facet of plan analysis: overview, risk ranking, single-resource diff, filtered listing, replacement explanation, plan-to-plan comparison, and outputs/drift. The main potential confusion is between list_changes, compare_plans, and plan_summary, since all surface resource changes, but the descriptions draw clear boundaries (filter/cap vs two-plan comparison vs counts).
Most names are verb_noun (diff_resource, list_changes, explain_replace, compare_plans), but plan_summary, risky_changes, and outputs_and_drift are noun-first, mixing conventions. Names remain readable and descriptive despite the inconsistency.
Seven tools is well-scoped for a Terraform plan analysis server, with each tool covering a clearly separate analytical need. Nothing feels redundant or missing at the count level.
The surface covers the plan lifecycle well: summary, change listing, attribute diffs, replacement reasoning, risk assessment, plan comparison, and outputs/drift. Minor gaps exist, such as no way to dump a full resource's planned configuration beyond a diff or to query state/configuration outside the plan.
Related MCP Connectors
Review your AI agent's database changes on your schema, with plain-language risk, before they run.
Read-only AI coding tools for change verification, release readiness, capacity, and guidance.
Risk-scan a diff, flag AI-generated-code tells, find secrets. 5 of 7 tools need no account.
Security reviews for coding agents: diffs checked against your org policy and live infrastructure.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables visualization of Terraform plan changes as interactive cloud architecture diagrams with official AWS, Azure, and GCP icons, showing resource dependencies and changes.7MIT
- AlicenseAqualityDmaintenanceEnables coding agents to assess Terraform plans with blastcheck, producing machine-readable Impact Manifests and plain-language explanations of change risks.2Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables state-aware Terraform/OpenTofu plan evaluation against live AWS topology and CloudWatch telemetry, detecting reliability blast radius and FinOps waste before merge.Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI coding agents to compute a 0-1 diff risk score for the current branch or any pull request, exposing the driving signals, evidence, tier and resulting auto-approve or human-review policy decision. Agents can use it to decide whether a low-blast-radius, AI-reviewed PR is safe to merge automatically while flagging risky changes for a human.6377 npm3MIT