claude-iac-mcp-server
Enables AI agents to query an approved Terraform module registry and generate compliant Azure infrastructure code. It provides tools for module discovery, scaffolding, and validation against organizational standards.
README
AI-Assisted IaC Self-Service Platform (Azure + Terraform)
An AI-assisted self-service platform for infrastructure. Developers use Claude Code or GitHub Copilot to query an approved Terraform module registry and generate compliant Azure infrastructure — without hand-rolling Terraform or pulling random modules off the internet.
The approved registry is hybrid:
- Azure Verified Modules (AVM) — Microsoft's curated, compliance-grade modules from the public Terraform Registry (the baseline).
- Your own modules — hosted in a GitHub repo and referenced via a
git::source. No registry product required. Seeregistry/modules/TEMPLATE-custom-git-module.yaml.
It has two halves:
- An IaC MCP server (
server/iac_mcp_server.py) — exposes the approved module registry + standards as MCP tools. - Agent skill / context (
skills/iac-self-service/SKILL.md) — encodes how the agent must use those tools to stay compliant.
developer ──▶ Claude Code / Copilot ──MCP──▶ iac_mcp_server ──▶ registry/ + standards/
│ (AVM + your git modules)
└── guided by skills/iac-self-service/SKILL.md
Note on names:
acmeis a placeholder org name and theapp.terraform.io/acme/*entry is an optional private-registry example. Replaceacmewith your own short name to brand it. The real, working modules are the AVM ones.
Layout
| Path | Purpose |
|---|---|
server/iac_mcp_server.py |
FastMCP server (7 tools) |
registry/catalog.yaml |
The allowlist of approved modules |
registry/modules/*.yaml |
Per-module spec: source, version, rg_ref, inputs, outputs, example |
registry/modules/TEMPLATE-custom-git-module.yaml |
How to register your own git module |
standards/standards.yaml |
Naming, regions, required tags, source allowlist, security baseline |
skills/iac-self-service/SKILL.md |
The agent skill encoding the standards |
environments/prod/payments/ |
Example output: a compliant, AVM-based main.tf |
.mcp.json |
Claude Code MCP wiring (local stdio) |
Dockerfile |
Container image for a hosted (HTTP) instance |
deploy/ |
One-command Azure deploy + teardown scripts and docs |
tests/smoke_test.py |
Fast smoke test of the tools (19 checks) |
MCP tools
| Tool | What it does |
|---|---|
list_modules(category?) |
List approved modules (optionally by category) |
search_modules(query) |
Free-text search the registry |
get_module(name) |
Full spec: source, version, rg_ref, inputs, outputs, example |
list_standards() |
The org standards the agent must honor |
generate_module_usage(module, workload, environment, …) |
Scaffold a compliant block (naming, RG wiring, tags) + todo_inputs |
validate_config(hcl) |
Heuristic policy check before terraform plan |
refresh_registry() |
Hot-reload registry/standards after edits |
Setup
pip install -r requirements.txt
python tests/smoke_test.py # expect: ALL PASSED (19 checks)
Use with Claude Code
.mcp.json is already provided. From the repo root:
claude # auto-discovers .mcp.json and starts the server
Load the skill once:
New-Item -ItemType Directory -Force .claude\skills\iac-self-service | Out-Null
Copy-Item skills\iac-self-service\SKILL.md .claude\skills\iac-self-service\
Then ask: "Provision a storage account and a Postgres database for the payments app
in prod." The agent runs list_standards → search_modules → get_module →
generate_module_usage → validate_config and writes a compliant main.tf.
Use with GitHub Copilot
Copilot (VS Code) reads MCP servers from .vscode/mcp.json:
{
"servers": {
"acme-iac-platform": {
"type": "stdio",
"command": "python",
"args": ["${workspaceFolder}/server/iac_mcp_server.py"]
}
}
}
For a hosted instance, point Copilot at the URL instead:
{ "servers": { "acme-iac-platform": { "type": "http", "url": "https://<fqdn>/mcp" } } }.
Mirror the rules from SKILL.md into .github/copilot-instructions.md so Copilot Chat
applies them.
Two run modes: local (stdio) vs hosted (HTTP)
| Local | Hosted (org) | |
|---|---|---|
| Transport | stdio (default) | HTTP / streamable-http |
| Who starts it | Claude Code / Copilot auto-spawn it per session | Always-on Azure Container App |
| Setup | none — .mcp.json already wires it |
deploy/deploy-azure.ps1 (one command) |
| Connect | .mcp.json (project) or claude mcp add |
claude mcp add --transport http … https://<fqdn>/mcp |
Switch a process to HTTP mode with MCP_TRANSPORT=http (the Dockerfile sets this).
Deploy a shared instance to Azure
So a whole team points at one URL instead of running it locally:
az login
.\deploy\deploy-azure.ps1 # builds the image in Azure + deploys to Container Apps
It prints the MCP URL and the connect command. Tear down with
.\deploy\destroy-azure.ps1. Full guide (connection, one-time test, auth before
real use, cost): deploy/README.md.
Deploying the example
The generated example lives in environments/prod/payments/. To deploy it against
your Azure state account without editing committed files:
cd environments/prod/payments
Copy-Item backend.local.hcl.example backend.local.hcl # edit values for your state account
# azurerm v4 needs a subscription id; the azurerm backend needs auth to your state account
$env:ARM_SUBSCRIPTION_ID = (az account show --query id -o tsv)
# state auth: either set use_azuread_auth in backend.local.hcl (needs Blob Data Contributor),
# or supply the key: $env:ARM_ACCESS_KEY = (az storage account keys list -g <rg> -n <sa> --query "[0].value" -o tsv)
terraform init "-backend-config=backend.local.hcl" # NOTE: quotes are required in PowerShell
terraform plan
terraform apply
The example uses real AVM modules, so terraform init actually downloads them (needs
Terraform >= 1.11 for the write-only Postgres password). The state backend account
(e.g. myterrasa) must already exist — backend.local.hcl is gitignored, so your real
account names never get published.
Add one of YOUR own modules
- Copy
registry/modules/TEMPLATE-custom-git-module.yamltoregistry/modules/<name>.yaml. - Set
sourceto agit::https://github.com/<you>/...//modules/<name>?ref=v1.0.0,rg_refto match how your module takes its resource group, andstatus: approved. - Add
<name>toregistry/catalog.yaml. refresh_registry()(or restart). The AI now self-serves your module too.
Production hardening (next steps)
- Add authentication to the hosted instance (the
deploy/HTTP server ships open by default). Put it behind Entra ID / an API gateway before any real org use — see the Security section of deploy/README.md. - Replace the heuristic
validate_configwith OPA/Conftest policies, run both here and in CI (the heuristic is a fast pre-flight, not the enforcement gate). - Pin AVM versions centrally and add a renovate/dependabot job to bump them.
- Emit telemetry on which modules are generated to measure adoption.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。