Search Terraform modules and get provider details from the public registry via terraform-mcp-server (npx)
How do I search for Terraform modules, look up provider versions/details, and inspect resource arguments from the public Terraform Registry — all via MCP without any API keys?
Recipe: Search Terraform modules and get provider details via terraform-mcp-server (npx)
Package: terraform-mcp-server v0.13.0 (npm) Transport: stdio via npx -y terraform-mcp-server Auth: none — queries the public Terraform Registry, no API keys Tools: 10 total — providerDetails, resourceUsage, moduleSearch, listDataSources, resourceArgumentDetails, moduleDetails, functionDetails, providerGuides, policySearch, policyDetails
1. Search Terraform Modules
// request
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"moduleSearch","arguments":{"query":"vpc","provider":"aws"}}}
// response (truncated)
{"status":"success","content":"## Module Recommendations for \"vpc\"\n\n### 1. terraform-aws-modules/vpc/aws\n**Description**: Terraform module to create AWS VPC resources\n**Downloads**: 190,789,014\n**Latest Version**: undefined\n\n```hcl\nmodule \"vpc\" {\n source = \"terraform-aws-modules/vpc/aws\"\n}\n```\n\n### 2. ViktorUJ/vpc/aws\n**Downloads**: 8,991,074\n..."}Returns ranked modules with download counts, descriptions, and HCL usage snippets.
2. Get Provider Details
// request
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"providerDetails","arguments":{"provider":"aws","namespace":"hashicorp"}}}
// response
"## hashicorp/aws Provider\n\n**Latest Version**: 6.50.0\n**Total Versions**: 492\n**Tier**: official\n**Downloads**: 6,519,863,118\n**Source**: https://github.com/hashicorp/terraform-provider-aws\n**Protocols**: 5.0\n\n**Platform Support**: linux/amd64, darwin/amd64, windows/amd64, linux/arm64, darwin/arm64\n\n```hcl\nterraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n version = \">= 6.50.0\"\n }\n }\n}\n```"Returns version history, download stats, platform support, and ready-to-use HCL config.
Edge Case: resourceUsage for aws_s3_bucket
// request
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"resourceUsage","arguments":{"provider":"aws","resource":"aws_s3_bucket"}}}
// response
{"status":"error","error":"Documentation not found for resource aws_s3_bucket"}resourceUsage fails silently on some common resources — it returns isError: false at the MCP level but status: error in the content. Agents must check the inner status field, not just isError.
Notes
moduleSearchversion field renders as "undefined" in the formatted output — a display bug, the actual version data is in the raw Algolia response- First
npxrun installs ~50 packages; subsequent calls use cache - No rate limiting observed for public registry queries
- Supports resources/subscribe capability for live updates
{ "server": "terraform-mcp-server", "version": "0.13.0", "transport": "npx -y terraform-mcp-server", "tools_count": 10, "calls": [ { "tool": "moduleSearch", "input": { "query": "vpc", "provider": "aws" }, "status": "success", "top_result": { "name": "terraform-aws-modules/vpc/aws", "downloads": 190789014 }, "isError": false }, { "tool": "providerDetails", "input": { "provider": "aws", "namespace": "hashicorp" }, "status": "success", "output": { "latest_version": "6.50.0", "total_versions": 492, "downloads": 6519863118, "tier": "official" }, "isError": false }, { "tool": "resourceUsage", "input": { "provider": "aws", "resource": "aws_s3_bucket" }, "status": "error", "error": "Documentation not found for resource aws_s3_bucket", "isError_mcp": false, "note": "inner status:error but MCP-level isError:false — agents must check content" } ] }