Code Mode in Production

3 tools.
Any frontier model.
Real infrastructure.

This server (and a full 3-city HA cluster) was autonomously provisioned, hardened, and deployed using Code Mode. One MCP server replaced 86 individual tools. The model writes code instead of picking from a menu.

The Context Problem

Traditional MCP servers turn every API call into a separate tool. Dozens (or hundreds) of tool definitions get stuffed into the context window on every request — before the model has even seen your question. Want to list servers, pull metrics in parallel, and SSH into several? Dozens of round-trips and a massive token bill.

The Elegant Fix: Code Mode

Inspired by Sunil Pai's talk at Cloudflare. Instead of a giant menu of tools, expose three meta-tools. The model writes JavaScript against a sandbox with real capabilities.

search
Discover
Natural language search over the full method catalog. Returns signatures and descriptions.
execute
Run code
JavaScript executes in a sandbox. Full API client + SSH (run, files, ProxyJump) as globals. Looping, parallelism, state — all in one shot.
describe
Deep docs
Full parameter schemas, examples, and platform gotchas when the model needs precision before writing code.

The model already knows how to write code. Give it the right primitives and it will compose, iterate, and handle state without you hand-holding every step.

Works On

Claude
Gemini
Grok
Codex / OpenAI models

Any frontier model that can write JavaScript can drive serious infrastructure through Code Mode.

What this server proves

1Created via API, SSH hardened, nginx installed + locked down, BinaryLane firewall applied, DNS + TLS provisioned — all driven by code in a single execution flow.
2No separate SSH server. API + remote execution live together in one 3-tool Code Mode server.
3The same pattern built a production 3-city WordPress HA cluster (9 servers, anycast LBs, replication) for $59/month.
View BinaryLane MCP v2 on GitHub →

Firewall Rules (applied via code)

ProtocolPortSourceActionDescription
TCP220.0.0.0/0ACCEPTAllow SSH
TCP800.0.0.0/0ACCEPTAllow HTTP
TCP4430.0.0.0/0ACCEPTAllow HTTPS
ICMP0.0.0.0/0ACCEPTAllow ping
TCP*0.0.0.0/0DROPDeny all other TCP
UDP*0.0.0.0/0DROPDeny all other UDP

Nginx Security Headers (pushed via SSH in the same flow)

Let's Talk

Curious what Code Mode + serious Australian infrastructure can do for your workloads? Book a time.