Terraform MCP server: how to limit what it can touch
This page covers terraform-mcp-server v1.4.1, released October 23, 2026.
The short answer
You limit the Terraform MCP server in three layers. You pick which groups of tools it turns on, which single tools it turns on, and what its API token is allowed to do. By default only public registry lookups are on.
A separate setting keeps five delete, unlock, and run action tools off. Once the HCP Terraform tools are on, other tools that create or change things, such as starting a run, are not behind that setting. The token's own permissions are the outer limit.
What the Terraform MCP server can do
Terraform is a tool that builds and changes cloud infrastructure from text files. HCP Terraform and Terraform Enterprise are HashiCorp's hosted and self-hosted services that run Terraform for a team. An MCP server is a small program that lets an AI assistant use a tool, here Terraform. HashiCorp publishes this one as hashicorp/terraform-mcp-server. OpsMCP lists it at /servers/hashicorp-terraform-mcp-server.
Its tools come in three groups:
- Public Terraform Registry lookups for providers, modules, and policies.
- Private registry lookups in your HCP Terraform or Terraform Enterprise organization.
- HCP Terraform and Terraform Enterprise actions. These cover organizations, projects, teams, workspaces, runs, plans, applies, variables, variable sets, tags, policy sets, Stacks, and state versions.
A workspace, in HCP Terraform, is one set of infrastructure and its settings. Only the public registry group is on unless you change it.
The README carries a warning in its own words: "Do not use the MCP server with untrusted MCP clients or LLMs."
Turn on only the toolsets you need (--toolsets)
A toolset is a named group of tools that you switch on or off together. The --toolsets flag takes one or more of these values:
registryis the public registry group. This is the default.registry-privateis the private registry group.terraformis the HCP Terraform and Terraform Enterprise group.allturns on every group.defaultstands for the default set, which isregistry.
For registry lookups only, you need no flag at all. To add the HCP Terraform tools, the README shows:
terraform-mcp-server --toolsets=registry,terraform The terraform toolset is one group. Turning it on gives the assistant the read tools and the create and change tools in that group together. To get workspace reads without the change tools, list single tools instead, as in the next section.
The flag works in both ways of running the server: stdio, the default local process, and streamable-http, the network mode. We found no environment variable that sets toolsets in the README, so use the flag.
Pick single tools instead (--tools)
The --tools flag turns on only the tools you name. The README example:
terraform-mcp-server --tools=search_provider_docs,get_provider_details,list_workspaces You cannot use --tools and --toolsets together. Pick one.
Use --tools when you want the assistant to read HCP Terraform but not change it. For example, you could name list_workspaces, get_workspace_details, list_runs, and get_run_details, and leave out every tool in the change list in the next section. The README points to pkg/toolsets/mapping.go in the repo for the full list of tool names.
If you upgraded from a version before 1.4.0, check your list. Version 1.4.0 renamed search_providers to search_provider_docs, and any list that uses the old name needs the new one.
Vet MCP servers with a one-page checklist
The free checklist turns the OpsMCP grading rules into checks you can run yourself. It comes with OpsMCP Weekly, one email each Tuesday.
One email a week. You can unsubscribe from any issue, and we never sell your address.
What ENABLE_TF_OPERATIONS does and does not cover
The README describes ENABLE_TF_OPERATIONS as the setting to "Enable tools that require explicit approval." It is false by default.
In the v1.4.1 code, these five tools stay off unless it is true:
delete_projectdelete_teamdelete_workspace_safelyforce_unlock_workspaceaction_run
The setting also changes create_run. That tool is on whenever the terraform toolset is on, and it can start a run either way. With the setting off, the code offers a version of create_run without the auto_approve and is_destroy run types. With the setting on, it offers the version with those two types.
Many tools that create or change things are not behind this setting. Once the terraform toolset is on, these are available with ENABLE_TF_OPERATIONS left at false:
create_runcreate_workspace,create_no_code_workspace, andupdate_workspacecreate_projectandcreate_teamadd_team_memberandgrant_team_accesscreate_workspace_variableandupdate_workspace_variablecreate_variable_set,create_variable_in_variable_set, anddelete_variable_in_variable_setattach_variable_set_to_workspacesanddetach_variable_set_from_workspacescreate_workspace_tagsandattach_policy_set_to_workspaces
To keep the assistant from changing anything in HCP Terraform, leave the terraform toolset off, or list only read tools with --tools. Then narrow the token, as the next section explains.
Check what the token can do (get_token_permissions and whoami)
An API token is a long secret string the server uses to log in to HCP Terraform. The server can never do more than its token allows.
Two tools in the terraform toolset tell you what you are working with. get_token_permissions was added in 0.4.0 to list the permissions of the current token. whoami, added in 1.3.0, returns the identity behind the token. The changelog says it reports the username, email, and whether the token is a team or organization token or belongs to a real person.
Run both before you give the assistant real work. If the token can do more than you want, change it in HCP Terraform.
HashiCorp's API tokens docs describe how the token types differ:
- A user token inherits the permissions of the user it belongs to. HashiCorp calls it "the most flexible token type."
- A team token has the same access as the team has to its workspaces.
- A token made for the "owners" team has all the permissions of an organization owner.
OpsMCP's advice is to give the server a token whose permissions cover only what you want the assistant to do. A team token for a team with access to only the workspaces you name is one way to do that. A token from the owners team, or from a user with wide access, gives the assistant that same wide access.
The token is set in TFE_TOKEN, which is empty by default. TFE_ADDRESS sets the HCP Terraform or Terraform Enterprise address, and it must include the protocol, such as https://.
Extra limits when running over HTTP
These settings apply when you run the server in streamable-http mode, usually as a shared server for a team.
MCP_ORGANIZATION_ALLOWLIST, or the--organization-allowlistflag, takes a list of HCP Terraform organization names. The server then requires a bearer token and rejects requests unless that token can reach at least one listed organization.MCP_REQUIRE_TOKEN, added in 1.4.0, makes the server reject requests that have no bearer token. It is off by default, so registry lookups work without a token unless you turn it on.MCP_ALLOWED_ORIGINSlimits which web origins can connect.MCP_CORS_MODEdefaults tostrict.- Rate limits are on by default, set with
MCP_RATE_LIMIT_GLOBALandMCP_RATE_LIMIT_SESSION. - Clients cannot set
TFE_ADDRESS. The server takes it only from its own environment and rejects those requests with a 403. - The server rejects tokens sent in the URL query with a 400.
TF_MCP_SHARED_SECRETsends a fixed secret as a header on every request to HCP Terraform or Terraform Enterprise, so the backend can recognize a known hosted server. The README says to use it only over TLS (an encrypted connection) and treat the value as a credential.
The README also says to use TLS, set with MCP_TLS_CERT_FILE and MCP_TLS_KEY_FILE, when you run the server for a team.
Which version this covers
Checked against v1.4.1, released 2026-10-23. Settings and tool names change between releases, so confirm the version you run with our guide on checking which version of an MCP server you are running.
The README offers these ways to install: the Docker image hashicorp/terraform-mcp-server (its examples pin 1.4.1), go install, and a Helm chart under helm/terraform-mcp-server in the repo. No prebuilt binary is attached to the v1.4.1 release.
How OpsMCP scores servers is on /methodology/. More Terraform servers are on /systems/terraform.
Frequently asked questions
Can the Terraform MCP server delete my workspaces?
Only if you turn on the terraform toolset and set ENABLE_TF_OPERATIONS to true, which turns on delete_workspace_safely. Your token must also allow it. Other change tools, such as create_run and update_workspace, are on whenever the terraform toolset is on.
Which toolsets does the Terraform MCP server turn on by default?
Only registry, which covers public Terraform Registry lookups. The private registry and HCP Terraform tools stay off until you add them with --toolsets or name them with --tools.
What is the difference between --toolsets and --tools?
--toolsets turns on whole groups of tools. --tools turns on only the tools you name. You cannot use both at once.
How do I see what my Terraform API token is allowed to do?
Turn on the terraform toolset and run get_token_permissions, which lists the current token's permissions. whoami shows who the token belongs to. Then adjust the token or its team in HCP Terraform.
Does the Terraform MCP server work with Terraform Enterprise?
Yes. Set TFE_ADDRESS to your Terraform Enterprise address, including https://, and set TFE_TOKEN to a token from that instance.
Does the Terraform MCP server have any security advisories?
None published as of 2026-11-12. You can check the current list on the repo's security advisories page.
Get the MCP server security checklist
OpsMCP Weekly is one email each Tuesday with score changes and new security advisories for the IT MCP servers OpsMCP grades. Sign up, confirm your address, and the free one-page checklist is yours.
One email a week. You can unsubscribe from any issue, and we never sell your address.
Sources (opened 2026-11-12, at the v1.4.1 tag unless noted)
- README at v1.4.1: https://github.com/hashicorp/terraform-mcp-server/blob/v1.4.1/README.md
- CHANGELOG at v1.4.1: https://github.com/hashicorp/terraform-mcp-server/blob/v1.4.1/CHANGELOG.md
- Tool list and gates: https://github.com/hashicorp/terraform-mcp-server/blob/v1.4.1/pkg/toolsets/registry.go
- Toolset names and default: https://github.com/hashicorp/terraform-mcp-server/blob/v1.4.1/pkg/toolsets/toolsets.go
create_runswitch: https://github.com/hashicorp/terraform-mcp-server/blob/v1.4.1/pkg/tools/factories.go and https://github.com/hashicorp/terraform-mcp-server/blob/v1.4.1/pkg/tools/tfe/create_run.go- Releases: https://github.com/hashicorp/terraform-mcp-server/releases
- v0.4.0 release: https://github.com/hashicorp/terraform-mcp-server/releases/tag/v0.4.0
- Advisories: https://github.com/hashicorp/terraform-mcp-server/security/advisories
- HashiCorp API tokens docs: https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/api-tokens