Skip to main content
Glama
RajeevSirohi

mcp-server-terraform

by RajeevSirohi

mcp-server-terraform

CI npm License: MIT

A Model Context Protocol (MCP) server that lets Claude manage Terraform infrastructure through natural language.

Run plans, apply changes, inspect state, and diagnose failures — all from a Claude conversation.

What it does

Instead of switching to a terminal to run terraform plan, you can ask Claude:

"Plan the changes in /infra/staging and explain what will change"

"Apply it — but only if no resources will be destroyed"

"Show me all the outputs from the prod workspace"

"Something broke after the last apply — diagnose it"

The server translates these into real terraform CLI commands on your machine, with a built-in safety confirmation flow before any destructive operation runs.

Related MCP server: tfmcp

Tools

Tool

Description

Destructive

tf_init

Initialize a Terraform working directory

No

tf_validate

Validate configuration syntax

No

tf_plan

Run a plan and return the diff + risk/cost summary

No

tf_apply

Apply changes (requires confirmed: true)

Yes

tf_destroy

Destroy infrastructure (requires confirmed: true)

Yes

tf_output

Read output values from state

No

tf_state

List, show, move, or remove state entries

Partial

tf_workspace

List, show, select, or create workspaces

No

tf_preflight

Check provider CLI authentication before running

No

tf_drift

Detect resources changed outside Terraform

No

tf_resource

Import, taint, untaint, or refresh resources

Yes

Plan risk & cost summary

Every plan (and every apply preview) is analyzed via terraform show -json and annotated with a structured summary — destroyed resources are called out, and always-on resources that commonly cause bill shock are flagged with rough monthly costs:

── Plan Summary ──
+ 3 create, ~ 1 update, - 0 destroy, ± 0 replace

💸 EXPENSIVE — always-on resources being created:
   ⚠ aws_nat_gateway.main (~$32/month + data processing if left running)
   Remember to tf_destroy when you're done experimenting.

Cost-flagged resource types include NAT gateways, load balancers, EKS/AKS/GKE control planes, RDS/Cloud SQL instances, ElastiCache, Redshift, MSK, and Azure Firewall (~$900/month!).

Drift detection

tf_drift runs a refresh-only plan and reports resources that were changed outside Terraform (e.g. manually in the cloud console), with the changed attribute names and remediation options.

Audit logging

Set AUDIT_LOG_PATH to a file path and every tool call is appended as a JSON line with timestamp, tool name, outcome, and duration. Variable values are always redacted (db_password=<redacted>) — only names are logged.

Confirmation flow

tf_apply and tf_destroy use a two-step safety flow:

  1. First call (no confirmed) → runs terraform plan, shows the diff, does nothing else

  2. Second call (confirmed: true) → actually applies or destroys

Claude is instructed to never pass confirmed: true without first presenting the plan to you.

Prompt

The server exposes a /tf-diagnose prompt that guides Claude through a systematic 5-step diagnosis of plan or apply failures.

Prerequisites

Installation

No install needed — run it straight from npm:

npx @rajsir/mcp-server-terraform

Or, for development, from source:

git clone https://github.com/RajeevSirohi/mcp-server-terraform.git
cd mcp-server-terraform
npm install
npm run build

Claude Desktop setup

Add to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "terraform": {
      "command": "npx",
      "args": ["-y", "@rajsir/mcp-server-terraform"]
    }
  }
}

(If running from source instead, use "command": "node" with "args": ["/absolute/path/to/dist/index.js"].)

Restart Claude Desktop. You should see a hammer icon indicating tools are available.

Usage

Once connected, just talk to Claude about your Terraform workspaces in plain language. Some examples:

First time in a new workspace

"Initialize the terraform config in C:\infra\staging and check if I'm logged into the right cloud accounts"

Claude runs tf_init, then tf_preflight — if you're not authenticated it tells you exactly which command to run (az login, aws configure, ...).

The everyday plan → review → apply loop

"Plan the changes in C:\infra\staging and explain what will change"

You get the plan diff plus a summary: how many resources created/updated/destroyed, anything destructive called out explicitly, and cost warnings for expensive always-on resources.

"Looks good, apply it"

Claude shows the plan preview one more time and asks for your confirmation — nothing is applied until you say yes. This two-step gate is built into the server itself, not just the prompt, so Claude cannot skip it.

Checking on your infrastructure

"Did anyone change anything outside terraform in the prod workspace?"

