Skip to content
Hidden Logic Lab

Official Terraform MCP Server 1.4.1 defaults --toolsets to all, so a TFE_TOKEN unlocks write tools such as create_workspace_variable, grant_team_access, and create_run without ENABLE_TF_OPERATIONS; official HTTP examples bind TRANSPORT_HOST=0.0.0.0, which the TLS gate treats as localhost; and MCP_REQUIRE_TOKEN defaults off

Published

The official Terraform MCP Server is a first-party Model Context Protocol server from HashiCorp (now part of IBM) that lets a connected AI client query the public Terraform Registry and, when a Terraform token is available, call HCP Terraform or Terraform Enterprise APIs. The public repository is hashicorp/terraform-mcp-server. The binary name is terraform-mcp-server. The license is Mozilla Public License 2.0. The root LICENSE is the stock MPL-2.0 text. Most source files in this tree carry the header “Copyright IBM Corp. 2025”; some older files, including the Terraform CLI credentials reader, still say “Copyright (c) HashiCorp, Inc.” Official product documentation at research time lived at developer.hashicorp.com/terraform/mcp-server. This review pins the source tree and the Docker tag named in that tree, not the live documentation site, which can move independently of the release.

This is a static review. We cloned git tag v1.4.1, read first-party source and the README in that tree, recorded registry metadata for the official Docker tag, and checked hashes and signature status. We did not run the MCP server, the Docker image, Helm, go install, go test, make targets, or any installer. We did not log into HCP Terraform or Terraform Enterprise, and we used no API token, OAuth token, or Terraform CLI credential. We did not apply, plan, or destroy infrastructure, and we did not send real workspace variables or state. Nothing below is a claim that the server is safe to expose or that a static look is a clean bill of health.

