MCP Server Overview and Quickstart
What is MCP?
The Model Context Protocol (MCP) is an open standard that lets AI agents call external tools through a structured, typed interface instead of shelling out to arbitrary commands. An MCP client (an agent like Claude Code, Claude Desktop, Cursor, or Windsurf) launches an MCP server as a subprocess and talks to it over a JSON-RPC transport; the server exposes a fixed set of named tools with declared input schemas, and the agent calls those tools directly with structured arguments instead of parsing free-form CLI output.
What the Terraback MCP server does
terraback mcp exposes Terraback's scan, codify, and verify engine as an MCP server
over stdio, so an MCP-compatible agent can inventory cloud infrastructure and generate
Terraform without shelling out to the CLI. All three cloud providers (AWS, Azure, GCP)
are available from v1, through six tools:
| Tool | Purpose |
|---|---|
scan_infrastructure | Read-only inventory scan of live cloud resources. |
detect_unmanaged | Diff a live scan against local Terraform state to find unmanaged resources. |
codify_resource | Generate Terraform HCL and an import block for one resource. |
codify_batch | Generate Terraform HCL and import blocks for a batch of resources. |
verify_plan | Run a read-only terraform plan and report drift. |
list_supported_resources | List resource types Terraback can scan and codify. |
All six tools are read-only or code-generation-only: none of them import resources into Terraform state or mutate cloud infrastructure. See the Tool Reference for full parameter tables and Agent Workflow for the loop an agent runs to import resources end to end.
Requirements
- Python 3.10 or newer (the
mcpSDK dependency requires it). - Read-only cloud credentials configured in the environment the MCP server process runs in — the tools use the normal ambient credential chain and never accept credentials as arguments. See Security and Credentials.
- Terraform 1.5 or newer, on
PATH, only if you plan to callverify_plan(import blocks require Terraform 1.5+).
Install
pip install terraback
Installing Terraback pulls in the mcp SDK automatically — no separate install step
for the MCP server.
Zero-install trial
To try the server without installing anything into your environment, run it with uvx:
uvx terraback mcp
Register with an MCP client
Claude Code
claude mcp add terraback -- terraback mcp
Project-scoped .mcp.json
Add the server directly to a project's .mcp.json:
{
"mcpServers": {
"terraback": {
"type": "stdio",
"command": "terraback",
"args": ["mcp"]
}
}
}
If the project scans Azure resources, add ARM_SUBSCRIPTION_ID to the server's env
block. MCP clients spawn servers with a limited environment by default, and azurerm
4.x may need the subscription ID set explicitly rather than inherited from az login
context:
{
"mcpServers": {
"terraback": {
"type": "stdio",
"command": "terraback",
"args": ["mcp"],
"env": {
"ARM_SUBSCRIPTION_ID": "<your-subscription-id>"
}
}
}
}
See Troubleshooting if Azure scans fail with a missing subscription error after adding the server this way.
Verify it is wired up
terraback --help
should list an mcp command. Running terraback mcp directly starts the server and
blocks, speaking JSON-RPC over stdio — it is meant to be launched by an MCP client, not
run interactively from a terminal.
First commands an agent will run
Once the server is registered, a typical first exchange looks like:
list_supported_resources— confirm which resource types Terraback can scan and codify for the provider you care about.scan_infrastructure— inventory live resources in a givenprovider+scope(an AWS region, an Azure subscription ID, or a GCP project ID).
From there the agent narrows the scan, generates Terraform with codify_resource or
codify_batch, and verifies the result with verify_plan. The full loop, including
the safety rules an agent should follow, is documented in
Agent Workflow.
Next steps
- Tool Reference: full parameter tables and one example call per tool.
- Agent Workflow: the canonical scan-to-verify loop.
- Security and Credentials: read-only roles per provider and the local-first credential model.
- Licensing and Limits: the Community
codify_batchcap and offline license activation.