# Terraform

> Terraform is an MCP server for cloud and infrastructure. HashiCorp's server for Terraform Registry lookups and HCP Terraform workspaces. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI, self-hosted
- **Repository:** https://github.com/hashicorp/terraform-mcp-server
- **MCP Registry name:** io.github.hashicorp/terraform-mcp-server
- **Categories:** [cloud and infrastructure](https://ai-powered.com/categories/cloud-and-infrastructure), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-18

## About

This server gives an assistant current Terraform knowledge instead of leaning on stale training data: it talks to the public Terraform Registry for providers, modules and policies, and to HCP Terraform or Terraform Enterprise for private registry access, organisations, projects and workspaces. Workspace tools can create, update and delete workspaces, with variables, tags and runs.

It can run over stdio in a container or as a streamable-HTTP service. The HTTP mode has stateful or stateless sessions, strict CORS by default, optional TLS, global and per-session rate limits, an organisation allowlist, client IP forwarding, and OpenTelemetry metrics for tool-call volume, latency and failures. Tools that need explicit approval are off unless ENABLE_TF_OPERATIONS is set, and the Terraform address can only be set through environment configuration in HTTP mode.

The README adds warnings that matter: do not use it with untrusted clients or models, output is generated dynamically and must be reviewed against your security and cost rules, and IBM disclaims responsibility for third-party clients.

## Features

- **Registry integration:** Looks up providers, modules and policies in the public registry.
- **HCP Terraform support:** Lists organisations and projects and manages workspaces.
- **Workspace operations:** Create, update and delete workspaces with variables, tags and runs.
- **Two transports:** stdio or streamable HTTP with configurable endpoint.
- **Guardrails:** Approval-gated tools are off unless enabled.
- **HTTP hardening:** CORS modes, TLS, rate limits and organisation allowlist.
- **OpenTelemetry metrics:** Tracks tool-call volume, latency and failures.

## Good for

- Writing Terraform with up-to-date provider documentation
- Finding a module in the public or private registry
- Managing HCP Terraform workspaces from chat
- Running a shared MCP deployment with limits and metrics

## Install

### Claude Code (Terminal)

```sh
claude mcp add terraform-mcp-server -- docker run -i --rm docker.io/hashicorp/terraform-mcp-server:1.4.1
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "terraform-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/hashicorp/terraform-mcp-server:1.4.1"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## FAQ

### Do I need an HCP Terraform token?

Only for HCP Terraform or Enterprise features, set with TFE_TOKEN.

### How is it run?

As a Docker image over stdio, or in streamable-HTTP mode.

### Is it safe with any client?

The README says not to use it with untrusted MCP clients or LLMs.

### Can it change infrastructure?

Operations that need approval are disabled unless ENABLE_TF_OPERATIONS is set.

### How do I add Terraform to Claude Code?

Run this command in your terminal: claude mcp add terraform-mcp-server -- docker run -i --rm docker.io/hashicorp/terraform-mcp-server:1.4.1

### What are the best alternatives to Terraform?

The closest alternatives to Terraform are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/terraform
