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.
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:
- In Cursor, open Settings (⌘+,) and navigate to the "MCP" tab.
- Click "+ Add new MCP server."
- Enter the following:
- Name: terraform-registry
- Type: command
- Command: npx -y terraform-mcp-server
- Click "Add" then scroll to the server and click "Disabled" to enable the server.
- 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:
- In Claude Desktop, open Settings (⌘+,) and navigate to the "Developer" tab.
- Click "Edit Config" at the bottom of the window.
- Edit the file (
~/Library/Application Support/Claude/claude_desktop_config.json
) to add the following code, then Save the file.
- Restart Claude Desktop to ensure the MCP server is properly loaded.
Testing
For information about testing this project, please see the TESTS.md file.
Tools
1. Provider Lookup
Looks up Terraform provider details by name, returning the latest version and version count.
Input:
Output:
2. Resource Usage
Gets example usage of a Terraform resource and related resources.
Input:
Output:
3. Module Recommendations
Searches for and recommends Terraform modules based on a query.
Input:
Output:
4. Data Source Lookup
Retrieves available data source identifiers for a given Terraform provider.
Input:
Output:
5. Resource Argument Details
Fetches comprehensive details about a specific resource type's arguments, including required and optional attributes, nested blocks, and their descriptions.
Input:
Output:
6. Module Details
Retrieves detailed metadata for a Terraform module.
Input:
Output:
Running the Server
The server runs using stdio transport for MCP communication:
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 |
Example usage with environment variables:
Testing
See the TESTS.md file for information about testing this project.
You must be authenticated.
Connects AI models to the Terraform Registry via MCP, enabling provider lookups, resource usage examples, and module recommendations for streamlined Terraform workflows.