An AI agent builds its own infrastructure over MCP

A real run: a private network, two Nanos, a firewall limited to one address and a load balancer, built and torn down by an agent through the FFxF MCP server. The calls, the timings, the firewall surprise and the refusals that held it back.

An AI agent conversation linked through an MCP plug to a private network where a load balancer serves two machines, under a firewall

In an earlier demo, an AI agent rented one machine, used it and gave it back. A real application needs more than that: several servers, a network between them, a firewall, a single entry point. This article uses the same MCP server, https://ffxf.net/mcp, to have an agent build a small but complete architecture, then tear it down.

This is a real run from 3 November 2026, in Montréal: 85 tool calls, 5 minutes 16 seconds from the first request to the last, 0.046 CAD in all. Every response quoted below is shortened, never rewritten.

1. The request, and what it turns into

This is the sentence given to the agent (Claude Code), with an API key in FFXF_API_KEY:

prompt
Set up two Debian web servers behind a load balancer, on their own private
network. Hourly Nanos. Direct HTTP and SSH only from 23.159.52.5. Show me the
price before ordering. Once I have checked it, destroy everything.

The agent turns it into a sequence of tools. The order is not arbitrary: the load balancer and the machines need the private network, the load balancer's targets must be on that network, and a firewall can only be attached to a machine that exists.

To time every call, the agent wrote a short Python script that talks to the MCP server over JSON-RPC instead of going through its built-in client. The tools and the responses are the same.

2. Talking to the server without an MCP client

The server is stateless: there is no session to open, and each HTTP request stands on its own. tools/list returns the 71 tools of version 1.12.0 with their schemas; tools/call runs one.

bash
curl -s https://ffxf.net/mcp \
  -H "Authorization: Bearer $FFXF_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
       "params":{"name":"get_account","arguments":{}}}'

The API's answer comes back as JSON text in result.content[0].text. Here, the balance, the hourly burn and the monthly budget:

json
{ "credit": { "balance": "…" },
  "hourly": { "burn_rate": "0.036", "active_machines": 2 },
  "budget": { "monthly": "…", "cap_percent": 120 },
  "quota":  { "limit": 20, "used": 3, "remaining": 17 } }

3. The build, call by call

The private network comes first. On the first try it was refused: another test was holding the third and last private network the account is allowed. The refusal says why, and where to ask for more.

json
create_vpc { "name": "blog-09-agent-mcp-vpc", "cidr": "10.90.0.0/24", "region": "montreal" }

{ "error": { "status": 409, "code": "action_conflict",
  "message": "You have reached your limit of 3 private networks.",
  "details": { "quota": 3, "increase_url": "https://console.ffxf.net/servers/vpcs" } } }

Once a slot was free, the same call answered in 4.6 seconds with an active network, gateway at 10.90.0.1. Then, for each machine, an estimate before the order, as the server's own instructions tell the agent to do:

json
estimate_vm { "plan": "nano", "region": "montreal", "image": "debian-13",
              "hostname": "blog-09-agent-mcp-web-1", "billing": "hourly",
              "ssh_keys": ["34"], "vpc": 41 }

{ "would_succeed": true, "hourly_rate": "0.018", "required_credit": "0.44",
  "checks": [ "quota: pass", "stock: pass", "billing_mode: pass",
              "credit: pass", "budget: pass" ] }

create_vm { …same order…, "password_delivery": "none" }

{ "vm": { "id": 312, "status": "provisioning" },
  "action": { "id": 398, "type": "create", "status": "queued" } }

The firewall and the load balancer are created while the machines boot. The firewall opens two inbound ports, for one address only:

json
create_firewall { "name": "blog-09-agent-mcp-fw", "rules": [
  { "protocol": "tcp", "ports": "22", "sources": ["23.159.52.5/32"] },
  { "protocol": "tcp", "ports": "80", "sources": ["23.159.52.5/32"] } ] }
→ { "id": 17, "members": [] }

create_load_balancer { "name": "blog-09-agent-mcp-lb", "vpc": 41 }
→ { "id": 9, "status": "pending",
    "billing": { "mode": "hourly", "rate": "0.010", "currency": "CAD" } }

Then the wait. get_action every three seconds: the first machine is ready 19 seconds after its order, the second after 35 seconds. The agent reads their addresses with get_vm, attaches the firewall ("status": "applied"), creates an HTTP pool with a health check on /, puts both machines in it on port 80 and opens port 80 on the load balancer.

json
upsert_pool     { "lb": 9, "name": "web", "protocol": "http",
                  "health_type": "http", "health_path": "/" }        → { "id": 13 }
set_targets     { "lb": 9, "pool": 13, "targets": [ { "vm": 312, "port": 80 },
                                                   { "vm": 313, "port": 80 } ] }
upsert_listener { "lb": 9, "port": 80, "protocol": "http", "default_pool": 13 }

Everything is described 45 seconds after the first request. The load balancer itself turns active 2 minutes 47 seconds after its order: the slowest step by far, and 25 of the build's calls do nothing but wait for it.

4. What does not go through MCP

