Tfmcp MCP Server

tfmcp is a command-line tool that helps you interact with Terraform via the Model Context Protocol (MCP). It allows LLMs to manage and operate your

Local serverstdio

What is the Tfmcp MCP Server?

tfmcp is a command-line tool that helps you interact with Terraform via the Model Context Protocol (MCP). It allows LLMs to manage and operate your Terraform

What it needs from you

  • Rust 1.88.0+ (Rust Edition 2024) - Terraform CLI 1.15.8 installed and available in PATH - Claude Desktop (for AI assistant integration) - Docker (optional, for containerized deployment)

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
init_terraformInitialize Terraform working directory
get_terraform_planGenerate a saved plan, or retrieve its redacted result and status by plan ID
list_terraform_plansList saved plan IDs, targets, statuses, and destroy flags
discard_terraform_planRemove an unneeded saved plan and free retention capacity
analyze_planNEW Analyze plan with risk scoring and recommendations
apply_terraformApply the reviewed saved plan ID and verify state resource addresses
destroy_terraformApply a reviewed saved destroy plan with explicit deletion permissions
validate_terraformValidate configuration syntax
validate_terraform_detailedDetailed validation with guidelines
get_terraform_stateShow current state
analyze_stateNEW Analyze state with drift detection
review_terraform_planReview plan risk, blockers, destructive changes, and recommendations
summarize_plan_for_prGenerate markdown plan summary for PR comments
run_terraform_quality_checksRun CI-friendly validation, module health, guideline, and lockfile checks
inspect_state_safetyInspect state readability, drift risk, lockfile status, and blockers
detect_drift_candidatesDetect drift candidates from readable state without modifying infrastructure
prepare_terraform_changeGenerate blockers, warnings, and a recommended change sequence
list_terraform_resourcesList all managed resources
set_terraform_directoryChange active project directory
terraform_workspaceNEW Manage workspaces (list, show, new, select, delete)
terraform_importNEW Import existing resources
terraform_taintNEW Taint/untaint resources
terraform_refreshNEW Refresh state
terraform_fmtNEW Format code
terraform_graphNEW Generate dependency graph
terraform_outputGet output values with sensitive values redacted, including named queries
terraform_providersNEW Get provider info with lock file
check_provider_lockfileCheck .terraform.lock.hcl for reproducible provider selections
analyze_terraformAnalyze configuration
inspect_terraform_projectInspect local Terraform directories, modules, and likely entrypoints
detect_terraform_entrypointsDetect likely root module entrypoints
analyze_module_healthModule health with cohesion/coupling metrics
get_resource_dependency_graphResource dependencies visualization
suggest_module_refactoringRefactoring suggestions
get_security_statusSecurity scan with secret detection
search_providersSearch providers (HashiCorp-compatible alias)
search_terraform_providersSearch providers
get_provider_detailsProvider details (HashiCorp-compatible alias)
get_provider_infoProvider details
get_provider_docsProvider documentation
get_provider_capabilitiesProvider resources, data sources, functions, and guides
search_modulesSearch modules (HashiCorp-compatible alias)
search_terraform_modulesSearch modules
get_module_detailsModule details
get_latest_module_versionLatest module version
get_latest_provider_versionLatest provider version
search_policiesSearch Sentinel/OPA policy libraries
get_policy_detailsPolicy library details
get_token_permissionsInspect configured token account details without exposing the token
list_terraform_orgsList visible organizations
list_terraform_projectsList projects in an organization
list_workspacesList workspaces in an organization
get_workspace_detailsGet workspace details by ID or organization/name
list_runsList workspace runs
get_run_detailsGet run details
get_plan_detailsGet plan details
get_plan_logsGet plan logs
get_plan_json_outputGet Terraform JSON plan output
get_apply_detailsGet apply details
get_apply_logsGet apply logs
get_workspace_policy_setsGet policy sets attached to a workspace
list_workspace_variablesList workspace variables
list_variable_setsList organization variable sets
read_workspace_tagsRead workspace tags
list_stacksList Terraform stacks
get_stack_detailsGet Terraform stack details
search_private_modulesSearch private registry modules
get_private_module_detailsGet private registry module details
search_private_providersSearch private registry providers
get_private_provider_detailsGet private registry provider details
create_workspaceCreate a workspace when ENABLE_TF_OPERATIONS=true
update_workspaceUpdate workspace settings when ENABLE_TF_OPERATIONS=true
delete_workspace_safelyUse the safe-delete workspace action when ENABLE_TF_OPERATIONS=true
create_runQueue a run when ENABLE_TF_OPERATIONS=true
action_runApply, discard, cancel, force-cancel, or force-execute a run when ENABLE_TF_OPERATIONS=true
create_workspace_variableCreate a workspace variable when ENABLE_TF_OPERATIONS=true
update_workspace_variableUpdate a workspace variable when ENABLE_TF_OPERATIONS=true
attach_policy_set_to_workspaceAttach a policy set to a workspace when ENABLE_TF_OPERATIONS=true
create_variable_setCreate a variable set when ENABLE_TF_OPERATIONS=true
create_variable_in_variable_setCreate a variable in a variable set when ENABLE_TF_OPERATIONS=true
delete_variable_in_variable_setDelete a variable from a variable set when ENABLE_TF_OPERATIONS=true
attach_variable_set_to_workspacesAttach a variable set to workspaces when ENABLE_TF_OPERATIONS=true
detach_variable_set_from_workspacesDetach a variable set from workspaces when ENABLE_TF_OPERATIONS=true
create_workspace_tagsCreate or attach workspace tags when ENABLE_TF_OPERATIONS=true
URIDescription

How to install the Tfmcp MCP Server

{
  "mcpServers": {
    "tfmcp": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-v",
        "/path/to/your/terraform:/app/terraform",
        "tfmcp",
        "mcp"
      ],
      "env": {
        "TERRAFORM_DIR": "/app/terraform"
      }
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

  • Rust 1.88.0+ (Rust Edition 2024) - Terraform CLI 1.15.8 installed and available in PATH - Claude Desktop (for AI assistant integration) - Docker (optional, for containerized deployment)
VariableDescriptionRequired
TERRAFORM_DIRDeclared in the maintainer’s client configuration.Optional

Example prompts to try

  • “Use Tfmcp to Registry.”
  • “Use Tfmcp to Completed.”
  • “Use Tfmcp to Planned.”

Frequently asked questions

tfmcp is a command-line tool that helps you interact with Terraform via the Model Context Protocol (MCP). It allows LLMs to manage and operate your Terraform Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.