Terraform Modules MCP Server
A multi-cloud MCP server that lets AI assistants discover, understand, and generate Terraform code from module catalogs across AWS, Azure, and GCP.
What it does
- Discover modules — list modules across all clouds with descriptions, dependencies, and costs
- Understand wiring — see how modules connect (e.g., VPC outputs feed into EKS inputs)
- Estimate costs — get per-module cost breakdowns by tier (dev/staging/prod)
- Generate code — produce ready-to-use
.tffiles for single modules or full stacks
Quick start
Install via Claude Code
Add to your ~/.mcp.json (global) or .claude/mcp.json (per-project):
{
"mcpServers": {
"tf-modules": {
"command": "uvx",
"args": ["tf-mcp"],
"env": {
"TF_MODULES_AWS_DIR": "/path/to/your/aws-tf/modules",
"TF_MODULES_AZURE_DIR": "/path/to/your/azure-tf/modules",
"TF_MODULES_GCP_DIR": "/path/to/your/gcp-tf/modules"
}
}
}
}
Only include the env entries for clouds you have modules for.
Install via pip
pip install tf-mcp
Run standalone
tf-mcp
Prerequisites
- Python >= 3.11
- One or more directories containing Terraform modules
Module directory layout
Point the server at directories containing Terraform modules. Each module should be a subdirectory with at least a main.tf:
your-modules-dir/
vpc/
main.tf
variables.tf
outputs.tf
eks-cluster/
main.tf
variables.tf
outputs.tf
The server auto-discovers all subdirectories containing a main.tf.
Configuration
Tell the server where your modules live using environment variables:
| Variable | Description |
|---|---|
TF_MODULES_AWS_DIR |
Path to AWS modules/ directory |
TF_MODULES_AZURE_DIR |
Path to Azure modules/ directory |
TF_MODULES_GCP_DIR |
Path to GCP modules/ directory |
If no env vars are set, the server looks for sibling repos in the default layout:
parent-dir/
aws-tf/modules/
azure-tf/modules/
gcp-tf/modules/
tf-mcp-server/ # this repo
Tools
| Tool | Description |
|---|---|
list_modules |
List modules with optional cloud filter |
get_module_details |
Full variable/output/cost reference for one module |
get_module_dependencies |
Dependency graph and output-to-input wiring |
estimate_costs |
Cost estimates for a set of modules by tier |
generate_module_code |
Generate .tf for a single module |
generate_stack_code |
Generate a complete multi-module stack with auto-wiring |
Resources
| URI | Description |
|---|---|
modules://catalog |
Full listing across all clouds |
modules://{cloud}/catalog |
Listing for one cloud |
modules://{cloud}/{name}/readme |
Module README.md |
modules://{cloud}/{name}/examples |
Module examples/main.tf |
modules://{cloud}/dependency-graph |
Text dependency graph |
modules://conventions |
Terraform conventions |
Development
git clone https://github.com/m-ujifusa/tf-mcp-server.git
cd tf-mcp-server
uv sync
uv run tf-mcp
License
MIT
Metadata
Release files for tf-mcp 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tf_mcp-0.3.0.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tf_mcp-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.6 kB
Release files / tf_mcp-0.3.0.tar.gz
| Download URL | tf_mcp-0.3.0.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1b075322b405cb1c279e0a4f50d2f30f5075299d336edc485fee0da9892484c
|
|
BLAKE2b-256 checksum How to use checksums |
7f9e09ab4d65df2023272e36c6da5d0597b049f92f034156d9240f5b0f427202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tf_mcp-0.3.0-py3-none-any.whl
| Download URL | tf_mcp-0.3.0-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
724cf7d26125d62d0c38edd074fb79d244ef6f58f872800ab3ade3bf3bd02001
|
|
BLAKE2b-256 checksum How to use checksums |
873c3a4a9e28639b998cd0912a22a84c908e3e1a415d86df5175335e661a7ed8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|