Back to Home
liuwuliuyun icon

tf-mcp-server

Verified Safe

by liuwuliuyun

Overview

An MCP server for AI assistants to manage Azure infrastructure-as-code (IaC) using Terraform, providing documentation, security validation, code generation, and state management capabilities.

Installation

Run Command
docker run --rm -i --name tf-mcp-server-instance -v "$(pwd):/workspace" -e LOG_LEVEL=INFO -e ARM_CLIENT_ID=$ARM_CLIENT_ID -e ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET -e ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID=$ARM_TENANT_ID ghcr.io/liuwuliuyun/tf-mcp-server:latest

Environment Variables

  • ARM_CLIENT_ID
  • ARM_CLIENT_SECRET
  • ARM_SUBSCRIPTION_ID
  • ARM_TENANT_ID
  • APPLICATIONINSIGHTS_CONNECTION_STRING
  • GITHUB_TOKEN
  • LOG_LEVEL
  • MCP_DEBUG
  • MCP_SERVER_HOST
  • MCP_SERVER_PORT
  • MCP_WORKSPACE_ROOT
  • TELEMETRY_ENABLED
  • TELEMETRY_SAMPLE_RATE
  • TF_LOG
  • TF_LOG_PATH

Security Notes

The server heavily relies on executing external CLI tools (Terraform, TFLint, Conftest, aztfexport, Azure CLI) via subprocesses. Inputs to these commands are generally handled via tool arguments, some of which are Pydantic validated or split using `shlex.split` to mitigate injection risks. AVM module downloads involve `tarfile.extractall` into a temporary directory, which could be vulnerable to zip slip if not carefully handled. The Docker container runs as a non-root user. Azure authentication secrets and GitHub tokens are expected via environment variables, not hardcoded. Overall, designed with security in mind for its operational context, but external execution and archive extraction always carry inherent risks.

Similar Servers

Stats

Interest Score17
Security Score8
Cost ClassHigh
Avg Tokens1500
Stars1
Forks4
Last Update2025-12-30

Tags

AzureTerraformIaCMCPDocumentationSecurityValidationDevOpsCode GenerationState ManagementTFLintConftestaztfexport