tf_drift compares state against reality and reports what was modified in the console, with options to accept or revert.

"Show me all the outputs" · "List everything in state" · "What workspaces exist?"

Learning / experimenting (e.g. cert prep)

"Apply the VPC lab in C:\labs\vpc, and when I say 'done' destroy everything"

The cost flags are your friend here — if a lab creates a NAT gateway or EKS cluster, the plan summary warns you what it costs per month if forgotten:

💸 EXPENSIVE — always-on resources being created:
   ⚠ aws_nat_gateway.main (~$32/month + data processing if left running)
   Remember to tf_destroy when you're done experimenting.

Fixing things

"terraform plan is failing in C:\infra\staging — diagnose it"

The /tf-diagnose prompt walks Claude through validate → providers → plan → state → outputs systematically. There's also /tf-login for step-by-step authentication setup per provider.

"Import the S3 bucket my-legacy-bucket into state as aws_s3_bucket.legacy"

"Taint the web server so it gets recreated on the next apply"

Run with ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS=true (see Safety modes below) so apply/destroy are unavailable entirely, and set AUDIT_LOG_PATH so every operation is logged.

Safety modes

Control which tools are available via environment variables:

Variable

Effect

ALLOW_ONLY_READONLY_TOOLS=true

Only tf_validate, tf_plan, tf_output

ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS=true

Blocks tf_apply, tf_destroy, tf_state mv/rm

ALLOWED_TOOLS=tf_plan,tf_output

Explicit comma-separated allowlist

Example — read-only mode:

{
  "mcpServers": {
    "terraform": {
      "command": "node",
      "args": ["/path/to/dist/index.js"],
      "env": {
        "ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS": "true"
      }
    }
  }
}

Development

npm run dev       # watch mode (recompiles on save)
npm test          # run tests
npm run build     # production build

Project structure

src/
  index.ts                  # MCP server entry point, tool registration
  config/                   # (reserved for future config/telemetry)
  models/
    common-parameters.ts    # Shared Zod schemas
  security/
    tf-flags.ts             # Dangerous flag blocking
  tools/
    tf-init.ts
    tf-validate.ts
    tf-plan.ts
    tf-apply.ts             # Two-step confirmation flow
    tf-destroy.ts           # Two-step confirmation flow
    tf-output.ts
    tf-state.ts
    tf-workspace.ts
  utils/
    terraform-runner.ts     # Core exec wrapper, workspace switching
  prompts/
    index.ts                # /tf-diagnose prompt
tests/
  tf-flags.test.ts
  tf-apply.test.ts

Adding a new tool

  1. Create src/tools/tf-yourcommand.ts — export a *Schema const and an async handler function

  2. Import both in src/index.ts

  3. Add the schema to readonlyTools or destructiveTools array

  4. Add a case in the CallToolRequestSchema handler switch

Roadmap

  • Terraform Cloud / Enterprise API support (Phase 2)

  • OpenTelemetry tracing

  • SSE / streamable HTTP transport for remote deployments

  • Docker image on GitHub Container Registry

  • Plan risk & cost analysis

  • Drift detection

  • Import / taint / untaint / refresh

  • Audit logging

  • CI (build, test matrix, e2e against real terraform)

Contributing

See CONTRIBUTING.md.

License

MIT — see LICENSE.

Available Tools

11 tools
tf_applyA
Destructive

Apply Terraform changes to real infrastructure.

TWO-STEP SAFETY FLOW:

  1. Call without confirmed=true → runs terraform plan, shows the diff, returns without applying.

  2. Call with confirmed=true after reviewing the diff → actually applies the changes.

Never pass confirmed=true without first showing the plan output to the user.

ParametersJSON Schema
NameRequiredDescriptionDefault
varsNoVariable overrides in key=value format, e.g. ["region=us-east-1"]
targetNoLimit operation to a specific resource address, e.g. aws_instance.web
varFileNoPath to a .tfvars or .tfvars.json file
workdirYesAbsolute or relative path to the directory containing .tf files
planFileNoPath to a saved plan file from tf_plan (recommended for exact apply)
confirmedNoMust be true to actually apply. Omit or set false to preview only.
workspaceNoTerraform workspace to use (default: current workspace)

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description discloses the two-step flow, emphasizing safety and the behavior difference between confirmed=false (preview) and confirmed=true (apply), complementing the destructiveHint annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Concise, well-structured description with no wasted words; key safety instructions are front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Explains return behavior (plan output vs. actual apply), mentions optional parameters like planFile, and provides sufficient context for a destructive action tool without output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with parameter descriptions; description adds context for the 'confirmed' parameter via the two-step flow, enhancing understanding beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states 'Apply Terraform changes to real infrastructure' and explains the two-step safety flow, distinguishing it from sibling tools like tf_plan (preview only) and tf_destroy (destroy resources).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs to first call without confirmed=true to preview, then with confirmed=true after reviewing diff, and warns against passing confirmed=true without prior plan output.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_destroyA
Destructive

