Skip to main content
Glama
AWS Terraform MCP Server

AWS Terraform MCP Server

by stv-io

AWS Terraform MCP Server

Docker Image GitHub License

Docker containerized version of the AWS Labs Terraform MCP Server - a Model Context Protocol (MCP) server for Terraform on AWS best practices, infrastructure as code patterns, and security compliance with Checkov.

๐Ÿš€ Quick Start

# Pull and run the latest image
docker run --rm --interactive ghcr.io/stv-io/aws-terraform-mcp-server:latest

Using with MCP Clients

Windsurf IDE

Add to your Windsurf MCP settings:

{
  "name": "AWS Terraform MCP Server",
  "command": "docker",
  "args": [
    "run", "--rm", "--interactive",
    "--env", "FASTMCP_LOG_LEVEL=ERROR",
    "ghcr.io/stv-io/aws-terraform-mcp-server:latest"
  ],
  "env": {},
  "disabled": false,
  "autoApprove": []
}

Cursor IDE

Add to your Cursor MCP configuration:

{
  "mcpServers": {
    "aws-terraform-mcp-server": {
      "command": "docker",
      "args": [
        "run", "--rm", "--interactive",
        "--env", "FASTMCP_LOG_LEVEL=ERROR",
        "ghcr.io/stv-io/aws-terraform-mcp-server:latest"
      ],
      "env": {},
      "disabled": false,
      "autoApprove": []
    }
  }
}

Related MCP server: Terrakube MCP Server

๐Ÿ› ๏ธ Features

Tools Available

  • ExecuteTerraformCommand - Run Terraform commands (init, plan, validate, apply, destroy)

  • ExecuteTerragruntCommand - Run Terragrunt workflows with advanced features

  • SearchAwsProviderDocs - Search AWS provider documentation

  • SearchAwsccProviderDocs - Search AWSCC provider documentation

  • SearchSpecificAwsIaModules - Access AWS-IA GenAI modules (Bedrock, OpenSearch, SageMaker, Streamlit)

  • RunCheckovScan - Security and compliance scanning with Checkov

  • SearchUserProvidedModule - Analyze Terraform Registry modules

Resources Available

  • terraform_development_workflow - Security-focused development process guide

  • terraform_aws_provider_resources_listing - Comprehensive AWS provider resources catalog

  • terraform_awscc_provider_resources_listing - AWSCC provider resources catalog

  • terraform_aws_best_practices - AWS Terraform best practices guidance

๐Ÿ”ง Development

Building Locally

# Clone the repository
git clone https://github.com/stv-io/aws-terraform-mcp-server.git
cd aws-terraform-mcp-server

# Build the Docker image
docker build -t aws-terraform-mcp-server .

# Run locally
docker run --rm --interactive aws-terraform-mcp-server

Testing

Local Docker Testing

# Test the locally built Docker image
python3 test_docker_mcp.py

# Test the published Docker image from GHCR
sed 's|aws-terraform-mcp-server:latest|ghcr.io/stv-io/aws-terraform-mcp-server:latest|g' test_docker_mcp.py > test_published.py
python3 test_published.py

Direct Server Testing (without Docker)

# Test the server directly using uv
python3 test_mcp_server.py

Unit Tests

# Run the comprehensive test suite
python3 -m pytest tests/ -v

Using UV (Alternative)

# Install dependencies
uv sync

# Run the server
uv run awslabs.terraform-mcp-server

๐Ÿ“‹ Prerequisites

For local development:

  1. uv - Python package manager

  2. Python 3.10+

  3. Terraform CLI (for workflow execution)

  4. Checkov (for security scanning)

For Docker usage:

  1. Docker or compatible container runtime

๐Ÿ”’ Security Considerations

  • Follow structured development workflow with integrated validation and security scanning

  • Review all Checkov warnings and fix security issues when possible

  • Use AWSCC provider for consistent API behavior and better security defaults

  • Conduct independent assessment before applying changes to production environments

๐Ÿ”„ Versioning

This project uses Semantic Versioning with automated releases based on Conventional Commits.

Available Tags

  • latest - Latest stable release

  • v1.2.3 - Specific version

  • v1.2 - Latest patch of minor version

  • v1 - Latest minor of major version

See CONTRIBUTING.md for commit message guidelines.

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support

For issues and questions:


Note: This is a containerized distribution of the AWS Labs Terraform MCP Server. All credit for the core functionality goes to the AWS Labs team.

Available Tools

7 tools
ExecuteTerraformCommandA

Execute Terraform workflow commands against an AWS account.

This tool runs Terraform commands (init, plan, validate, apply, destroy) in the
specified working directory, with optional variables and region settings.

Parameters:
    command: Terraform command to execute
    working_directory: Directory containing Terraform files
    variables: Terraform variables to pass
    aws_region: AWS region to use
    strip_ansi: Whether to strip ANSI color codes from output

Returns:
    A TerraformExecutionResult object containing command output and status

Inputs: command (required), working_directory (required), variables, aws_region, +1 more. Returns: Result model for Terraform command execution. Attributes: command: The Terraforโ€ฆ

