MCP Directory

How to add Terraform MCP Server to Windsurf

HashiCorp's official server for Terraform Registry providers, modules, and IaC workflows. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.

Last updated June 15, 2026 · 1.4k · stdio · no auth · official

Windsurf config for Terraform MCP Server

docker run -i --rm hashicorp/terraform-mcp-server
{
  "mcpServers": {
    "terraform-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ]
    }
  }
}

Requires Docker to be installed and running.

Setup steps

  1. 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
  2. 2Paste the Terraform MCP Server config below.
  3. 3Fill in placeholder secrets, then save.
  4. 4Click Refresh in the MCP panel.
  5. 5Terraform MCP Server's tools become available to Cascade.

Before you start

  • An MCP-compatible client (Claude, Cursor, VS Code Copilot, etc.)
  • Docker running, OR Go installed to build/install from source (`go install github.com/hashicorp/terraform-mcp-server/cmd/terraform-mcp-server@latest`)
  • Public Registry tools need no credentials
  • For private modules/providers and workspace tools: an HCP Terraform / Terraform Enterprise API token set as TFE_TOKEN (and TFE_ADDRESS for self-hosted TFE), created under your HCP Terraform user or team API tokens settings

What Terraform MCP Server can do in Windsurf

search_providers

Search the Terraform Registry for providers

get_provider_details

Get documentation and details for a provider

get_latest_provider_version

Resolve the latest published version of a provider

search_modules

Search the Registry for reusable modules

get_module_details

Get inputs, outputs, and docs for a module

search_policies

Search Sentinel/policy libraries in the Registry

list_workspaces

List HCP Terraform / TFE workspaces (requires token)

get_workspace_details

Inspect a specific workspace's configuration

Security

In default mode it only reads the public Terraform Registry, so risk is low; adding a TFE_TOKEN grants access to your Terraform Cloud/Enterprise org and should be scoped accordingly. Pin a specific image tag rather than latest for reproducible behavior.

Terraform MCP Server + Windsurf FAQ

Where is the Windsurf config file?

Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the Terraform MCP Server config there under the "mcpServers" key and restart the client.

Is Terraform MCP Server safe to use with Windsurf?

In default mode it only reads the public Terraform Registry, so risk is low; adding a TFE_TOKEN grants access to your Terraform Cloud/Enterprise org and should be scoped accordingly. Pin a specific image tag rather than latest for reproducible behavior.

Do I need a Terraform Cloud token to use it?

No for public Registry lookups (search/get providers, modules, policies). Yes for the `terraform` and `registry-private` toolsets, which talk to HCP Terraform / Terraform Enterprise and require TFE_TOKEN.

Is it free?

The server is open source under MPL-2.0 and free to run. Registry access is free; workspace operations are governed by your HCP Terraform / Terraform Enterprise plan.

Can I run it remotely instead of stdio?

Yes. Set TRANSPORT_MODE=streamable-http to serve over HTTP (with optional TLS via MCP_TLS_CERT_FILE/MCP_TLS_KEY_FILE) for centralized deployments.

View repo Full Terraform MCP Server page