Destroy all Terraform-managed infrastructure in the workspace.

TWO-STEP SAFETY FLOW:

  1. Call without confirmed=true → shows the destroy plan (what will be deleted).

  2. Call with confirmed=true after the user explicitly approves → destroys everything.

This is irreversible. Always show the plan and get explicit user approval first.

ParametersJSON Schema
NameRequiredDescriptionDefault
varsNoVariable overrides in key=value format, e.g. ["region=us-east-1"]
targetNoLimit operation to a specific resource address, e.g. aws_instance.web
varFileNoPath to a .tfvars or .tfvars.json file
workdirYesAbsolute or relative path to the directory containing .tf files
confirmedNoMust be true to actually destroy. Omit or false to preview only.
workspaceNoTerraform workspace to use (default: current workspace)

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the destructiveHint annotation, the description adds critical behavioral details: the tool is irreversible and requires a two-step confirmation process. This fully informs the agent of the destructive nature and necessary precautions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with three sentences and a clear list of steps. Front-loaded with the main purpose, every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no output schema, the description adequately covers the safety flow and overall behavior. It assumes basic Terraform knowledge but is sufficiently complete for selecting and invoking the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage of parameter descriptions. The description does not add meaning beyond that, but given the high schema coverage, a baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Destroy all Terraform-managed infrastructure in the workspace', using a specific verb and resource. It distinguishes from siblings like tf_apply and tf_plan by emphasizing irreversibility and the destroy action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly outlines a two-step safety flow, guiding when to use without confirmed (preview) and with confirmed (actual destroy). It instructs to always show the plan and get explicit user approval, providing clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_driftA

Detect infrastructure drift — resources that were changed outside of Terraform (e.g. manually in the cloud console). Runs a refresh-only plan and reports differences between state and reality. Read-only, makes no changes.

ParametersJSON Schema
NameRequiredDescriptionDefault
workdirYesAbsolute or relative path to the directory containing .tf files
workspaceNoTerraform workspace to use (default: current workspace)

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite no annotations, the description fully discloses behavior: it runs a refresh-only plan, reports differences, and makes no changes. It explicitly states 'Read-only', which is key for agent decision-making.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise: three sentences cover the tool's purpose, mechanism, and safety. No unnecessary words or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description lacks details about the output format or structure. While it says 'reports differences', it does not specify whether output is text, JSON, or structured data. For a tool with no output schema, this is a gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear parameter descriptions. The tool description adds no additional semantic value beyond the tool's overall purpose. A score of 3 is appropriate as parameters are adequately covered by the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Detect infrastructure drift'. It explains what drift is and how it works ('Runs a refresh-only plan and reports differences between state and reality'). This distinguishes it from siblings like tf_plan or tf_apply.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies safety ('Read-only, makes no changes') but does not explicitly guide when to use tf_drift versus alternative sibling tools like tf_plan. Users can infer usage context, but explicit when-to-use advice is missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_initA

Initialize a Terraform working directory. Downloads providers and modules. Run this before plan or apply on a fresh workspace.

ParametersJSON Schema
NameRequiredDescriptionDefault
upgradeNoPass -upgrade to update providers/modules to latest allowed versions
workdirYesAbsolute or relative path to the directory containing .tf files
reconfigureNoPass -reconfigure to reinitialize backend even if already configured

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of disclosing behavioral traits. It states that the tool 'Downloads providers and modules', which is a key behavior. However, it does not mention other important aspects such as side effects (e.g., creating .terraform directory), idempotency, or permission requirements. The description provides minimal yet adequate transparency for a straightforward init operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, each sentence is informative and front-loaded with the core action. No extraneous words. It earns its place by clearly stating the tool's purpose and usage context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple init tool with no output schema and 3 parameters fully described in the schema, the description is mostly complete. It explains the tool's role in the Terraform workflow. However, it could mention the creation of the .terraform directory or handling of backend configuration, but the given information suffices for typical usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description does not add any parameter-specific meaning beyond the schema, which is acceptable but does not enhance understanding beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Initialize a Terraform working directory' and 'Downloads providers and modules', giving a specific verb and resource. It also indicates the tool's placement in the workflow ('Run this before plan or apply on a fresh workspace'), distinguishing it from siblings like tf_plan or tf_apply which are not initialization operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises when to run this tool ('before plan or apply on a fresh workspace'), providing clear context for usage. However, it does not mention when not to use it or compare it to other siblings like tf_validate or tf_workspace, but the guidance is sufficient for the primary use case.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_outputA

