Get the FREE Ultimate OpenClaw Setup Guide →

terraform

MCP server from DCamonier1980/terraform-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio dcamonier1980-terraform-mcp-server docker run -i --rm hashicorp/terraform-mcp-server

How to use

The Terraform MCP Server provides automated access to Terraform Registry data via the Model Context Protocol. It exposes toolsets that let you discover providers, resources, data sources, functions, and modules, and to fetch full documentation or detailed module information. Using the server, you can query the Terraform Registry for provider docs, search for Terraform modules, and retrieve module inputs, outputs, and configuration examples. This enables you to reason about IaC patterns, compare providers, and extract actionable details for automation scripts or design reviews. The available toolsets include: providers (resolveProviderDocID and getProviderDocs) for provider and resource documentation, and modules (searchModules and moduleDetails) for module discovery and in-depth module information.

How to install

Prerequisites

  • Docker installed and running on your machine
  • Optional: Git if you plan to pull sources locally
  1. Install Docker
  1. Run the Terraform MCP Server with Docker
  • You can start the server using the provided Docker image as shown in the README examples.
  • Basic run (auto-pulls the image if not present):
# Run the Terraform MCP Server using Docker
docker run -i --rm hashicorp/terraform-mcp-server
  1. Verify the server is accessible
  • The MCP framework typically communicates over standard IO or a configured port. If your environment requires explicit port exposure, modify the docker run command to forward the port (for example, -p 8080:8080) and reference the exposed port in your MCP client configuration.
  1. Alternative installation (build from source)
  • If you prefer building locally, follow the project’s build instructions (not shown in this README). Typically this involves cloning the repository and using make build, then pointing the MCP client to the built binary.
  1. Ensure access in VS Code or Claude Desktop
  • Use the provided JSON configuration blocks in your VS Code user settings or Claude Desktop to connect to the running container image as shown in the examples.

Additional notes

Notes and tips:

  • The Terraform MCP Server relies on the Terraform Registry for provider/module data. Ensure network access to registry endpoints is available from the host running Docker.
  • When using the docker-based setup, you may wish to configure a persistent container or mount volumes if you need stateful interactions or cached responses across sessions.
  • The tools available include: resolveProviderDocID (to locate provider doc IDs), getProviderDocs (to fetch full provider/resource docs in Markdown), searchModules (to find modules with metadata), and moduleDetails (to fetch module inputs/outputs/configuration).
  • Be mindful of rate limits or API changes from the Terraform Registry that could affect tool outputs.
  • For security, review all outputs and recommendations before applying any IaC changes in production.

Related MCP Servers

Sponsor this space

Reach thousands of developers