What Is Terraform MCP Server?
Terraform MCP Server connects Claude Code to the Terraform Registry, enabling you to query provider documentation, discover modules, and generate HCL without leaving your editor. It is maintained by HashiCorp and published under the @hashicorp/terraform-mcp-server package.
Quick Facts
| Field | Value |
|---|---|
| Package | @hashicorp/terraform-mcp-server |
| Install | npx @hashicorp/terraform-mcp-server |
| Compatible with | Claude Code |
| Status | active |
| GitHub | https://github.com/hashicorp/terraform-mcp-server |
What You Can Do With It
- Provider docs: Look up resource arguments, attributes, and provider-specific configuration options directly from the Terraform Registry.
- Module discovery: Search and inspect community and verified modules without switching to a browser.
- HCL generation: Ask Claude to produce Terraform configuration blocks grounded in current registry documentation rather than training data alone.
- Resource reference: Retrieve schema details for specific resources (e.g.,
aws_s3_bucketargument reference) on demand during a session.
How to Set It Up
Prerequisites: Node.js 18 or later installed and accessible on your PATH.
1. Test the server runs locally
npx @hashicorp/terraform-mcp-server
If it prints a startup message without errors, you are ready to configure Claude Code.
**2. Add the server to Claude Code**
Edit your Claude Code MCP configuration file. For most setups this is `.claude/mcp.json` in your project root, or the global `~/.claude/mcp.json`:
```json
{
"mcpServers": {
"terraform": {
"command": "npx",
"args": ["@hashicorp/terraform-mcp-server"]
}
}
}
3. Restart Claude Code
Close and reopen Claude Code (or reload the window in VS Code) so it picks up the new server entry. You should see terraform listed under active MCP servers in the Claude Code status panel.
4. Verify the connection
In a Claude Code session, ask something like:
“Show me the arguments for the
azurerm_virtual_networkresource.”
Claude should return schema information sourced from the Terraform Registry rather than a generic answer.
Works Best With
This server is documented for use with Claude Code. Because it uses the standard MCP stdio transport via npx, it should also work with any MCP client that supports stdio-based servers and allows custom command entries, but Claude Code is the only explicitly listed compatible client.
Known Limitations
- No authentication support documented: The server queries the public Terraform Registry API. Private registry instances (Terraform Enterprise or HCP Terraform private modules) are not mentioned as supported targets.
- Rate limits: The Terraform Registry enforces API rate limits on unauthenticated requests. Heavy use in a single session may result in throttled responses; the server does not expose a way to pass authentication tokens based on current documentation.
- Registry data freshness: Results reflect what the public registry returns at query time. Very recently published provider versions may lag depending on registry indexing.
- No plan or apply execution: This server is read-only against the registry. It does not connect to Terraform state, run
terraform plan, or interact with any cloud provider directly. - Node.js dependency:
npxpulls the package on first run if not cached. In air-gapped or restricted environments, pre-install vianpm install -g @hashicorp/terraform-mcp-serverinstead.
Community Resources
- GitHub Issues: https://github.com/hashicorp/terraform-mcp-server/issues — report bugs or check known problems before opening a new issue.
- HashiCorp Discuss: https://discuss.hashicorp.com — search for
terraform-mcp-serverfor community Q&A and announcements. - r/Terraform: https://www.reddit.com/r/Terraform/ — general Terraform discussion where MCP integration topics occasionally surface.



