# How to provision a server with an AI agent

Source: https://docs.quake.ai/resources/ai-assisted-development/quickstart-with-ai-agent
Markdown: https://docs.quake.ai/resources/ai-assisted-development/quickstart-with-ai-agent.md
> Drive an AI coding assistant connected to the Quake AI MCP server to provision a running server: prompt the agent, review the generated OpenTofu, and apply it yourself.

---

# How to provision a server with an AI agent

This guide provisions a public server on Quake AI by driving an AI coding assistant, rather than clicking through the Console. It reaches the same result as the [Quickstart](/docs/quickstart): a running instance you can reach over SSH at a public IP. The difference is the path. You prompt your assistant, it retrieves an OpenTofu template from the hosted MCP server, you review the generated configuration, and you apply it with your own credentials.

You stay in control of every change to your cloud. The assistant drafts the infrastructure code; you read it and run `tofu apply` yourself.

## Before you start

- An AI coding assistant with the Quake AI MCP server connected. Follow [How to connect AI tools to Quake AI docs](/resources/ai-assisted-development/ai-assisted-development) first. Cursor, Claude Desktop, Claude Code, and VS Code (Copilot agent mode) all work.
- [OpenTofu](https://opentofu.org/docs/intro/install/) (or Terraform) installed on your workstation.
- A Quake AI account with [app credentials generated and sourced](/docs/tools/generate-app-credentials) in your shell.
- An [SSH keypair already uploaded to your project](/docs/tools/add-ssh-key). You pass its name to the template.

## How the flow works

<Figure caption="The agent-driven provisioning loop: you prompt, the assistant retrieves the template, you review, you apply">

```mermaid
sequenceDiagram
    accTitle: Agent-driven provisioning loop
    accDescr: You prompt your assistant. The assistant calls the get_template tool on the Quake AI MCP server, which returns the simple-vm OpenTofu template. The assistant returns the generated configuration to you. You review the HCL, then run tofu apply against your own project to provision the server and its floating IP.
    participant You
    participant Agent as AI assistant
    participant MCP as Quake AI MCP server
    participant Cloud as Your Quake AI project
    You->>Agent: "Provision a public web server"
    Agent->>MCP: get_template (service: compute)
    MCP-->>Agent: simple-vm OpenTofu
    Agent-->>You: generated configuration
    You->>You: review the HCL
    You->>Cloud: tofu apply
    Cloud-->>You: running server + floating IP
```

</Figure>

The assistant does not reach your cloud. It retrieves a template and generates configuration text. The connection to your project happens only when you run `tofu apply` against your sourced credentials.

## 1. Prompt your assistant

In your assistant's chat, ask it to provision a server. A direct request is enough:

> Provision a public web server on Quake AI using OpenTofu. Pull the template from the Quake AI MCP server.

The assistant calls the MCP server's `get_template` tool for the `compute` service. The server returns the `simple-vm` template, which the assistant uses to write a working OpenTofu configuration into your project. For the tool's inputs and return shape, see the [AI tools reference](/resources/ai-assisted-development/ai-tools-reference).

## 2. Review the generated configuration



`tofu apply` creates real resources in your Quake AI project under your own credentials. Read the generated OpenTofu before you run it, the same way you would review any code an assistant produces.



The `simple-vm` template provisions:

- A private network, subnet, and router connected to the `PublicStatic` external network.
- A security group that allows inbound SSH (TCP 22) and HTTP (TCP 80) from any address.
- A boot-from-volume instance (20 GiB volume, `Ubuntu-24.04`, `s1a.small` flavor by default).
- A floating IP from the `PublicStatic` pool, associated with the instance.

Confirm two values before applying:

- `key_name` matches an SSH keypair that already exists in your project. The template requires it and has no default.
- The flavor and image suit your needs. The defaults are `s1a.small` and `Ubuntu-24.04`; ask the assistant to change them if you want something else.

If you want a tighter SSH rule, ask the assistant to restrict the security group's SSH source to your workstation's public address instead of `0.0.0.0/0`.

## 3. Apply the configuration

With your credentials sourced, initialize and apply from the template directory:

```bash
tofu init
tofu plan
tofu apply
```

Review the plan output, then type `yes` to confirm. OpenTofu prints the instance's public address as the `floating_ip` output when the apply completes.

## 4. Connect to the server

Use the `floating_ip` value to connect:

```bash
ssh ubuntu@FLOATING_IP
```

Replace `FLOATING_IP` with the address from the apply output. Type `yes` to accept the host key. Your prompt changes to the instance hostname, which confirms the server is up and reachable. To serve a page from it, follow [step 5 of the Quickstart](/docs/quickstart#5-serve-a-page).

## 5. Clean up

A public server should not run unattended. Remove everything the template created:

```bash
tofu destroy
```

Type `yes` to confirm. OpenTofu removes the instance, floating IP, security group, router, subnet, and network.

## Next steps

- [Launch handoff](/resources/ai-assisted-development/launch): declare an application in `quake.yaml`, validate it through the MCP server, and produce a handoff packet for deployment.
- [Quickstart](/docs/quickstart): the same outcome by hand, through the Console, CLI, or OpenTofu.
- [Simple VM template](/resources/iac-templates/simple-vm): the full reference for the template the assistant retrieves.
- [Automation how-tos](/docs/automation/how-to/): IaC patterns, CI integration, and template usage.
