Skip to content
Back to search

terraform-mcp-server

Terraform Registry MCP Server

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/thrashr888--terraform-mcp-server/badge.svg)](/listings/thrashr888--terraform-mcp-server)

HTML

<a href="/listings/thrashr888--terraform-mcp-server"><img src="/api/listings/thrashr888--terraform-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Installing in Cursor

To install and use this MCP server in [Cursor](https://cursor.sh/):

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"]
    }
  }
}

4. Restart Claude Desktop to ensure the MCP server is properly loaded.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 167 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Terraform Registry MCP Server
  2. 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.
  3. > [!IMPORTANT]
  4. > This project was used as a PoC for a new official [Terraform MCP server](https://github.com/hashicorp/terraform-mcp-server). This repo has been archived in favor of that one.
  5. ## Installation
  6. ### Installing in Cursor
  7. To install and use this MCP server in [Cursor](https://cursor.sh/):
  8. 1. In Cursor, open Settings (⌘+,) and navigate to the "MCP" tab.
  9. 2. Click "+ Add new MCP server."
  10. 3. Enter the following:
  11. - Name: terraform-registry
  12. - Type: command
  13. - Command: npx -y terraform-mcp-server
  14. 4. Click "Add" then scroll to the server and click "Disabled" to enable the server.
  15. 5. Restart Cursor, if needed, to ensure the MCP server is properly loaded.
  16. ![terraform-registry MCP settings for Cursor](https://github.com/user-attachments/assets/6809dd48-d0fe-4318-b7f6-94ca7970b73a)
  17. ### Installing in Claude Desktop
  18. To install and use this MCP server in Claude Desktop:
  19. 1. In Claude Desktop, open Settings (⌘+,) and navigate to the "Developer" tab.
  20. 2. Click "Edit Config" at the bottom of the window.
  21. 3. Edit the file (`~/Library/Application Support/Claude/claude_desktop_config.json`) to add the following code, then Save the file.
  22. ```json
  23. {
  24. "mcpServers": {
  25. "terraform-registry": {
  26. "command": "npx",
  27. "args": ["-y", "terraform-mcp-server"]
  28. }
  29. }
  30. }
  31. ```
  32. 4. Restart Claude Desktop to ensure the MCP server is properly loaded.
  33. ## Tools
  34. The following tools are available in this MCP server:
  35. ### Core Registry Tools
  36. | Tool | Description |
  37. |------|-------------|
  38. | `providerDetails` | Gets detailed information about a Terraform provider |
  39. | `resourceUsage` | Gets example usage of a Terraform resource and related resources |
  40. | `moduleSearch` | Searches for and recommends Terraform modules based on a query |
  41. | `listDataSources` | Lists all available data sources for a provider and their basic details |
  42. | `resourceArgumentDetails` | Fetches comprehensive details about a resource type's arguments |
  43. | `moduleDetails` | Retrieves detailed metadata for a Terraform module |
  44. | `functionDetails` | Gets details about a Terraform provider function |
  45. | `providerGuides` | Lists and views provider-specific guides and documentation |
  46. | `policySearch` | Searches for policy libraries in the Terraform Registry |
  47. | `policyDetails` | Gets detailed information about a specific policy library |
  48. ### Terraform Cloud Tools
  49. These tools require a Terraform Cloud API token (`TFC_TOKEN`):
  50. | Tool | Description |
  51. |------|-------------|
  52. | `listOrganizations` | Lists all organizations the authenticated user has access to |
  53. | `privateModuleSearch` | Searches for private modules in an organization |
  54. | `privateModuleDetails` | Gets detailed information about a private module |
  55. | `explorerQuery` | Queries the Terraform Cloud Explorer API to analyze data |
  56. | `listWorkspaces` | Lists workspaces in an organization |
  57. | `workspaceDetails` | Gets detailed information about a specific workspace |
  58. | `lockWorkspace` | Locks a workspace to prevent runs |
  59. | `unlockWorkspace` | Unlocks a workspace to allow runs |
  60. | `listRuns` | Lists runs for a workspace |
  61. | `runDetails` | Gets detailed information about a specific run |
  62. | `createRun` | Creates a new run for a workspace |
  63. | `applyRun` | Applies a run that's been planned |
  64. | `cancelRun` | Cancels a run that's in progress |
  65. | `listWorkspaceResources` | Lists resources in a workspace |
  66. ## Resources
  67. The MCP server supports the following resource URIs for listing and reading via the `resources/*` methods:
  68. | Resource Type | Example URI(s) | Description |
  69. |---------------|----------------|-------------|
  70. | **Providers** | `terraform:providers` | List all namespaces/providers |
  71. | | `terraform:provider:<namespace>/<name>` | Get details for a specific provider |
  72. | **Provider Versions** | `terraform:provider:<namespace>/<name>/versions` | List available versions for a provider |
  73. | **Provider Resources** | `terraform:provider:<namespace>/<name>/resources` | List resources for a provider |
  74. | | `terraform:resource:<namespace>/<name>/<resource_name>` | Get details for a specific resource type |
  75. | **Provider Data Sources** | `terraform:provider:<namespace>/<name>/dataSources` | List data sources for a provider |
  76. | | `terraform:dataSource:<namespace>/<name>/<data_source_name>` | Get details for a specific data source |
  77. | **Provider Functions** | `terraform:provider:<namespace>/<name>/functions` | List functions for a provider |
  78. | | `terraform:function:<namespace>/<name>/<function_name>` | Get details for a specific function |
  79. The server also supports `resources/templates/list` to provide templates for creating:
  80. - `terraform:provider`
  81. - `terraform:resource`
  82. - `terraform:dataSource`
  83. ## Prompts
  84. The following prompts are available for generating contextual responses:
  85. | Prompt | Description | Required Arguments |
  86. |--------|-------------|-------------------|
  87. | `migrate-clouds` | Generate Terraform code to migrate infrastructure between cloud providers | `sourceCloud`, `targetCloud`, `terraformCode` |
  88. | `generate-resource-skeleton` | Helps users quickly scaffold new Terraform resources with best practices | `resourceType` |
  89. | `optimize-terraform-module` | Provides actionable recommendations for improving Terraform code | `terraformCode` |
  90. | `migrate-provider-version` | Assists with provider version upgrades and breaking changes | `providerName`, `currentVersion`, `targetVersion`, `terraformCode` (optional) |
  91. | `analyze-workspace-runs` | Analyzes recent run failures and provides troubleshooting guidance for Terraform Cloud workspaces | `workspaceId`, `runsToAnalyze` (optional, default: 5) |
  92. ### Known Issues with Prompts
  93. **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.
  94. ## Running the Server
  95. The server runs using stdio transport for MCP communication:
  96. ```bash
  97. npm install
  98. npm start
  99. ```
  100. ### Configuration with Environment Variables
  101. The server can be configured using environment variables:
  102. | Environment Variable | Description | Default Value |
  103. |---------------------|-------------|---------------|
  104. | `TERRAFORM_REGISTRY_URL` | Base URL for Terraform Registry API | https://registry.terraform.io |
  105. | `DEFAULT_PROVIDER_NAMESPACE` | Default namespace for providers | hashicorp |
  106. | `LOG_LEVEL` | Logging level (error, warn, info, debug) | info |
  107. | `REQUEST_TIMEOUT_MS` | Timeout for API requests in milliseconds | 10000 |
  108. | `RATE_LIMIT_ENABLED` | Enable rate limiting for API requests | false |
  109. | `RATE_LIMIT_REQUESTS` | Number of requests allowed in time window | 60 |
  110. | `RATE_LIMIT_WINDOW_MS` | Time window for rate limiting in milliseconds | 60000 |
  111. | `TFC_TOKEN` | Terraform Cloud API token for private registry access (optional) | |
  112. Example usage with environment variables:
  113. ```bash
  114. # Set environment variables
  115. export LOG_LEVEL="debug"
  116. export REQUEST_TIMEOUT_MS="15000"
  117. export TFC_TOKEN="your-terraform-cloud-token"
  118. # Run the server
  119. npm start
  120. ```
  121. ## Testing
  122. See the [TESTS.md](TESTS.md) file for information about testing this project.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.