MCP Terraform Assistant
Provides tools for managing Terraform infrastructure as code, including initializing directories, planning, applying, destroying, validating configurations, and managing workspaces.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Terraform Assistantinitialize terraform in ./terraform-config"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Infrastructure as Code Assistant
An MCP server for managing infrastructure as code with Terraform.
Features
Initialize Terraform working directories
Generate and show execution plans
Apply changes to infrastructure
Destroy infrastructure
Validate Terraform configurations
Show current state or saved plans
Manage Terraform workspaces
Related MCP server: Terry-Form MCP
Prerequisites
Python 3.8 or higher
Terraform 1.5.7 or higher
Docker and Docker Compose (optional)
Installation
Local Installation
Clone the repository:
git clone https://github.com/yourusername/mcp-iac.git cd mcp-iacInstall dependencies using uv:
curl -LsSf https://astral.sh/uv/install.sh | sh uv pip install -e .
Docker Installation
Clone the repository:
git clone https://github.com/yourusername/mcp-iac.git cd mcp-iacBuild and run the Docker container:
docker-compose up -d
Usage
Local Usage
Start the MCP server:
python main.pyUse the MCP CLI to interact with the server:
mcp terraform_init --working-dir ./terraform mcp terraform_plan --working-dir ./terraform mcp terraform_apply --working-dir ./terraform --auto-approve
Docker Usage
Start the MCP server:
docker-compose up -dUse the MCP CLI to interact with the server:
mcp terraform_init --working-dir ./terraform mcp terraform_plan --working-dir ./terraform mcp terraform_apply --working-dir ./terraform --auto-approve
Example Terraform Configuration
The repository includes an example Terraform configuration that creates an EC2 instance in AWS:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = var.region
}
resource "aws_instance" "example" {
ami = var.ami_id
instance_type = var.instance_type
tags = {
Name = var.instance_name
}
}Contributing
Fork the repository
Create a feature branch
Commit your changes
Push to the branch
Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Available Tools
terraform_init: Initialize a Terraform working directoryterraform_plan: Generate and show an execution plan for Terraformterraform_apply: Apply the changes required to reach the desired stateterraform_destroy: Destroy the infrastructure managed by Terraformterraform_validate: Validate the syntax and internal consistency of Terraform filesterraform_show: Show the current state or a saved planterraform_workspace_list: List Terraform workspacesterraform_workspace_select: Select a Terraform workspace
Example Usage
Here's an example of how to use the MCP server with an AI agent:
Start the MCP server:
python main.pyConnect to the server using an MCP client:
mcp connect http://localhost:8000The AI agent can now help you with Terraform operations. For example:
Initialize a Terraform working directory
Generate and review execution plans
Apply changes to infrastructure
Destroy infrastructure resources
Validate Terraform configurations
Examples
Check out the examples directory for sample Terraform configurations that demonstrate how to use the MCP server:
examples/aws-s3: A simple AWS S3 bucket example
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCquality-maintenanceAn MCP server for Infrastructure as Code that enables AI assistants to manage cloud resources through Ansible and Terraform operations. It supports executing playbooks, managing AWS services, and running Terraform commands with optional LocalStack integration.Last updated18
- Alicense-qualityCmaintenanceA secure, containerized MCP server that enables AI assistants to manage Terraform infrastructure using integrated Language Server Protocol (LSP) tools. It facilitates safe operations like initialization, validation, and planning while providing context-aware code completion and documentation.Last updated9MIT
- Alicense-qualityDmaintenanceAn MCP server that exposes Terraform CLI operations as tools for Claude and other MCP-compatible AI assistants, enabling AI-driven infrastructure-as-code workflows including planning, applying, and validating Terraform configurations.Last updated24MIT
- Flicense-qualityDmaintenanceA FastMCP-based server that provides a natural language interface to Terraform operations, enabling infrastructure management via simple English commands.Last updated3
Related MCP Connectors
An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform
A MCP server built for developers enabling Git based project management with project and personal…
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/guilhermeyoshida/mcp-terraform-assistant'
If you have feedback or need assistance with the MCP directory API, please join our Discord server