MCP server
Terraform MCP server
Look up Terraform providers, modules and policies in the registry, and manage HCP Terraform workspaces.
★ 1.6kpushed 2026-10-23MPL-2.0HashiCorp on DevHunt
Run in a terminal. Everything after -- is the command that starts the server. docs
claude mcp add --transport stdio terraform -- docker run -i --rm hashicorp/terraform-mcp-server
Claude Desktop only: Settings > Developer > Edit Config opens claude_desktop_config.json. Add this, save and restart the app. docs
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project), or use the install button. docs
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}Add to .vscode/mcp.json (note the "servers" key and the type), or use the install button. Command Palette > "MCP: Open User Configuration" for all workspaces. docs
{
"servers": {
"terraform": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}Run codex mcp add terraform -- docker run -i --rm hashicorp/terraform-mcp-server, or add this to ~/.codex/config.toml. docs
[mcp_servers.terraform] command = "docker" args = ["run", "-i", "--rm", "hashicorp/terraform-mcp-server"]
Run in a terminal (-s user adds it for all projects; the default is this project). docs
gemini mcp add -s user terraform docker -- run -i --rm hashicorp/terraform-mcp-server
Run in a terminal; it writes ~/.copilot/mcp-config.json. docs
copilot mcp add terraform -- docker run -i --rm hashicorp/terraform-mcp-server
Add to mcp_config.json: ~/.config/devin/mcp_config.json on macOS and Linux (older installs: ~/.codeium/windsurf/mcp_config.json), %APPDATA%\devin\ on Windows. docs
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}Add to Zed's settings.json (or Settings > AI > MCP Servers > Add Server). Remote servers without an Authorization header sign in with OAuth. docs
{
"context_servers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}Add to opencode.json in the project (or ~/.config/opencode/opencode.json). docs
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"terraform": {
"type": "local",
"command": [
"docker",
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
],
"enabled": true
}
}
}Add to ~/.kiro/settings/mcp.json (all projects) or .kiro/settings/mcp.json (this project). docs
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}MCP Servers > Configure > Configure MCP Servers opens cline_mcp_settings.json; add this entry. docs
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}Agent skills for Terraform
The MCP server gives the agent Terraform's tools; a skill teaches it how to use Terraform well. Install with the skills CLI or see each skill's page for Claude Code, Codex, Copilot and Cursor.
- New Terraform ProviderHashiCorp
Scaffolds a new Terraform provider on the Plugin Framework with module and schema setup.
npx skills add hashicorp/agent-skills --skill new-terraform-provider - Terraform Style GuideHashiCorp
Writes and reviews Terraform HCL following HashiCorp's official style conventions.
npx skills add hashicorp/agent-skills --skill terraform-style-guide - Terraform TestHashiCorp
Writes and runs .tftest.hcl tests with run blocks, assertions and mocked providers.
npx skills add hashicorp/agent-skills --skill terraform-test
FAQ
Is there an official Terraform MCP server?+
Yes: Terraform, maintained by HashiCorp.
How do I connect Terraform to Claude?+
In Claude Code, run the claude mcp add command shown above. In Claude Desktop, add the server to claude_desktop_config.json (Settings > Developer > Edit Config) and restart the app.
How do I use the Terraform MCP server in Cursor or VS Code?+
Open the Cursor or VS Code tab on the server above: it has the exact mcp.json entry and a one-click install link. The same server also works in Claude Code, Claude Desktop / claude.ai, ChatGPT, Cursor, VS Code and Codex.
Is it safe to give an AI agent access to Terraform?+
Start with the official server, a read-only or test account and approval prompts on for anything that writes. Content the agent reads from Terraform (tickets, messages, pages) can carry prompt-injection instructions, so don't auto-approve actions.
All cloud & devops MCP servers · Agent skills · How MCP setup works in each client
MCP servers for similar apps: Airflow · Amazon ECS · Amazon EKS · Ansible · Argo CD · Artifactory · AWS CDK · AWS Lambda · Azure Key Vault · Azure Monitor · Azure Storage · Buildkite · CircleCI · Cloud Run · Cloudflare · Cloudflare Workers · Compute Engine · Cosmos DB · DigitalOcean · Docker Hub · DynamoDB · Fly.io · GKE · Google Cloud