Terraform Registry MCP Server

Terraform Registry MCP Server

Connects AI models to the Terraform Registry via MCP, enabling provider lookups, resource usage examples, and module recommendations for streamlined Terraform workflows.

thrashr888

Cloud Platforms
Developer Tools
TypeScript
Visit Server

Tools

providerLookup

Lookup a Terraform provider by name and optionally version.

resourceUsage

Get an example usage of a Terraform resource and related resources.

moduleRecommendations

Search for and recommend Terraform modules for a given query.

dataSourceLookup

List all available data sources for a provider and their basic details.

resourceArgumentDetails

Fetches details about a specific resource type's arguments, including name, type, description, and requirements.

moduleDetails

Retrieves detailed metadata for a Terraform module including versions, inputs, outputs, and dependencies.

README

Terraform Registry MCP Server

A Model Context Protocol (MCP) server that provides tools for interacting with the Terraform Registry API. This server enables AI agents to query provider information, resource details, and module metadata.

Installation

Installing in Cursor

To install and use this MCP server in Cursor:

  1. In Cursor, open Settings (⌘+,) and navigate to the "MCP" tab.

  2. Click "+ Add new MCP server."

  3. Enter the following:

    • Name: terraform-registry
    • Type: command
    • Command: npx -y terraform-mcp-server
  4. Click "Add" then scroll to the server and click "Disabled" to enable the server.

  5. Restart Cursor, if needed, to ensure the MCP server is properly loaded.

terraform-registry MCP settings for Cursor

Installing in Claude Desktop

To install and use this MCP server in Claude Desktop:

  1. In Claude Desktop, open Settings (⌘+,) and navigate to the "Developer" tab.

  2. Click "Edit Config" at the bottom of the window.

  3. Edit the file (~/Library/Application Support/Claude/claude_desktop_config.json) to add the following code, then Save the file.

{
  "mcpServers": {
    "terraform-registry": {
      "command": "npx",
      "args": ["-y", "terraform-mcp-server"]
    }
  }
}
  1. Restart Claude Desktop to ensure the MCP server is properly loaded.

Tools

The following tools are available in this MCP server:

Core Registry Tools

Tool Description
providerDetails Gets detailed information about a Terraform provider
resourceUsage Gets example usage of a Terraform resource and related resources
moduleSearch Searches for and recommends Terraform modules based on a query
listDataSources Lists all available data sources for a provider and their basic details
resourceArgumentDetails Fetches comprehensive details about a resource type's arguments
moduleDetails Retrieves detailed metadata for a Terraform module
functionDetails Gets details about a Terraform provider function
providerGuides Lists and views provider-specific guides and documentation
policySearch Searches for policy libraries in the Terraform Registry
policyDetails Gets detailed information about a specific policy library

Terraform Cloud Tools

These tools require a Terraform Cloud API token (TFC_TOKEN):

Tool Description
listOrganizations Lists all organizations the authenticated user has access to
privateModuleSearch Searches for private modules in an organization
privateModuleDetails Gets detailed information about a private module
explorerQuery Queries the Terraform Cloud Explorer API to analyze data
listWorkspaces Lists workspaces in an organization
workspaceDetails Gets detailed information about a specific workspace
lockWorkspace Locks a workspace to prevent runs
unlockWorkspace Unlocks a workspace to allow runs
listRuns Lists runs for a workspace
runDetails Gets detailed information about a specific run
createRun Creates a new run for a workspace
applyRun Applies a run that's been planned
cancelRun Cancels a run that's in progress
listWorkspaceResources Lists resources in a workspace

Resources

The MCP server supports the following resource URIs for listing and reading via the resources/* methods:

Resource Type Example URI(s) Description
Providers terraform:providers List all namespaces/providers
terraform:provider:<namespace>/<name> Get details for a specific provider
Provider Versions terraform:provider:<namespace>/<name>/versions List available versions for a provider
Provider Resources terraform:provider:<namespace>/<name>/resources List resources for a provider
terraform:resource:<namespace>/<name>/<resource_name> Get details for a specific resource type
Provider Data Sources terraform:provider:<namespace>/<name>/dataSources List data sources for a provider
terraform:dataSource:<namespace>/<name>/<data_source_name> Get details for a specific data source
Provider Functions terraform:provider:<namespace>/<name>/functions List functions for a provider
terraform:function:<namespace>/<name>/<function_name> Get details for a specific function

The server also supports resources/templates/list to provide templates for creating:

  • terraform:provider
  • terraform:resource
  • terraform:dataSource

Prompts

The following prompts are available for generating contextual responses:

Prompt Description Required Arguments
migrate-clouds Generate Terraform code to migrate infrastructure between cloud providers sourceCloud, targetCloud, terraformCode
generate-resource-skeleton Helps users quickly scaffold new Terraform resources with best practices resourceType
optimize-terraform-module Provides actionable recommendations for improving Terraform code terraformCode
migrate-provider-version Assists with provider version upgrades and breaking changes providerName, currentVersion, targetVersion, terraformCode (optional)
analyze-workspace-runs Analyzes recent run failures and provides troubleshooting guidance for Terraform Cloud workspaces workspaceId, runsToAnalyze (optional, default: 5)

Known Issues with Prompts

Note: There is a known issue with the getPrompt functionality that can cause server crashes. The server properly registers prompts and can list them, but direct requests using the getPrompt method may cause connectivity issues. This is being investigated and may be related to SDK compatibility or implementation details. Until resolved, use listPrompts to see available prompts but avoid direct getPrompt calls.

Running the Server

The server runs using stdio transport for MCP communication:

npm install
npm start

Configuration with Environment Variables

The server can be configured using environment variables:

Environment Variable Description Default Value
TERRAFORM_REGISTRY_URL Base URL for Terraform Registry API https://registry.terraform.io
DEFAULT_PROVIDER_NAMESPACE Default namespace for providers hashicorp
LOG_LEVEL Logging level (error, warn, info, debug) info
REQUEST_TIMEOUT_MS Timeout for API requests in milliseconds 10000
RATE_LIMIT_ENABLED Enable rate limiting for API requests false
RATE_LIMIT_REQUESTS Number of requests allowed in time window 60
RATE_LIMIT_WINDOW_MS Time window for rate limiting in milliseconds 60000
TFC_TOKEN Terraform Cloud API token for private registry access (optional)

Example usage with environment variables:

# Set environment variables
export LOG_LEVEL="debug"
export REQUEST_TIMEOUT_MS="15000"
export TFC_TOKEN="your-terraform-cloud-token"

# Run the server
npm start

Testing

See the TESTS.md file for information about testing this project.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Apple MCP Server

Apple MCP Server

Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.

Featured
Local
TypeScript
contentful-mcp

contentful-mcp

Update, create, delete content, content-models and assets in your Contentful Space

Featured
TypeScript