Connections & Capabilities
Connects To
Capabilities
Quickstart
Install
cargo install tfmcpConfig
{
"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
}
}
}
}Exposed MCP Tools (12)
init_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.
Safety Assessment
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.
- Dangerous operations like apply/destroy are disabled by default.
- Includes audit logging for tracking all operations.
- Offers configurable resource limits to prevent over-provisioning.
- Provides built-in protection against accessing sensitive file patterns.
- Supports directory validation to enforce security policies.
- Enables write operations, potentially leading to infrastructure changes.
- Requires careful configuration to prevent unintended resource modifications.
- Relies on environment variables for security settings, which can be misconfigured.
- Access to Terraform state allows for potential data exposure if not properly secured.
- If `TFMCP_ALLOW_DANGEROUS_OPS` is enabled, destructive actions are possible.