ExecuteTerragruntCommandA

Execute Terragrunt workflow commands against an AWS account.

This tool runs Terragrunt commands (init, plan, validate, apply, destroy, run-all) in the
specified working directory, with optional variables and region settings. Terragrunt extends
Terraform's functionality by providing features like remote state management, dependencies
between modules, and the ability to execute Terraform commands on multiple modules at once.

Parameters:
    command: Terragrunt command to execute
    working_directory: Directory containing Terragrunt files
    variables: Terraform variables to pass
    aws_region: AWS region to use
    strip_ansi: Whether to strip ANSI color codes from output
    include_dirs: Directories to include in a multi-module run
    exclude_dirs: Directories to exclude from a multi-module run
    run_all: Run command on all modules in subdirectories
    terragrunt_config: Path to a custom terragrunt config file (not valid with run-all)

Returns:
    A TerragruntExecutionResult object containing command output and status

Inputs: command (required), working_directory (required), variables, aws_region, +5 more. Returns: Result model for Terragrunt command execution. Attributes: command: The Terragrโ€ฆ

RunCheckovScanA

Run Checkov security scan on Terraform code.

This tool runs Checkov to scan Terraform code for security and compliance issues,
identifying potential vulnerabilities and misconfigurations according to best practices.

Checkov (https://www.checkov.io/) is an open-source static code analysis tool that
can detect hundreds of security and compliance issues in infrastructure-as-code.

Parameters:
    working_directory: Directory containing Terraform files to scan
    framework: Framework to scan (default: terraform)
    check_ids: Optional list of specific check IDs to run
    skip_check_ids: Optional list of check IDs to skip
    output_format: Format for scan results (default: json)

Returns:
    A CheckovScanResult object containing scan results and identified vulnerabilities

Inputs: working_directory (required), framework, check_ids, skip_check_ids, +1 more. Returns: Result model for Checkov scan execution. Attributes: status: Execution status (โ€ฆ

SearchAwsccProviderDocsA

Search AWSCC provider documentation for resources and attributes.

The AWSCC provider is based on the AWS Cloud Control API
and provides a more consistent interface to AWS resources compared to the standard AWS provider.

This tool searches the Terraform AWSCC provider documentation for information about
a specific asset in the AWSCC Provider Documentation, assets can be either resources or data sources. It retrieves comprehensive details including descriptions, example code snippets, and schema references.

Use the 'asset_type' parameter to specify if you are looking for information about provider resources, data sources, or both. Valid values are 'resource', 'data_source' or 'both'.

The tool will automatically handle prefixes - you can search for either 'awscc_s3_bucket' or 's3_bucket'.

Examples:
    - To get documentation for an S3 bucket resource:
      search_awscc_provider_docs(asset_name='awscc_s3_bucket')
      search_awscc_provider_docs(asset_name='awscc_s3_bucket', asset_type='resource')

    - To search only for data sources:
      search_aws_provider_docs(asset_name='awscc_appsync_api', kind='data_source')

    - To search for both resource and data source documentation of a given name:
      search_aws_provider_docs(asset_name='awscc_appsync_api', kind='both')

    - Search of a resource without the prefix:
      search_awscc_provider_docs(resource_type='ec2_instance')

Parameters:
    asset_name: Name of the AWSCC Provider resource or data source to look for (e.g., 'awscc_s3_bucket', 'awscc_lambda_function')
    asset_type: Type of documentation to search - 'resource' (default), 'data_source', or 'both'. Some resources and data sources share the same name

Returns:
    A list of matching documentation entries with details including:
    - Resource name and description
    - URL to the official documentation
    - Example code snippets
    - Schema information (required, optional, read-only, and nested structures attributes)

Inputs: asset_name (required), asset_type. Returns: result

SearchAwsProviderDocsA

Search AWS provider documentation for resources and attributes.

This tool searches the Terraform AWS provider documentation for information about
a specific asset in the AWS Provider Documentation, assets can be either resources or data sources. It retrieves comprehensive details including descriptions, example code snippets, argument references, and attribute references.

Use the 'asset_type' parameter to specify if you are looking for information about provider resources, data sources, or both. Valid values are 'resource', 'data_source' or 'both'.

The tool will automatically handle prefixes - you can search for either 'aws_s3_bucket' or 's3_bucket'.

Examples:
    - To get documentation for an S3 bucket resource:
      search_aws_provider_docs(asset_name='aws_s3_bucket')

    - To search only for data sources:
      search_aws_provider_docs(asset_name='aws_ami', asset_type='data_source')

    - To search for both resource and data source documentation of a given name:
      search_aws_provider_docs(asset_name='aws_instance', asset_type='both')

Parameters:
    asset_name: Name of the service (asset) to look for (e.g., 'aws_s3_bucket', 'aws_lambda_function')
    asset_type: Type of documentation to search - 'resource' (default), 'data_source', or 'both'

Returns:
    A list of matching documentation entries with details including:
    - Resource name and description
    - URL to the official documentation
    - Example code snippets
    - Arguments with descriptions
    - Attributes with descriptions

Inputs: asset_name (required), asset_type. Returns: result

SearchSpecificAwsIaModulesA

Search for specific AWS-IA Terraform modules.

This tool checks for information about four specific AWS-IA modules:
- aws-ia/bedrock/aws - Amazon Bedrock module for generative AI applications
- aws-ia/opensearch-serverless/aws - OpenSearch Serverless collection for vector search
- aws-ia/sagemaker-endpoint/aws - SageMaker endpoint deployment module
- aws-ia/serverless-streamlit-app/aws - Serverless Streamlit application deployment

It returns detailed information about these modules, including their README content,
variables.tf content, and submodules when available.

The search is performed across module names, descriptions, README content, and variable
definitions. This allows you to find modules based on their functionality or specific
configuration options.

Examples:
    - To get information about all four modules:
      search_specific_aws_ia_modules()

    - To find modules related to Bedrock:
      search_specific_aws_ia_modules(query='bedrock')

    - To find modules related to vector search:
      search_specific_aws_ia_modules(query='vector search')

    - To find modules with specific configuration options:
      search_specific_aws_ia_modules(query='endpoint_name')

Parameters:
    query: Optional search term to filter modules (empty returns all four modules)

Returns:
    A list of matching modules with their details, including:
    - Basic module information (name, namespace, version)
    - Module documentation (README content)
    - Input and output parameter counts
    - Variables from variables.tf with descriptions and default values
    - Submodules information
    - Version details and release information

Inputs: query (required). Returns: result

SearchUserProvidedModuleA

Search for a user-provided Terraform registry module and understand its inputs, outputs, and usage.

This tool takes a Terraform registry module URL and analyzes its input variables,
output variables, README, and other details to provide comprehensive information
about the module.

The module URL should be in the format "namespace/name/provider" (e.g., "hashicorp/consul/aws")
or "registry.terraform.io/namespace/name/provider".

Examples:
    - To search for the HashiCorp Consul module:
      search_user_provided_module(module_url='hashicorp/consul/aws')

    - To search for a specific version of a module:
      search_user_provided_module(module_url='terraform-aws-modules/vpc/aws', version='3.14.0')

    - To search for a module with specific variables:
      search_user_provided_module(
          module_url='terraform-aws-modules/eks/aws',
          variables={'cluster_name': 'my-cluster', 'vpc_id': 'vpc-12345'}
      )

Parameters:
    module_url: URL or identifier of the Terraform module (e.g., "hashicorp/consul/aws")
    version: Optional specific version of the module to analyze
    variables: Optional dictionary of variables to use when analyzing the module

Returns:
    A SearchUserProvidedModuleResult object containing module information

Inputs: module_url (required), version, variables. Returns: Result model for searching user-provided Terraform modules. Attributes: status:โ€ฆ

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A4/5.0

    Scored across 7 tools

    Disambiguation4/5

    Most tools have distinct purposes: Terraform/Terragrunt execution, Checkov scanning, and three types of documentation/module searches. However, there is some overlap between ExecuteTerraformCommand and ExecuteTerragruntCommand, as both handle similar infrastructure-as-code workflows with identical core commands, which could cause confusion if an agent doesn't understand the Terragrunt extension. The three search tools are well-differentiated by their targets (AWSCC docs, AWS docs, specific modules, user-provided modules).

    Naming Consistency4/5

    Tool names follow a consistent PascalCase pattern (e.g., ExecuteTerraformCommand, RunCheckovScan, SearchAwsccProviderDocs), which is predictable and readable. The only minor deviation is that some names start with verbs like 'Execute' or 'Run', while others start with 'Search', but this aligns with their functional groups (execution vs. search), maintaining overall consistency.

    Tool Count5/5

    With 7 tools, the count is well-scoped for an AWS Terraform server, covering execution, security scanning, and documentation/module searches. Each tool earns its place by addressing a specific aspect of Terraform workflows in AWS, without being overly sparse or bloated, making it manageable for agents to navigate.

    Completeness4/5

    The tool set provides good coverage for Terraform operations in AWS, including execution (Terraform/Terragrunt), security (Checkov), and documentation/search capabilities. Minor gaps exist, such as no direct tools for managing Terraform state (e.g., state locking, migration) or handling provider configurations, but core workflows are supported, and agents can likely work around these with the available tools.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      A Model Context Protocol server allowing Claude AI to interact with AWS resources through natural language, enabling users to query and manage AWS services without using the traditional AWS Console or CLI.
      3
      6
      ISC
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables managing Terrakube infrastructure through natural language, handling workspace management, variables, modules, and organization operations.
      16
      20 npm
      3
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      A Model Context Protocol (MCP) server for LocalStack that enables management of local AWS development environments, including container lifecycle operations, infrastructure deployments, log analysis with IAM policy generation, chaos injection, and Cloud Pods state management.
      7
      265 npm
      29
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A 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.
      10
      MIT