Terraform Registry MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables access to HashiCorp's Terraform Registry, allowing lookup of HashiCorp-provided providers and modules, with detailed information on their configuration, requirements, and usage examples.

  • Provides tools for interacting with the Terraform Registry API, enabling querying of provider information, resource details, module metadata, and recommendations. Supports looking up providers, retrieving resource usage examples, finding modules, listing data sources, and fetching comprehensive resource argument details.

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.

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

ToolDescription
providerDetailsGets detailed information about a Terraform provider
resourceUsageGets example usage of a Terraform resource and related resources
moduleSearchSearches for and recommends Terraform modules based on a query
listDataSourcesLists all available data sources for a provider and their basic details
resourceArgumentDetailsFetches comprehensive details about a resource type's arguments
moduleDetailsRetrieves detailed metadata for a Terraform module
functionDetailsGets details about a Terraform provider function
providerGuidesLists and views provider-specific guides and documentation
policySearchSearches for policy libraries in the Terraform Registry
policyDetailsGets detailed information about a specific policy library

Terraform Cloud Tools

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

ToolDescription
listOrganizationsLists all organizations the authenticated user has access to
privateModuleSearchSearches for private modules in an organization
privateModuleDetailsGets detailed information about a private module
explorerQueryQueries the Terraform Cloud Explorer API to analyze data
listWorkspacesLists workspaces in an organization
workspaceDetailsGets detailed information about a specific workspace
lockWorkspaceLocks a workspace to prevent runs
unlockWorkspaceUnlocks a workspace to allow runs
listRunsLists runs for a workspace
runDetailsGets detailed information about a specific run
createRunCreates a new run for a workspace
applyRunApplies a run that's been planned
cancelRunCancels a run that's in progress
listWorkspaceResourcesLists resources in a workspace

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 VariableDescriptionDefault Value
TERRAFORM_REGISTRY_URLBase URL for Terraform Registry APIhttps://registry.terraform.io
DEFAULT_PROVIDER_NAMESPACEDefault namespace for providershashicorp
LOG_LEVELLogging level (error, warn, info, debug)info
REQUEST_TIMEOUT_MSTimeout for API requests in milliseconds10000
RATE_LIMIT_ENABLEDEnable rate limiting for API requestsfalse
RATE_LIMIT_REQUESTSNumber of requests allowed in time window60
RATE_LIMIT_WINDOW_MSTime window for rate limiting in milliseconds60000
TFC_TOKENTerraform Cloud API token for private registry access

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.

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

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

  1. Installation
    1. Installing in Cursor
    2. Installing in Claude Desktop
  2. Tools
    1. Core Registry Tools
    2. Terraform Cloud Tools
  3. Running the Server
    1. Configuration with Environment Variables
  4. Testing