# HashiCorp Terraform (MCP Server)

> Search the Terraform Registry and manage HCP Terraform workspaces

- Type: MCP server
- Publisher: HashiCorp (official)
- Categories: DevOps & Cloud, Development
- Website: https://github.com/hashicorp/terraform-mcp-server
- Docs: https://developer.hashicorp.com/terraform/docs/tools/mcp-server/reference
- Source: https://github.com/hashicorp/terraform-mcp-server
- Transport: stdio
- Launch command: docker run -i --rm -e TFE_TOKEN -e TFE_ADDRESS hashicorp/terraform-mcp-server
- Sign-in: api-key
- Environment variables: TFE_TOKEN, TFE_ADDRESS
- GitHub stars: 1500
- Listed: 2025-05-20

## About

HashiCorp's official Terraform MCP server integrates with the public Terraform Registry and HCP Terraform/Terraform Enterprise APIs. Agents can look up providers, modules and policies, and manage organizations, workspaces, runs and variables. It runs via Docker over stdio or Streamable HTTP.

## Install

1. **Add the server to Codex**

   Codex CLI:

   ```bash
   codex mcp add terraform --env TFE_TOKEN=YOUR_TFE_TOKEN --env TFE_ADDRESS=YOUR_TFE_ADDRESS -- docker run -i --rm -e TFE_TOKEN -e TFE_ADDRESS hashicorp/terraform-mcp-server
   ```

   config.toml:

   ```toml
   [mcp_servers.terraform]
   command = "docker"
   args = ["run", "-i", "--rm", "-e", "TFE_TOKEN", "-e", "TFE_ADDRESS", "hashicorp/terraform-mcp-server"]
   
   [mcp_servers.terraform.env]
   TFE_TOKEN = "YOUR_TFE_TOKEN"
   TFE_ADDRESS = "YOUR_TFE_ADDRESS"
   ```

   Agents SDK:

   ```python
   from agents import Agent, Runner
   from agents.mcp import MCPServerStdio
   
   async with MCPServerStdio(
       name="HashiCorp Terraform",
       params={"command": "docker", "args": ["run", "-i", "--rm", "-e", "TFE_TOKEN", "-e", "TFE_ADDRESS", "hashicorp/terraform-mcp-server"]},
   ) as server:
       agent = Agent(name="Assistant", mcp_servers=[server])
       result = await Runner.run(agent, "What's the latest version of the AWS provider?")
       print(result.final_output)
   ```

## Tools

- `search_providers`
- `get_provider_details`
- `get_provider_capabilities`
- `get_latest_provider_version`
- `search_modules`
- `get_module_details`
- `get_latest_module_version`
- `search_policies`
- `get_policy_details`
- `list_terraform_orgs`
- `list_terraform_projects`
- `list_workspaces`

## Example prompts

- "What's the latest version of the AWS provider?"
- "Find a Terraform module for an EKS cluster"
- "Show the arguments for the google_compute_instance resource"
- "List workspaces in my HCP Terraform organization"

## Related

- [Chrome DevTools MCP](https://chatgptplugins.directory/mcp/chrome-devtools.md): Let coding agents control and debug a live Chrome browser
- [Playwright MCP](https://chatgptplugins.directory/mcp/playwright.md): Browser automation for agents via Playwright accessibility snapshots
- [GitHub](https://chatgptplugins.directory/mcp/github.md): Manage repos, issues, pull requests and Actions from your AI agent
- [Context7](https://chatgptplugins.directory/mcp/context7.md): Pull up-to-date, version-specific library docs into your coding agent
- [Supabase](https://chatgptplugins.directory/mcp/supabase.md): Manage Supabase databases, migrations, edge functions and logs
- [Stripe](https://chatgptplugins.directory/mcp/stripe.md): Query and act on your Stripe account and search Stripe docs from any agent

---
Source: https://chatgptplugins.directory/mcp/terraform · Index: https://chatgptplugins.directory/llms.txt · Independent and community-run. Not affiliated with or endorsed by OpenAI. ChatGPT is a trademark of OpenAI.
