Skip to main content

Terraform Cloud

HashiCorp's Terraform MCP server runs on each person's computer. The Official card starts the hashicorp/terraform-mcp-server image in Docker over stdio and turns on Local MCP. It is the Terraform Cloud card with the Official badge. Willow passes the API key as TFE_TOKEN. The server's default address is https://app.terraform.io, HCP Terraform (formerly Terraform Cloud). See Deploy the Terraform MCP server locally and Local MCP.

HashiCorp registers the private registry and HCP Terraform toolsets when TFE_TOKEN is valid. See the Terraform MCP server reference.

Before you start​

On every computer that will use the server:

  • Docker running. HashiCorp requires Docker Engine 20.10.21+ or Docker Desktop 4.14.0+. The card runs hashicorp/terraform-mcp-server.
  • Node.js, so Willow's local client can start with npx. See Local MCP.
  • Network access to https://app.terraform.io, or to the Terraform Enterprise address you set below.

API token​

Create a user token or a team token. The agent can do only what that token can do. Use the narrowest token that covers the work, and the shortest expiration you can. HCP Terraform shows a token once. See API Tokens.

A user token acts as that person. It works in every HCP Terraform organization that account belongs to. To create one, open the user menu, select Account settings, select Tokens, and select Create an API token. Enter a description, choose an expiration, and copy the token. See Create and manage users.

A team token is limited to the workspaces that team can access. Create it under Organization Settings → API Tokens → Team Tokens. In an HCP Europe organization, create a group token on the Group Tokens tab. HCP Europe organizations use https://app.eu.terraform.io or portal.cloud.eu.hashicorp.

An organization token cannot start runs, upload state, or create configuration versions. Run tools fail when the client sends one.

An organization owner can turn off user tokens under Settings → API tokens → User Tokens, with Allow members to access organization resources with their user tokens. When that setting is off, use a team or group token.

Set up Willow​

  1. Go to MCP Servers → + Add MCP server, open the Terraform Cloud card with the Official badge, and click + Use.
  2. Leave Local MCP on. The command is already docker, with arguments run, -i, --rm, -e, TFE_TOKEN, and hashicorp/terraform-mcp-server. Keep TFE_TOKEN as {{apiKey}}.
  3. Under Authentication, keep Personal API keys so each person pastes their own token. Shared API key uses one token for every person. Either way, Willow sets TFE_TOKEN.
  4. Assign groups and Publish.

HashiCorp leaves destructive operations off until ENABLE_TF_OPERATIONS is true. That covers apply and destroy, and deleting a project, a team, or an empty workspace. The card leaves this unset. On the Setup tab, under MCP configuration, add ENABLE_TF_OPERATIONS to env with the value true when you want those operations. See Environment variables.

Another HCP Terraform address​

The server default for TFE_ADDRESS is https://app.terraform.io. Set it when the organization is on another host.

On the Setup tab, under MCP configuration, put -e and TFE_ADDRESS in args before the image name, next to the existing -e TFE_TOKEN, and set TFE_ADDRESS in env. Leave {{apiKey}} on TFE_TOKEN. The token has to come from that same deployment.

  • HCP Europe: https://app.eu.terraform.io
  • Terraform Enterprise: the URL of that deployment. See API Tokens.

Each person​

  1. Confirm Docker is running on that computer.
  2. On the MCP Servers page, open this server and click Use. Copy the STDIO configuration into the AI client. See Local MCP servers.
  3. When Willow asks for a key, paste the HCP Terraform token.

Troubleshooting​

Docker cannot start the container​

Cause: Docker is not running, or it cannot pull hashicorp/terraform-mcp-server.

Solution: Start Docker Engine 20.10.21+ or Docker Desktop 4.14.0+ and try again.

Workspace and private registry tools are missing​

Cause: TFE_TOKEN is missing, expired, or rejected. HashiCorp registers the private registry and Terraform toolsets when the token is valid.

Solution: Paste a current user, team, or group token and connect again.

Run tools fail​

Cause: The token is an organization token, or the user or team cannot plan and apply on that workspace. Organization tokens cannot start runs.

Solution: Use a user or team token that can plan and apply. See API Tokens.

The server reaches the wrong HCP Terraform​

Cause: TFE_ADDRESS is unset, so the server uses https://app.terraform.io. An HCP Europe or Terraform Enterprise token belongs to another address.

Solution: Set TFE_ADDRESS to that deployment's URL and publish again.

Additional Resources​