Registry / devops / terraform-mcp-server

terraform-mcp-server

JSON →
library0.13.0jsnpmunverified

A Model Context Protocol (MCP) server that provides tools for interacting with the Terraform Registry API, enabling AI agents to query provider information, resource details, module metadata, and Terraform Cloud resources. Current stable version is v0.13.0, actively maintained. Key differentiators include a comprehensive set of tools for both public registry (providerDetails, resourceUsage, moduleSearch) and Terraform Cloud (workspaces, runs, organizations), with standardized tool naming and Docker support. Alternatives like terraform-mcp or official Terraform APIs offer more limited scope or require custom integration.

npm install terraform-mcp-server
INSTALL
IMPORT
SIG · TERRAFORM-MCP-SERV
T
terraform-mcp-server
devopsjavascriptv0.13.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import terraformMcpServer from 'terraform-mcp-server';
const terraformMcpServer = require('terraform-mcp-server');
Package is ESM-only since v0.9.x; CommonJS require will fail. Use top-level default import.
ProviderDetailsTool
import { ProviderDetailsTool } from 'terraform-mcp-server';
const { ProviderDetailsTool } = require('terraform-mcp-server');
Named exports available for individual tools, but only with ESM imports.
ServerConfig
import { ServerConfig } from 'terraform-mcp-server';
TypeScript type exported for server configuration; only available as type import.

Shows how to run the MCP server from CLI with npx and programmatically import and connect it with a transport.

// Quickstart: run the MCP server with npx (no code required for basic use) // In your terminal: // npx terraform-mcp-server // To use programmatically: import terraformMcpServer from 'terraform-mcp-server'; const config = { // Optional: add Terraform Cloud token for private module/workspace tools tfcToken: process.env.TFC_TOKEN ?? '' }; const server = terraformMcpServer(config); // The server implements the MCP protocol; connect it to a transport // Example with stdin/stdout transport: import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; const transport = new StdioServerTransport(); await server.connect(transport); console.log('Terraform Registry MCP server running on stdio');
Debug
Known issues
breakingTool naming standardized in v0.12.0; existing tool names may have changed (e.g., 'searchModules' renamed to 'moduleSearch').
fix
Update tool names to new standardized patterns: e.g., use 'moduleSearch' instead of 'searchModules'.
affects: <0.12.0
breakingRemoved 'exampleConfigGenerator' tool in v0.9.6; tool no longer available.
fix
Use 'resourceUsage' tool for example configurations instead.
affects: >=0.9.6
breakingRemoved 'providerSchemaDetails' tool in v0.9.5; tool no longer available.
fix
Use 'resourceArgumentDetails' tool to get resource argument details.
affects: >=0.9.5
deprecatedTerraform Cloud API token now required as environment variable 'TFC_TOKEN' instead of config file parameter.
fix
Set TFC_TOKEN environment variable before starting the server.
affects: >=0.11.0
gotchaMCP protocol version mismatch: server sends protocol version '2024-11-05' but older clients may expect '2024-10-07'.
fix
Ensure your MCP client supports protocol version 2024-11-05; update client SDK if needed.
affects: >=0.9.8
gotchaRate limiting: Terraform Registry API may return 429 errors under heavy usage; server does not implement retry logic.
fix
Implement client-side rate limiting or exponential backoff; consider caching frequent queries locally.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'terraform-mcp-server' (or 'ERR_MODULE_NOT_FOUND')
Using CommonJS require() with an ESM-only package; also possible if package not installed globally.
fix
Use ESM import syntax (import ... from 'terraform-mcp-server') or run via npx (npx terraform-mcp-server) without local install.
TypeError: terraformMcpServer is not a function
Importing default export incorrectly, possibly using named import for default.
fix
Ensure default import: import terraformMcpServer from 'terraform-mcp-server'; (without braces).
Error: TFC_TOKEN environment variable not set
Terraform Cloud tools require the TFC_TOKEN env var; attempting to use them without setting it.
fix
Set TFC_TOKEN to your Terraform Cloud API token: export TFC_TOKEN='your_token_here' or pass in config.tfcToken if supported.
Error: Tool 'searchModules' not found (or 'exampleConfigGenerator' not found)
Tool renamed or removed in recent versions; using old tool names.
fix
Use new standardized names: 'moduleSearch' instead of 'searchModules'; 'resourceUsage' instead of 'exampleConfigGenerator'.
Upgrade
Version history
0.13.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources