MCP Directory

How to add Terraform MCP Server to Cursor

HashiCorp's official server for Terraform Registry providers, modules, and IaC workflows. Paste the config into ~/.cursor/mcp.json and restart Cursor.

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

Cursor 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 Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
  2. 2Paste the Terraform MCP Server config below into the "mcpServers" object.
  3. 3Fill in placeholder secrets, then save.
  4. 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
  5. 5Ask Cursor to use one of Terraform MCP Server's tools to confirm it's connected.

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 Cursor

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 + Cursor FAQ

Where is the Cursor config file?

Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the Terraform MCP Server config there under the "mcpServers" key and restart the client.

Is Terraform MCP Server safe to use with Cursor?

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