{"id":46169992,"url":"https://github.com/aetherwing-io/fcp-terraform","last_synced_at":"2026-03-05T17:03:29.593Z","repository":{"id":341046786,"uuid":"1168658987","full_name":"aetherwing-io/fcp-terraform","owner":"aetherwing-io","description":"MCP server for Terraform HCL generation","archived":false,"fork":false,"pushed_at":"2026-03-02T22:12:25.000Z","size":210,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-03T16:54:17.522Z","etag":null,"topics":["hcl","infrastructure-as-code","llm","mcp","model-context-protocol","terraform"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aetherwing-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-27T16:43:13.000Z","updated_at":"2026-03-02T22:12:28.000Z","dependencies_parsed_at":"2026-03-03T15:11:57.377Z","dependency_job_id":null,"html_url":"https://github.com/aetherwing-io/fcp-terraform","commit_stats":null,"previous_names":["aetherwing-io/fcp-terraform"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/aetherwing-io/fcp-terraform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aetherwing-io%2Ffcp-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aetherwing-io%2Ffcp-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aetherwing-io%2Ffcp-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aetherwing-io%2Ffcp-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aetherwing-io","download_url":"https://codeload.github.com/aetherwing-io/fcp-terraform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aetherwing-io%2Ffcp-terraform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30085792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hcl","infrastructure-as-code","llm","mcp","model-context-protocol","terraform"],"created_at":"2026-03-02T14:28:17.315Z","updated_at":"2026-03-04T16:01:00.674Z","avatar_url":"https://github.com/aetherwing-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fcp-terraform\n\nMCP server for Terraform HCL generation through intent-level commands.\n\n## What It Does\n\nfcp-terraform lets LLMs build Terraform configurations by describing infrastructure intent -- resources, data sources, variables, outputs -- and renders them into valid HCL. Instead of writing raw HCL syntax, the LLM sends operations like `add resource aws_instance web ami:\"ami-0c55b159\" instance_type:t2.micro` and fcp-terraform manages the semantic model, dependency graph, and serialization. Built on the [FCP](https://github.com/aetherwing-io/fcp) framework.\n\nWritten in Go using HashiCorp's `hclwrite` library for native HCL AST generation -- no string concatenation or template rendering.\n\n## Quick Example\n\n```\nterraform_session('new \"Main Infrastructure\"')\n\nterraform([\n  'add resource aws_instance web ami:\"ami-0c55b159\" instance_type:t2.micro',\n  'add resource aws_s3_bucket assets bucket:\"my-assets\"',\n  'add variable region default:\"us-east-1\" type:string',\n  'add output instance_ip value:\"aws_instance.web.public_ip\"',\n])\n\nterraform_query('plan')\n```\n\nThe `plan` query produces:\n\n```hcl\nvariable \"region\" {\n  type    = string\n  default = \"us-east-1\"\n}\n\nresource \"aws_instance\" \"web\" {\n  ami           = \"ami-0c55b159\"\n  instance_type = \"t2.micro\"\n}\n\nresource \"aws_s3_bucket\" \"assets\" {\n  bucket = \"my-assets\"\n}\n\noutput \"instance_ip\" {\n  value = aws_instance.web.public_ip\n}\n```\n\n### Available MCP Tools\n\n| Tool | Purpose |\n|------|---------|\n| `terraform(ops)` | Batch mutations -- add, set, remove, connect, nest, label, style |\n| `terraform_query(q)` | Inspect the config -- map, list, describe, plan, graph, validate, find |\n| `terraform_session(action)` | Lifecycle -- new, open, save, checkpoint, undo, redo |\n| `terraform_help()` | Full reference card |\n\n### Verb Reference\n\n| Verb | Syntax |\n|------|--------|\n| `add resource` | `add resource TYPE LABEL [key:value...]` |\n| `add provider` | `add provider PROVIDER [region:R] [key:value...]` |\n| `add variable` | `add variable NAME [type:T] [default:V] [description:D]` |\n| `add output` | `add output NAME value:EXPR [description:D]` |\n| `add data` | `add data TYPE LABEL [key:value...]` |\n| `add module` | `add module LABEL source:PATH [key:value...]` |\n| `connect` | `connect SRC -\u003e TGT [label:TEXT]` |\n| `set` | `set LABEL key:value [key:value...]` |\n| `nest` | `nest LABEL BLOCK_TYPE[/CHILD_TYPE] [key:value...]` |\n| `remove` | `remove LABEL` or `remove @SELECTOR` |\n| `label` | `label OLD_LABEL \"new_label\"` |\n| `style` | `style LABEL tags:\"Key=Val,Key2=Val2\"` |\n\n### Selectors\n\n```\n@type:aws_instance      All resources of a given type\n@provider:aws            All blocks from a given provider\n@kind:resource           All blocks of kind (resource, variable, output, data)\n@tag:KEY or @tag:KEY=VAL Blocks matching a tag\n@all                     All blocks\n```\n\n## Installation\n\n### Go install\n\n```bash\ngo install github.com/aetherwing-io/fcp-terraform/cmd/fcp-terraform@latest\n```\n\n### GitHub Releases\n\nDownload a prebuilt binary from [Releases](https://github.com/aetherwing-io/fcp-terraform/releases) and put `fcp-terraform` on your PATH.\n\n### MCP Client Configuration\n\n```json\n{\n  \"mcpServers\": {\n    \"fcp-terraform\": {\n      \"command\": \"fcp-terraform\"\n    }\n  }\n}\n```\n\n## Architecture\n\n```\ncmd/fcp-terraform/main.go     MCP server — 4 tools, stdio transport\n        │\ninternal/terraform/            Domain layer\n  ├── model.go                 Semantic model (blocks, attributes, connections)\n  ├── adapter.go               FCP adapter (dispatch ops → handlers)\n  ├── handlers.go              Verb handlers (add, set, remove, nest, etc.)\n  ├── queries.go               Query dispatcher (plan, graph, describe, etc.)\n  ├── selectors.go             @type, @provider, @kind, @tag, @all\n  ├── values.go                Attribute type inference, hclwrite value generation\n  ├── verb_specs.go            Verb specifications and reference card sections\n  ├── block_ref.go             Terraform reference detection\n  └── index.go                 Label index for O(1) lookups\n        │\ninternal/fcpcore/              Shared FCP framework (Go port)\n  ├── tokenizer.go             DSL tokenizer\n  ├── parsed_op.go             Operation parser\n  ├── verb_registry.go         Verb spec registry + reference card generator\n  ├── event_log.go             Event sourcing (undo/redo)\n  ├── session.go               Session lifecycle (new, open, save, checkpoint)\n  └── formatter.go             Response formatter\n```\n\nHCL generation uses HashiCorp's `hclwrite` package for native AST manipulation. Provider is auto-detected from resource type prefixes (`aws_`, `google_`, `azurerm_`).\n\n## Worked Example: AWS Production Web Stack\n\nA realistic deployment showing how operations compose. This example creates a VPC with subnets, EC2, RDS, S3, IAM, and security groups -- 13 resources total.\n\n```\nterraform_session('new \"Acme Corp Web Stack\"')\n\n# Provider + Variables\nterraform([\n  'add provider aws region:us-east-1',\n  'add variable environment type:string default:\"production\" description:\"Deployment environment\"',\n  'add variable project_name type:string default:\"acme-web\" description:\"Project name\"',\n  'add variable vpc_cidr type:string default:\"10.0.0.0/16\" description:\"VPC CIDR block\"',\n  'add variable instance_type type:string default:\"t3.medium\" description:\"EC2 instance type\"',\n  'add variable db_instance_class type:string default:\"db.t3.medium\" description:\"RDS instance class\"',\n])\n\n# Networking\nterraform([\n  'add resource aws_vpc main cidr_block:var.vpc_cidr enable_dns_support:true enable_dns_hostnames:true',\n  'add resource aws_subnet public_a vpc_id:aws_vpc.main.id cidr_block:\"10.0.1.0/24\" map_public_ip_on_launch:true',\n  'add resource aws_subnet public_b vpc_id:aws_vpc.main.id cidr_block:\"10.0.2.0/24\" map_public_ip_on_launch:true',\n  'add resource aws_internet_gateway igw vpc_id:aws_vpc.main.id',\n  'add resource aws_route_table public vpc_id:aws_vpc.main.id',\n])\n\n# Nested blocks for route table and security groups\nterraform([\n  'nest public route cidr_block:\"0.0.0.0/0\" gateway_id:aws_internet_gateway.igw.id',\n  'add resource aws_security_group web name:\"${var.project_name}-web-sg\" vpc_id:aws_vpc.main.id',\n  'nest web ingress from_port:80 to_port:80 protocol:\"tcp\"',\n  'nest web ingress from_port:443 to_port:443 protocol:\"tcp\"',\n  'nest web egress from_port:0 to_port:0 protocol:\"-1\"',\n])\n\n# Compute + Database\nterraform([\n  'add resource aws_instance webserver ami:\"ami-0c55b159\" instance_type:var.instance_type subnet_id:aws_subnet.public_a.id',\n  'nest webserver root_block_device volume_size:20 volume_type:\"gp3\"',\n  'add resource aws_db_subnet_group dbsubnet name:\"${var.project_name}-db-subnet\"',\n  'set dbsubnet subnet_ids:\"[aws_subnet.public_a.id,aws_subnet.public_b.id]\"',\n  'add resource aws_db_instance rds engine:\"postgresql\" instance_class:var.db_instance_class allocated_storage:20',\n  'add resource aws_s3_bucket assets bucket:\"${var.project_name}-assets-${var.environment}\"',\n])\n\n# Outputs\nterraform([\n  'add output vpc_id value:aws_vpc.main.id',\n  'add output web_ip value:aws_instance.webserver.public_ip',\n  'add output db_endpoint value:aws_db_instance.rds.endpoint',\n])\n\n# Tags (all resources at once)\nterraform([\n  'style main tags:\"Name=${var.project_name}-vpc,Environment=${var.environment}\"',\n  'style public_a tags:\"Name=${var.project_name}-public-a,Environment=${var.environment}\"',\n  'style public_b tags:\"Name=${var.project_name}-public-b,Environment=${var.environment}\"',\n  'style igw tags:\"Name=${var.project_name}-igw,Environment=${var.environment}\"',\n  'style webserver tags:\"Name=${var.project_name}-web,Environment=${var.environment}\"',\n  'style rds tags:\"Name=${var.project_name}-db,Environment=${var.environment}\"',\n  'style assets tags:\"Name=${var.project_name}-assets,Environment=${var.environment}\"',\n])\n\n# Day-2 modifications\nterraform([\n  'label webserver app_server',                         # Rename\n  'set instance_type default:\"t3.large\"',               # Change default\n  'remove assets',                                       # Replace S3 bucket\n  'add resource aws_s3_bucket static_assets bucket:\"${var.project_name}-static-${var.environment}\"',\n])\n\nterraform_query('plan')  # Export final HCL\n```\n\n## Development\n\n```bash\ngo test ./...                        # Run all tests\ngo build ./cmd/fcp-terraform         # Build binary\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faetherwing-io%2Ffcp-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faetherwing-io%2Ffcp-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faetherwing-io%2Ffcp-terraform/lists"}