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:

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:

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.

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:

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:

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:

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.

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.

Sources (opened 2026-11-12, at the v1.4.1 tag unless noted)