Terraform MCP serverand Python AI tasks
qbash hosts a Terraform MCP server you can use in Claude, ChatGPT, Codex, Cursor, Grok Bot and Muse. Developers use qbash Tasks to write cloud-hosted Python functions that pair Terraform with models such as Claude and GPT.
Add the qbash MCP
Use Terraform from Claude Code, Codex, Cursor and other MCP clients. Connect Terraform in qbash, and your agent can work with its data and build Tasks that call it.
claude mcp add --transport http qbash https://mcp.qbash.com/mcp
Then run /mcp in Claude Code and sign in with qbash.
- List organizations, workspaces and projects
- Read a workspace's settings, lock state and latest run
- Read runs with their plans and applies
- Read configuration versions, state versions and state outputs
- Read workspace variables, variable sets and notification configurations
- Create and update workspaces and workspace variables
Write a Terraform task in Python
A qbash Task is a Python function hosted in the cloud. Python is the runtime and defines the process, and built-in inline prompts run on leading models such as Claude, GPT, Gemini and Grok.
Run a Task on a schedule, from an HTTP request or when a connected app sends an event. Your agents and chat tools call it over MCP.
Each run is logged with its inputs and results, and you can turn data logging off for any Task. Every Task has version control, and each run is locked to the version it ran.
Review errored Terraform runs
List the runs that errored in one workspace, then ask an inline prompt to group them by message and say what to check first.
report = qbash.integrations.terraform.list_runs(
workspace_id="ws-vCp9wkvsNBZ4eZGs",
status=["errored"],
page_size=20,
)
runs = report.get("runs", [])
if runs:
review = qbash.ai.run_prompt(
slug="terraform-errored-run-review",
variables={"runs": json.dumps(runs)},
)
qbash.output({"review": review, "more_available": bool(report.get("next_cursor"))})
else:
qbash.output("No runs errored in this workspace.")
Sample list_runs response
{
"runs": [
{
"id": "run-CZcmD7eagjhyX0vN",
"type": "runs",
"status": "errored",
"message": "Tighten egress rules on the app subnet",
"source": "tfe-api",
"created_at": "2026-11-12T03:21:07.000Z",
"has_changes": true,
"plan_only": false,
"is_destroy": false,
"auto_apply": false,
"relationships": {
"plan": "plan-8F5JFydVYAmtTjET",
"workspace": "ws-vCp9wkvsNBZ4eZGs"
}
},
{
"id": "run-Lm3xQ9vTrB2uYkWe",
"type": "runs",
"status": "errored",
"message": "Upgrade provider versions",
"source": "tfe-ui",
"created_at": "2026-11-11T22:05:40.000Z",
"has_changes": false,
"plan_only": false,
"is_destroy": false,
"auto_apply": false,
"relationships": {
"plan": "plan-Zs6TpN1cJwQ0aVdH",
"workspace": "ws-vCp9wkvsNBZ4eZGs"
}
}
],
"next_cursor": null
}
Custom MCP server
Build a custom MCP server with Terraform
Create a hosted MCP server that combines Terraform tools with your other connectors, Tasks and memory folders. You choose each tool it exposes, so a server can share Terraform reads with write tools left off.
Share the server with your team, and each person adds it to the client they already use.
How to set it up
- Connect Terraform on the qbash Connectors page.
- Create an MCP server and add the Terraform tools you want to share.
- Paste the server URL into your client. It connects with OAuth or an access token.
Terraform MCP questions
Does Terraform have an official MCP server?
HashiCorp publishes hashicorp/terraform-mcp-server, which you can run locally or host yourself. The qbash server puts HCP Terraform on one URL with your other connectors, and the same methods run in Python Tasks.
Can the Terraform MCP server apply or destroy infrastructure?
No. It can queue a plan with create_run, but no method applies, discards, cancels or destroys a run, deletes anything or changes state. Runs are always queued with auto-apply off, so even a workspace with auto-apply on waits for a person to confirm in HCP Terraform.
Which Terraform credentials do I need?
An HCP Terraform API token. On the Free plan, which has no teams, a user token is the practical choice. An organization token cannot start runs or create configuration versions. The connector covers HCP Terraform only, not self-hosted Terraform Enterprise.
Related developer connectors
Build a Terraform task
Write it in Python with AI steps, or describe it to your coding agent through the qbash MCP.