What we pinned

  • Git tag v1.4.1, a lightweight tag pointing at commit 3781509a674482ca7e2821fab8159a25e3b29bdf (v1.4.1 (#599)). The commit date is 24 October 2026, 02:45:41 Asia/Hong_Kong (23 October 2026, 18:45:41 UTC; the commit itself is dated 11:45:41 -0700). The GitHub Release of the same name was published 24 October 2026, 05:25:22 Asia/Hong_Kong (23 October 2026, 21:25:22 UTC). The tag itself is not annotated and carries no tag signature (git cat-file -t v1.4.1 is commit). The pointed-to commit is authored by Shweta-Deshpande and committed by GitHub <noreply@github.com>; after GitHub’s web-flow public keys were present, git verify-commit reported a good signature from GitHub <noreply@github.com> with fingerprint 9684 79A1 AFF9 27E3 7D1A 566B B569 0EEE BB95 2194. That confirms GitHub’s merge signature, not a maintainer-signed annotated tag. version/VERSION in the same tree is 1.4.1.
  • The GitHub Releases API returned no attached source or binary assets for v1.4.1 when we queried it. The release of record for operators in this tree is the OCI image named in server.json: docker.io/hashicorp/terraform-mcp-server:1.4.1. Docker Hub metadata for that tag, read on 30 November 2026 without pulling or running the image, reported tag digest sha256:11dd418bba6003dd5777e9d0979b68de59929a155b355f338f407947e00e9d80, last updated 24 October 2026, 05:27:05 Asia/Hong_Kong (23 October 2026, 21:27:05 UTC). The linux/amd64 image digest in that metadata was sha256:7b21e3a1e2f31eeede11e897e845a35a22ba6516be427947ba9cbb3cb9f02813. The latest and 1.4 tags on Docker Hub reported the same tag digest at that same check. That is a point-in-time observation, not a pin: an unpinned hashicorp/terraform-mcp-server pull can change later, and a registry digest is not proof that the image was built from commit 3781509.
  • SHA-256 hashes we computed on files in the pinned tree include: go.mod 7aa4555a56e906bccd2e3844217806c19a1063cbbd0bb52cccec22f5afb18063, go.sum 4f1cf6a9a5c566bb0df3cf4de46b28631b4a2dc59716dab340a3a949bd8e33bd, server.json e504c2dd9fd22e160398ee171af2322c2a2c35f24f425b78158ec9bd59b115e5, Dockerfile 547c5f29b440261b1a990952611879e595788f4a76a06b6545c29a7da9f44f5c, README.md be2a5f10f99c5482c5a76d021241589da8dc31d0ae85d3e66faede9e9b51f062, LICENSE 1f134ad24145f7d9f3ae1fd45fe10f4fa91f040cf7cb65879efca02fda63b029.
  • The default branch of the repository had been pushed as recently as 30 November 2026, 20:21:55 Asia/Hong_Kong (12:21:55 UTC), which is after v1.4.1. This review does not cover main.

What it is, and the trust boundary

The server is a local or self-hosted Go process. In the default path it speaks MCP over stdio, which is what the official Cursor, VS Code, Claude Desktop, and Gemini extension examples use: they run docker run -i --rm with the HashiCorp image and pass TFE_TOKEN / TFE_ADDRESS as container environment variables. Set TRANSPORT_MODE=streamable-http (or run the streamable-http subcommand) and it instead listens for Streamable HTTP at TRANSPORT_HOST:TRANSPORT_PORT (defaults 127.0.0.1:8080) on path MCP_ENDPOINT (default /mcp). The default implementation is the mark3labs mcp-go server. TF_X_OFFICIAL_SDK_ENABLED=true switches stdio to an experimental official MCP Go SDK path; this review focuses on the default mark3labs path that official install snippets actually start.

There is no local Terraform CLI runner in this tree that shells out to terraform apply on the operator’s machine. The write surface is the HCP Terraform / Terraform Enterprise API, reached with whatever token the process has, at whatever address the server is configured to use. The default address is https://app.terraform.io. In streamable-http mode, a client cannot override TFE_ADDRESS with a header or query parameter: the middleware returns HTTP 403. That is a deliberate fix, recorded in the changelog, against redirecting a bearer token to an attacker-controlled endpoint.

The other side of that boundary is weaker. With no token at all, the public registry tools still run and query the public Terraform Registry. When a token is present, the terraform and registry-private tools use it as the operator. The README’s own security note says the server may expose Terraform data to the MCP client and the model, and tells operators not to use it with untrusted clients or LLMs. That is the right framing: this is a privileged API proxy for an agent, not a sandbox.

Default toolsets are “all”, not “registry”

pkg/cli/commands.go declares the persistent flag as:

rootCmd.PersistentFlags().String("toolsets", toolsets.All, ...)

toolsets.All is the string "all". In pkg/toolsets/filter.go, a filter that contains "all" enables every tool name. getToolsetsFromCmd uses that flag value whenever --tools is not set. Official stdio and Docker examples in the README do not pass --toolsets, so they get every toolset.

The tree also defines a safer keyword. DefaultToolsets() returns only registry, and --toolsets=default expands to that list. A comment in the README’s “Tool Filtering” section even says “default: registry.” That comment describes the default keyword, not the flag’s implicit value. If you start the binary with no tool-filter flags, the code path is "all".

AllTools in pkg/toolsets/registry.go lists 61 tools:

  • 9 public registry tools, which do not need a Terraform token.
  • 4 private-registry tools, which need a token.
  • 43 HCP Terraform / TFE tools that need a token but are not gated by ENABLE_TF_OPERATIONS.
  • 5 tools that additionally require ENABLE_TF_OPERATIONS=true: delete_project, delete_team, delete_workspace_safely, force_unlock_workspace, and action_run.

TFE tools are registered once a session has a valid TFE client. They are not registered if no token can be resolved. Once they are registered, MCP does not support removing them; later sessions rely on a runtime check that the current session still has a client.

ENABLE_TF_OPERATIONS is not a general write gate

ENABLE_TF_OPERATIONS defaults to false. server.json, the Gemini extension manifest, Helm values, and the README all describe it as the switch for tools that need explicit approval. In this tree, that switch only hides the five RequiresTFOps tools.

The 43 remaining TFE tools stay available as soon as a token is present. That list includes tools that change organization state or credentials in the workspace, among them:

  • create_project, create_workspace, create_no_code_workspace, update_workspace
  • create_team, add_team_member, grant_team_access (workspace access levels in the tool description include admin, write, and plan)
  • create_workspace_variable and update_workspace_variable, including a sensitive flag
  • create_variable_set, create_variable_in_variable_set, delete_variable_in_variable_set, and attach/detach of variable sets to workspaces
  • attach_policy_set_to_workspaces
  • create_run
  • list_state_versions and get_state_version
  • whoami and get_token_permissions

create_run is the one “special case” called out in the registry. In the default mark3labs path, specialFactories selects CreateRunSafe when ENABLE_TF_OPERATIONS is not true, and CreateRun when it is. The safe variant still creates a real run. Its run_type enum is plan_and_apply (the default), refresh_state, plan_only, and allow_empty_apply. For plan_and_apply the handler sets AutoApply to false on that run. The unsafe variant adds auto_approve (sets AutoApply to true) and is_destroy. Applying, discarding, or canceling an existing run is action_run, and that tool is gated. Creating the run is not.

We did not execute these tools, so we cannot demonstrate a live workspace change from this review. The registration table and the handlers are in the pinned source. An operator who expects “operations stay off until I set ENABLE_TF_OPERATIONS” will still have given the agent a path to create workspaces, grant team access, write variables (including ones marked sensitive), attach variable sets, and open runs, limited only by what the token itself can do.

Tokens: env, client headers, and Terraform CLI credentials

Token resolution, in CreateTfeClientForSession, is: request context, then the TFE_TOKEN environment variable, then a fallback read of the Terraform CLI credentials file. On Unix that file is $HOME/.terraform.d/credentials.tfrc.json; on Windows it is %APPDATA%\terraform.d\credentials.tfrc.json. If the env var is empty and that file has an entry for the configured hostname (default app.terraform.io), the server uses that token and logs that it did so. Official Docker examples do not mount the host Terraform config directory, so this fallback matters most for a binary installed with go install or otherwise running as the user. The official “Install from source” snippet in the README is go install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@latest, which is unpinned, followed by terraform-mcp-server stdio.

In streamable-http mode, TerraformContextMiddleware still accepts a per-request Authorization: Bearer token or a TFE_TOKEN header. A token in a query parameter is rejected with HTTP 400. The bearer token takes precedence over a TFE_TOKEN header when an organization allowlist is in use, so the token that was allowlisted is the token used upstream. The same middleware also accepts a client-supplied TFE_SKIP_TLS_VERIFY header or query value and can turn off TLS verification for the server’s outbound TFE connection. TFE_SKIP_TLS_VERIFY defaults to false when unset.

MCP_REQUIRE_TOKEN is the switch that would refuse streamable-http requests without an Authorization bearer token, and would check that token against HCP Terraform by listing organizations. It was added in 1.4.0. It defaults off: utils.GetEnv("MCP_REQUIRE_TOKEN", "") == "true" is the only way it becomes active; any other value, including unset, leaves the middleware as a no-op. The README environment-variable table in this tag does not document MCP_REQUIRE_TOKEN. The official Helm chart’s deployment template does not set it either.

The practical result for a streamable-http process that has a server-side TFE_TOKEN (or that can read credentials.tfrc.json) and that does not set MCP_REQUIRE_TOKEN=true or an organization allowlist is: any client that can reach /mcp can invoke tools with that server token. CORS is not that control. The default CORS mode is strict, but a request with no Origin header is passed through, which is the case for ordinary curl and for most non-browser MCP clients.

Official HTTP examples bind 0.0.0.0, and the TLS gate treats that as localhost

The process default for TRANSPORT_HOST is 127.0.0.1. TLS (MCP_TLS_CERT_FILE / MCP_TLS_KEY_FILE) is required when the bind address is not considered local; otherwise the HTTP server logs that TLS is disabled and is not recommended for production, and it listens in cleartext.

IsLocalHost in pkg/client/tls.go returns true for localhost, 127.0.0.1, ::1, [::1], and 0.0.0.0. Binding 0.0.0.0 therefore skips the TLS requirement. That is the address official docs tell Docker users to set so the port is reachable from outside the container.

The README’s Claude Code streamable-http example is:

docker run -p 8080:8080 --rm -e TRANSPORT_MODE=streamable-http -e TRANSPORT_HOST=0.0.0.0 hashicorp/terraform-mcp-server

That command is unpinned, publishes container port 8080 on all host interfaces, binds the server to every interface inside the container, does not enable TLS, and does not set MCP_REQUIRE_TOKEN. The same section then says to add TFE_TOKEN to the Docker command for authenticated TFE tools. Doing both — following the published HTTP example and then adding a token — puts a token-backed MCP endpoint on 0.0.0.0:8080 with no bearer requirement and no TLS.

The Codex example uses -p 127.0.0.1:8080:8080, which is tighter on the host side, but it still uses an unpinned image and TRANSPORT_HOST=0.0.0.0. VS Code “Install in VS Code (docker)” badges and the Cursor deeplink in this README also use unpinned hashicorp/terraform-mcp-server with no tag. Several other client snippets in the same README correctly pin :1.4.1. The Helm chart always starts streamable-http --transport-host=0.0.0.0, defaults TLS paths to empty, and does not template MCP_REQUIRE_TOKEN or TFE_TOKEN.

State, identity, and other data the tools can return

whoami calls Users.ReadCurrent and returns JSON with username, email, and is_service_account. get_token_permissions reports the token’s organization permissions. list_workspace_variables marshals the variable list returned by the TFE API. We did not call that API, so we do not claim which secret values, if any, appear in the payload; HCP Terraform commonly redacts values marked sensitive, and non-sensitive values are still data. The create and update variable tools accept a sensitive flag and will write whatever value the model supplies.

get_state_version reads a state version by id, or the current version for a workspace id, and marshals the tfe.StateVersion object with jsonapi.MarshalPayloadWithoutIncluded. The tool does not itself download the raw state file. The in-tree integration test obtains a raw state file by calling StateVersions.Download with stateVersion.DownloadURL from that API object. Operators should treat the metadata this tool returns as potentially containing a download URL for state, which often includes secrets, rather than as a harmless identifier list. We did not retrieve state in this review.

Plan and apply log tools and get_sentinel_mock can return run output and mock data (the sentinel mock tool base64-encodes the file). Those are still contents from the Terraform organization, not public registry docs.

Malware check, and its limits

In the v1.4.1 tree we read, we did not find obfuscated payloads, unexpected reverse-shell code, or a hidden third-party command-and-control endpoint. Outbound HTTP in first-party code goes to the configured TFE address, the public Terraform Registry, optional OpenTelemetry or Instana endpoints when those features are enabled, and, for some MCP resources, a fixed URL under https://raw.githubusercontent.com/hashicorp/web-unified-docs/main/content/terraform/v1.12.x/docs/language. That last path is main, not the v1.4.1 tag of this repository; we did not fetch or review whatever that URL returned on the day of this article.

The release Dockerfile builds into scratch, copies only the binary and CA certificates, and runs as USER 65532:65532. Dev image bases are digest-pinned in the Dockerfile (alpine:3.22 and golang:1.26.10-alpine). go.mod at this tag uses Go 1.26.10 and names first-party HashiCorp libraries plus MCP, Cobra, Viper, Logrus, OpenTelemetry, and Instana. We did not vendor-audit every module, run go vet, or compare the published image filesystem to this commit. A static read of one tag is not a substitute for running a scanner, watching the process, or pinning and verifying the image you actually execute.

The 1.4.1 changelog itself records recent hardening that matters if you are still on an older tag: tool-call logs no longer include argument values; stateless HTTP no longer keys leftover session state from a client-supplied Mcp-Session-Id; and X-Forwarded-For parsing was corrected so a client-supplied leftmost address is not trusted by default. Those are improvements in this pin, not a reason to skip the default-install issues above.

Who this is for

This server is for people who already trust an MCP client and a model with some level of Terraform Registry or HCP Terraform / Terraform Enterprise access, and who are willing to review every tool call before it hits a workspace that matters. It is a poor default for a shared or networked MCP endpoint, for an unattended agent with a broad organization token, or for anyone who assumed ENABLE_TF_OPERATIONS=false meant “read-only.” If you only want provider and module documentation, you do not need a TFE token, and you should pass --toolsets=registry (or --toolsets=default) instead of relying on the flag’s implicit all.

Safer pin and review steps, and their limits

These steps are written from the source we read. We did not run them end to end in this review.

  1. Pin a release. Prefer the image digest, not a moving tag: hashicorp/terraform-mcp-server:1.4.1@sha256:11dd418bba6003dd5777e9d0979b68de59929a155b355f338f407947e00e9d80 was the Docker Hub tag digest we saw on 30 November 2026. Re-check it before you rely on it. Avoid go install ...@latest and unpinned docker run hashicorp/terraform-mcp-server snippets, including the Claude Code HTTP example and the VS Code / Cursor install badges in this README.
  2. If you only need the public registry, start with --toolsets=registry and do not set TFE_TOKEN. Do not assume “I omitted --toolsets” means registry-only.
  3. If you need TFE tools, use a least-privilege token, not a user token that can administer teams and variable sets. Prefer --toolsets=registry,terraform or an explicit --tools list, and keep ENABLE_TF_OPERATIONS false unless you really want action_run apply and the gated deletes. Understand that write tools such as create_run, grant_team_access, and create_workspace_variable will still be registered.
  4. For streamable-http, bind 127.0.0.1 unless you intend to serve the network. Do not treat TRANSPORT_HOST=0.0.0.0 as a localhost bind. Publish the host port as 127.0.0.1:8080:8080 if you must use Docker. Set MCP_REQUIRE_TOKEN=true, put TLS on any path that leaves the machine, and set MCP_ORGANIZATION_ALLOWLIST to the organizations you actually mean to allow. Do not put a long-lived organization token in the server environment of a shared listener if clients can reach it without a token of their own.
  5. Do not run the binary as your logged-in Terraform user if you do not want it to read ~/.terraform.d/credentials.tfrc.json.
  6. Review tool results the same way you would review a TFE API response: whoami includes an email address; state-version metadata may include a download URL; variable lists and plan logs can carry workspace data. The README already tells you not to hook this server to an untrusted model.

These steps do not make the server a security boundary. HashiCorp does not present ENABLE_TF_OPERATIONS as a sandbox, and the source does not implement one. A client that can call tools can still do whatever the token can do, including the write tools that are registered by default.

What we did not do

We did not run the server or the image, so we did not confirm runtime behavior, default tool lists as advertised to a live MCP client, or how a particular MCP host displays confirmation prompts. We did not verify that CreateRunSafe’s AutoApply=false overrides a workspace-level auto-apply setting in the TFE API; we only recorded what the handler sends. We did not review HashiCorp-hosted MCP infrastructure, if any, beyond what this repository implements for a self-hosted or local process. We cannot prove that docker.io/hashicorp/terraform-mcp-server:1.4.1 was built from commit 3781509. We did not enter credentials, and we did not exercise apply, destroy, or variable writes.

If you need a runtime verdict, run a pinned binary or image in an isolated account, with a throwaway token and no production workspaces, and treat every tool result as untrusted data. This article is a static reading of v1.4.1, not that test.

More skill reviews

← All skill reviews