Read Terraform output values from the current state. Returns all outputs as JSON, or a specific output by name.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoSpecific output name to retrieve. Omit to get all outputs.
workdirYesAbsolute or relative path to the directory containing .tf files
workspaceNoTerraform workspace to use (default: current workspace)

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so description carries burden. It states it reads state and returns JSON, but does not declare read-only safety, permissions, or potential side effects beyond the implied non-destructive nature.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose. No filler, every sentence adds necessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool (3 parameters, no output schema, no annotations), the description covers core functionality, return format, and parameter usage. Slight gap in not mentioning workspace or path handling, but overall complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (baseline 3). Description adds value by explaining the 'name' parameter behavior ('specific output by name') and return format (JSON), which goes beyond schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool reads Terraform output values from current state, with specific verb 'Read' and resource 'Terraform output values'. It distinguishes from sibling tools (e.g., tf_apply, tf_destroy) which modify state.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies the tool is for retrieving outputs, but does not explicitly state when to use it versus siblings like tf_state or tf_resource, nor when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_planA

Run terraform plan and return a human-readable diff of what will change. Safe — makes no changes to infrastructure.

ParametersJSON Schema
NameRequiredDescriptionDefault
varsNoVariable overrides in key=value format, e.g. ["region=us-east-1"]
targetNoLimit operation to a specific resource address, e.g. aws_instance.web
varFileNoPath to a .tfvars or .tfvars.json file
workdirYesAbsolute or relative path to the directory containing .tf files
workspaceNoTerraform workspace to use (default: current workspace)
savePlanFileNoOptional path to save the binary plan file for use with tf_apply

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It clearly states the tool is safe and makes no changes, which is the key behavioral trait. It also mentions it returns a human-readable diff, indicating output format. However, it does not disclose error handling, exit codes, or potential failure modes (e.g., state lock issues). The transparency is good but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is only two sentences, both front-loaded with essential information. Every sentence earns its place: the first explains the action and output, the second emphasizes safety. No unnecessary words or repetition. This is an example of ideal conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 6 parameters, no output schema, and no annotations, the description provides the core purpose and safety guarantee but lacks operational context. It does not mention that the tool requires an initialized Terraform working directory, that it may use state locks, or how the plan file (savePlanFile) can be used with tf_apply. While adequate for basic understanding, it leaves gaps for an AI agent to infer important steps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all 6 parameters are documented in the schema. The description adds no additional meaning or usage hints beyond what the schema provides (e.g., it doesn't explain that 'vars' accepts multiple key=value strings). Per guidelines, baseline 3 is appropriate when schema covers parameters fully and description adds no extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool runs 'terraform plan' and returns a human-readable diff. It emphasizes safety ('Safe — makes no changes to infrastructure'), which distinguishes it from sibling tools like tf_apply and tf_destroy. The verb and resource are specific and well-understood.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for previewing changes before applying (by stating 'Safe — makes no changes'), but it does not explicitly state when to use this tool versus alternatives like tf_apply. There is no mention of prerequisites (e.g., initialized workspace) or scenarios where this tool should not be used. While the safety warning is helpful, clearer guidance on workflow sequencing would improve the score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_preflightA

Check which cloud providers are used in a Terraform workspace and verify authentication status for each. Call this before plan or apply to catch credential issues early.

ParametersJSON Schema
NameRequiredDescriptionDefault
workdirYesAbsolute or relative path to the directory containing .tf files

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so description carries full burden. It implies a non-destructive read-only operation via 'check' and 'verify', but does not explicitly state lack of side effects or return format. Still sufficiently clear for a preflight check.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences: first describes function, second gives usage recommendation. No fluff, front-loaded, and every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple single-parameter input and no output schema, the description adequately covers purpose and usage. It does not describe return values, but for a preflight check this is acceptable. Sibling tools provide clear context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds no additional meaning to the 'workdir' parameter beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool checks which cloud providers are used and verifies authentication status, a specific verb+resource. It differentiates from sibling execution tools like tf_plan and tf_apply by explicitly recommending use before them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly advises 'Call this before plan or apply to catch credential issues early', giving clear when-to-use guidance and implicitly distinguishing from execution tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_resourceA
Destructive

Resource-level state operations:

  • import: Bring an existing cloud resource under Terraform management (requires address + id)

  • taint: Mark a resource for recreation on next apply (requires address)

  • untaint: Remove the taint mark (requires address)

  • refresh: Sync state with real infrastructure (accepts drift into state)

ParametersJSON Schema
NameRequiredDescriptionDefault
idNoCloud provider resource ID for import, e.g. i-0abcd1234 or an Azure resource ID
addressNoResource address, e.g. aws_instance.web (required for import/taint/untaint)
workdirYesAbsolute or relative path to the directory containing .tf files
operationYesResource operation to perform
workspaceNoTerraform workspace to use (default: current workspace)

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds behavioral context beyond the annotations (destructiveHint: true) by explaining each operation's effect, such as 'Mark a resource for recreation' for taint. Although it does not detail side effects or permissions, the use case for each operation is clear. The description does not contradict the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, using bullet points to list operations. It is front-loaded with the overall purpose. Every sentence provides essential information without redundancy. This structure is ideal for quick comprehension by an AI agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no output schema, the description adequately explains the four operations and their parameter requirements. It covers the core behavior, though it does not mention error conditions, return formats, or the workspace parameter's role. For a multi-operation tool, this is reasonably complete but could be more thorough by adding outcome descriptions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by clarifying which parameters are required per operation (e.g., 'import: requires address + id'). This provides contextual meaning beyond the schema's property descriptions, particularly for the 'operation' enum and conditional requirements.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Resource-level state operations' and lists four specific operations (import, taint, untaint, refresh) with brief explanations. It uses specific verbs and resources, making the tool's purpose unambiguous. Though it doesn't explicitly differentiate from siblings like tf_state, the focused scope on individual resource operations provides sufficient distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by listing operations and requirements (e.g., 'requires address + id'), but it does not explicitly state when to use this tool versus alternatives (e.g., tf_state, tf_apply). No when-not or exclusion criteria are provided. This leaves the agent without clear guidance on selecting the correct tool among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_stateA
Destructive

Manage Terraform state. Supports the following operations:

  • list: List all resources in state

  • show: Show attributes of a specific resource

  • mv: Move/rename a resource in state (use with care)

  • rm: Remove a resource from state without destroying it (destructive)

ParametersJSON Schema
NameRequiredDescriptionDefault
addressNoResource address for show/rm/mv source, e.g. aws_instance.web
workdirYesAbsolute or relative path to the directory containing .tf files
operationYesState operation to perform
workspaceNoTerraform workspace to use (default: current workspace)
destinationNoDestination address for mv operation only

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide destructiveHint=true, and the description adds that rm removes from state without destroying the actual resource, and mv should be used with care. However, it does not disclose other behavioral traits such as potential state lock conflicts, the fact that these operations modify the state file permanently, or the need for proper permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, uses bullet points for operations, and front-loads the main purpose. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and relatively simple operations, the description adequately covers the tool's functionality. However, it could be more complete by explaining how the workspace parameter works or what happens if address is omitted for list operations. The sibling tools list is large, but the description sufficiently distinguishes them.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly describing all parameters (workdir, operation, address, workspace, destination) with examples. The description adds no additional semantic meaning beyond what the schema provides, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it manages Terraform state and lists four specific operations (list, show, mv, rm). This distinguishes it from sibling tools like tf_apply, tf_destroy, etc., which perform different Terraform actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'use with care' for mv and notes rm is destructive, giving some guidance on caution. However, it does not explicitly state when to use this tool over siblings like tf_resource (which manages resources) or tf_init, nor does it explain prerequisites like requiring an initialized workspace.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_validateA

Validate Terraform configuration files for syntax and internal consistency. Does not access remote state or APIs.

ParametersJSON Schema
NameRequiredDescriptionDefault
workdirYesAbsolute or relative path to the directory containing .tf files

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility. It discloses that the tool does not access remote state or APIs, implying it is safe and local, but lacks details on success/failure behavior or output format. This is adequate for a simple validation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loading the core purpose and adding a key constraint. No superfluous content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple validation tool with one parameter and no output schema, the description covers essential aspects: what it validates, what it avoids, and the required input path. Minor omission of return value details does not significantly detract.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single parameter 'workdir', which is described in the schema. The description adds no additional parameter details beyond the schema, resulting in baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool validates Terraform configuration files for syntax and internal consistency, distinguishing it from sibling tools like tf_apply or tf_plan which perform different operations. It adds specificity by noting it does not access remote state or APIs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for local validation without remote access, but does not explicitly state when to use this tool versus alternatives or provide exclusions. Users must infer context from the tool name and sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tf_workspaceA

Manage Terraform workspaces. Supports:

  • list: List all workspaces and show which is active

  • show: Show the current workspace name

  • select: Switch to a workspace

  • new: Create a new workspace

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoWorkspace name for select or new operations
workdirYesAbsolute or relative path to the directory containing .tf files
operationYesWorkspace operation to perform

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose effects. It mentions operations but does not clarify that 'select' changes the active workspace (a side effect) or that 'new' creates a workspace (a mutation). The description lacks detail on permissions, prerequisites (e.g., terraform init), or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (two sentences with bullet points) and front-loaded with the core purpose. Every word contributes information; no fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool supports four operations with three parameters and no output schema. While the description covers the operations, it omits details about return values (e.g., format of list output), constraints (e.g., 'select' requiring an existing workspace), and error handling. Adequate for simple usage but not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for all parameters, earning a baseline of 3. The description adds marginal value by naming operations but does not elaborate on parameter usage beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states 'Manage Terraform workspaces' and lists four specific operations (list, show, select, new), clearly identifying the resource and actions. This effectively distinguishes it from sibling tools like tf_apply or tf_plan, which focus on other Terraform lifecycle steps.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lists operations but provides no explicit guidance on when to use this tool versus alternatives (e.g., for workspace management vs. resource provisioning). Context is implied by the tool name and sibling list, but no when-to-use or when-not-to-use instructions are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 11 tool updatesv0.1.0
    • First observedtf_apply
    • First observedtf_destroy
    • First observedtf_drift
    • First observedtf_init
    • First observedtf_output
    • First observedtf_plan
    • First observedtf_preflight
    • First observedtf_resource
    • First observedtf_state
    • First observedtf_validate
    • First observedtf_workspace

TDQS

A4.2/5.0
Disambiguation5/5

Each tool has a distinct purpose: tf_apply applies changes, tf_destroy destroys, tf_drift detects drift, tf_init initializes, tf_output reads outputs, tf_plan plans, tf_preflight checks auth, tf_resource handles resource-level state ops, tf_state manages state, tf_validate validates config, tf_workspace manages workspaces. No overlap.

Naming Consistency5/5

All tools follow the tf_ prefix with clear verb names (e.g., apply, destroy, drift, init, output, plan, preflight, resource, state, validate, workspace). The pattern is consistent and predictable.

Tool Count5/5

11 tools cover the essential Terraform operations comprehensively—init, validate, plan, apply, destroy, state management, resource ops, drift detection, outputs, workspace management, and preflight checks. The count is well-scoped for the domain.

Completeness5/5

The tool set covers the full Terraform workflow: init, validate, plan, apply, destroy, plus state manipulation, resource import/taint/untaint/refresh, drift detection, output reading, workspace management, and preflight authentication checks. No obvious gaps.

Maintenance

ActivityStale
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
    8
    36
    186
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    🌍 Terraform Model Context Protocol (MCP) Tool - An experimental CLI tool that enables AI assistants to manage and operate Terraform environments. Supports reading Terraform configurations, analyzing plans, applying configurations, and managing state with Claude Desktop integration. ⚡️
    371
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    A Model Context Protocol (MCP) server that integrates Claude with the Terraform Cloud API, allowing Claude to manage your Terraform infrastructure through natural conversation.
    62
    23
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol server that enables managing Terrakube infrastructure through natural language, handling workspace management, variables, modules, and organization operations.
    16
    22
    3
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RajeevSirohi/mcp-server-terraform'

If you have feedback or need assistance with the MCP directory API, please join our Discord server