Loading...

tfmcp is a CLI tool and MCP server enabling AI assistants to manage Terraform configurations, offering features from plan analysis to security controls.
Boost this tool
Subscribe to listing upgrades or segmented pushes.
tfmcp is a CLI tool and MCP server enabling AI assistants to manage Terraform configurations, offering features from plan analysis to security controls.
tfmcp offers robust security features, but its safety depends heavily on proper configuration. It is safe for read-only operations and analysis. Risky operations like applying changes should only be enabled with caution and thorough review of plans.
Performance depends on the complexity of the Terraform configuration and the speed of the Terraform CLI. Caching is used to improve performance.
Cost implications depend on the resources managed by Terraform. Consider the cost of API calls and the resources provisioned.
cargo install tfmcp{
"mcpServers": {
"tfmcp": {
"command": "/path/to/your/tfmcp", // Replace with the actual path from step 2
"args": ["mcp"],
"env": {
"HOME": "/Users/yourusername", // Replace with your username
"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"TERRAFORM_DIR": "/path/to/your/terraform/project" // Optional: specify your Terraform project
}
}
}
}TFMCP_LOG_LEVELTFMCP_ALLOW_DANGEROUS_OPSTFMCP_ALLOW_AUTO_APPROVETFMCP_MAX_RESOURCESTFMCP_AUDIT_ENABLEDTFMCP_AUDIT_LOG_SENSITIVEinit_terraformInitializes a Terraform working directory to prepare for operations.
Initializes the directory but does not modify infrastructure.
get_terraform_planGenerates an execution plan showing proposed changes to infrastructure.
Read-only operation; does not modify infrastructure.
apply_terraformApplies the Terraform configuration to create or modify infrastructure.
Modifies infrastructure and can cause irreversible changes.
destroy_terraformDestroys all Terraform-managed infrastructure.
Destroys infrastructure and can cause significant data loss.
terraform_workspaceManages Terraform workspaces, allowing you to switch between different environments.
Can modify the active workspace, potentially affecting subsequent operations.
terraform_importImports existing resources into Terraform management.
Adds resources to the state, which can affect future plans.
terraform_taintTaints or untaints resources, forcing them to be recreated on the next apply.
Forces resource recreation, potentially causing downtime.
terraform_refreshRefreshes the Terraform state to reflect the current state of the infrastructure.
Updates the state but does not modify infrastructure.
terraform_fmtFormats Terraform code to adhere to a consistent style.
Modifies code formatting, which could introduce unintended changes if not reviewed.
terraform_graphGenerates a dependency graph of Terraform resources.
Read-only operation; does not modify infrastructure.
terraform_outputRetrieves output values from the Terraform state.
Read-only operation; does not modify infrastructure.
terraform_providersGets information about the Terraform providers used in the configuration.
Read-only operation; does not modify infrastructure.
Environment Variable
cloud
tfmcp offers robust security features, but its safety depends heavily on proper configuration. It is safe for read-only operations and analysis. Risky operations like applying changes should only be enabled with caution and thorough review of plans.
Autonomy is limited by the configuration and enabled tools. Dangerous operations are disabled by default and require explicit enablement.
Production Tip
Carefully review and test all Terraform plans before applying them in production environments.
Set the `TFMCP_ALLOW_DANGEROUS_OPS` environment variable to `true`.
Audit logs are stored at `~/.tfmcp/audit.log` by default. The location can be customized using the `TFMCP_AUDIT_LOG_FILE` environment variable.
Set the `TFMCP_LOG_LEVEL` environment variable to `debug`, `info`, `warn`, or `error`.
Yes, tfmcp provides Docker support. See the documentation for instructions on building and running the Docker image.
Configure Claude Desktop with the path to the tfmcp executable and the necessary environment variables.
tfmcp includes access controls, operation restrictions, resource limits, and audit logging to enhance security.
Yes, tfmcp supports Terraform workspaces, allowing you to manage different environments.