Terraform (MCP infrastructure)
Industry Definition Set • Entity Resolution Path: /glossary/terraform-mcp
Quick Answer / TL;DR
A declarative infrastructure-as-code CLI tool that an MCP server can wrap to let an AI agent propose plan output for human review, with apply gated behind an explicit approval flag rather than run automatically.
Key Takeaways
- No first-party SDK exists - integrations wrap the CLI itself via a child process, restricted to an allowlisted set of directories.
- plan is safe to expose freely since it's read-only; apply should require an explicit approval flag set only after a human reviews the plan.
- Remote state backends with locking (e.g. S3 + DynamoDB) prevent concurrent applies from corrupting state.
Definitive Statement: A declarative infrastructure-as-code CLI tool that an MCP server can wrap to let an AI agent propose plan output for human review, with apply gated behind an explicit approval flag rather than run automatically.
Technical Context & Protocol Usage
- Detailed Explanation
- Terraform has no first-party Node SDK, so an MCP integration wraps the terraform CLI itself via a child process, restricted to an allowlist of working directories so a model can't be steered into operating against an unintended state file. The safe pattern splits plan (read-only, safe to call freely) from apply (requires an explicit approved: true argument the model can only set after a human has actually reviewed the plan output) - never letting a single tool call both propose and execute a change in one turn.
Format & Payload Metadata
Format: HCL configuration files, executed via the terraform CLI
Latency: Seconds to minutes per plan/apply, dependent on the number of resources involved
Real-World Implementation Use Case
An MCP tool runs terraform plan in an allowlisted directory and returns the diff for the user to review before a separate apply tool (requiring approved: true) is ever called.
Cite This Page
MLA Style:
MCPserver.in Engineering. "Terraform (MCP infrastructure)." MCPserver.in Knowledge Hub, 21 July 2026, mcpserver.in/glossary/terraform-mcp.
Related Terms
Model Context Protocol (MCP)
An open, secure protocol that standardizes how artificial intelligence agents and large language models (LLMs) exchange context, tools, prompts, and data resources with external servers.
JSON-RPC 2.0
A lightweight, stateless remote procedure call (RPC) protocol defined in JSON that utilizes request, response, and notification message frames.
Stdio Transport (Standard Input/Output)
A local-only transport mechanism where the AI client spawns the MCP server as a child process and communicates via standard input (stdin) and standard output (stdout) channels.
SSE Transport (Server-Sent Events)
A lightweight, unidirectional HTTP-based streaming protocol used by remote MCP servers to push messages to AI clients, with client-to-server writes sent over standard POST requests.
Deploy Secure MCP Clusters
Run remote SSE Model Context Protocol servers in highly secure, fully-managed environment located inside India (Mumbai/Bengaluru).
Deploy Node Now