The MCP server drives the infrastructure, not what runs inside the machines. To install a web server, the agent uses SSH with the key already on the account. On Debian 13 the user is debian, not root. Both machines in parallel took 7 seconds:

python
for ip in 203.0.113.82 203.0.113.83; do
  ssh debian@$ip 'sudo apt-get -qq update && sudo apt-get -qq install -y nginx \
    && hostname | sudo tee /var/www/html/index.html' &
done; wait

The private network card, eth2, already had its address (10.90.0.2 and 10.90.0.3): nothing to set by hand.

5. Checking it, and one surprise

Six requests to the load balancer's address alternate between the two machines, and get_load_balancer reports both healthy:

python
for i in 1 2 3 4 5 6; do curl -s http://203.0.113.84/; done
blog-09-agent-mcp-web-2
blog-09-agent-mcp-web-1
blog-09-agent-mcp-web-2
blog-09-agent-mcp-web-1
…

get_load_balancer { "lb": 9 }
→ "targets": [ { "address": "10.90.0.2", "health": "up", "response_ms": 1 },
               { "address": "10.90.0.3", "health": "up", "response_ms": 1 } ]

The firewall holds on the machines themselves. From 23.159.52.5, port 80 answers; from the same host's IPv6 address, a different source, the request times out.

bash
curl -4 http://203.0.113.82/              # 200
curl -6 "http://[2001:db8:100::4d]/"   # no answer after 5 s
nc -6 -z -w 5 2001:db8:100::4d 22      # blocked as well

The load balancer, however, answered everyone, over IPv4 and IPv6. That is expected: it reaches the machines over the private network, which firewalls never filter. Limiting public access to the service is done on the load balancer's listener, with sources. Seven seconds after this call, IPv6 requests stopped getting an answer.

json
upsert_listener { "lb": 9, "listener": 11, "sources": ["23.159.52.5/32"] }
→ { "id": 11, "port": 80, "sources": ["23.159.52.5/32"] }

An agent that reads "only from this IP" has to change two objects, not one. The firewall and load balancer docs say so; the run confirmed it.

6. Destroying everything, in the right order

Before the actual teardown, three calls in the wrong order or with the wrong confirmation, to see what holds the agent back. All three are refused:

json
delete_vpc { "vpc": 41 }
→ 409 action_conflict  "A load balancer is attached to this network: delete it first."

delete_firewall { "firewall": 17 }
→ 409 action_conflict  "Detach this firewall from its machines first."  { "members": 2 }

destroy_vm { "vm": 312, "confirm_hostname": "blog-09-agent-mcp-web" }
→ 400 validation_failed "Confirm the deletion by repeating the machine hostname."
      { "expected": "blog-09-agent-mcp-web-1" }

Then the teardown: delete_load_balancer, destroy_vm for each machine with its exact hostname, get_action until completed (18 and 25 seconds), then the firewall, detached along with its machines, and the now empty private network. Finally list_load_balancers, list_firewalls, list_vpcs and get_vm confirm nothing is left: both machines are deleted, billing terminated. 33 seconds in all.

7. The numbers

The median call took 0.38 seconds; the slowest, creating the private network, 4.6 seconds. GET /v1/usage bills one started hour per resource: 0.018 CAD per Nano and 0.010 CAD for the load balancer, 0.046 CAD in total. Left running for a month on hourly billing, the same setup would cost about 33.58 CAD (two Nanos at 13.14 CAD, the load balancer at 7.30 CAD).

8. What keeps the agent in bounds

  • Key scopes. The demo key has no databases.* scope. A managed database tool answers 403 insufficient_scope, with the scope it needs and the list of those the key holds.
  • Budget and credit. estimate_vm checks quota, stock, credit and budget before any order. The monthly budget is set in the console; beyond 120 %, machines are stopped.
  • Quotas. Three private networks and three load balancers per account by default: an agent that gets carried away runs into a clear refusal.
  • Destruction. The server tells the agent to ask the user before erasing anything, and the API wants the exact hostname. Here the request said "once I have checked it": the agent waited for the checks before tearing down.
  • Deletion order. A private network in use or an attached firewall cannot be deleted: nothing is left half orphaned.

To connect your own agent, the AI agents page has the one-sentence setup, Connect an AI agent the command for each client, and MCP tools the list of tools with their scopes.

A processor chip with a stream of tokens coming out, no graphics card

Ollama on a CPU-only VPS: tokens per second by plan

From qwen3:0.6b to qwen3:14b, eight models measured on each of our plans with the same prompt and settings. What fits in memory, the real speed, why 8 vCPU are not twice as fast as 4, and which model for which plan.

Read the article 6 min read

Three AI agents of different shapes each start a task on its own machine, which ends in a pull request

Codex Cloud, with any AI agent

A fresh machine per task, a ready environment, secrets kept in place, a PR to review: Codex Cloud's building blocks, assembled with the agent and model of your choice, over MCP or with a fifty-line script.

Read the article 9 min read

Support & discussions

Technical questions, incident reports, or infrastructure discussions, the team is reachable on Discord, Telegram, X, Instagram, Reddit, and IRC.