Headless App Deployment with MCP: How AI Agents Push, Preview, and Ship Apps Without a Dashboard
Headless app deployment means an agent takes an app from prompt to production with no one clicking through a dashboard. This guide covers nexusai_builder_push and nexusai_builder_pull in detail, then walks through the full MCP deploy, monitor, and rollback lifecycle end to end.
By NEXUS AI Team • • Tutorial
What headless app deployment actually means
Most "AI app builders" still expect a person in the loop: open a browser, click Deploy, wait for a progress bar. Headless app deployment removes that step entirely. Every action in the lifecycle, from writing the first file to rolling back a bad release, happens through a tool call an agent can make on its own, with no dashboard tab ever required to open.
NEXUS AI exposes its full app lifecycle, generation, live preview, container builds, deployment, logs, health checks, scaling, and rollback, as MCP (Model Context Protocol) tools with structured, AI-readable responses. That means a conversation with Claude, Cursor, Codex, or a custom MCP client can start with a one-line prompt and end with a running production app and a public URL, without a human touching a UI in between.
This guide covers the two tools that make headless deployment possible, nexusai_builder_push and nexusai_builder_pull, then walks through the complete headless workflow: generate, preview, deploy, operate.
The headless preview layer: nexusai_builder_push and nexusai_builder_pull
Before an app deploys, it usually needs a preview. In a normal AI app builder, that preview only exists inside a browser tab a person is looking at. Headless deployment needs the same preview, but reachable from a tool call instead of a click.
nexusai_builder_push takes a projectId and an array of files, each with a path and full content (not a diff), plus an optional note. It writes those files into that project's Builder session and returns:
{
"sessionId": "bld_8f2a1c",
"builderUrl": "https://nexusai.run/projects/proj_419/builder",
"filesCount": 6,
"snapshotMessageId": "msg_a91f"
}
The builderUrl is a live, in-browser preview a person can open at any point, but the agent never has to open it itself to keep working. Every push is a restorable checkpoint, so nothing from an earlier round is ever lost.
nexusai_builder_pull takes just a projectId and reads the latest file snapshot back, including any changes a person made by hand in the browser UI. This is what keeps an agent-authored app and a human-edited one in the same conversation instead of forking into two versions: an agent can push a first draft, a designer can nudge the layout in the browser, and the agent's next nexusai_builder_pull call sees that edit before writing another line of code.
Used together, these two tools form a loop: push files, get a preview URL, optionally pull back changes, repeat, all without a dashboard.
Step 1 — Generate the files from a prompt
An MCP-compatible agent starts the same way a person would in the AI App Builder: with a description of the app. The difference is that instead of typing into a chat window inside NEXUS AI, the agent is already inside its own conversation (Claude, Cursor, Codex, or a custom client) and generates the file set itself, in memory, based on the prompt.
There is no NEXUS AI-specific step here. This is ordinary code generation. The headless part starts at the next step.
Step 2 — Push to a live preview with nexusai_builder_push
Once the files exist, the agent calls nexusai_builder_push with the target projectId and the generated files:
{
"tool": "nexusai_builder_push",
"arguments": {
"projectId": "proj_419",
"files": [
{ "path": "app/page.tsx", "content": "export default function Page() { ... }" },
{ "path": "app/api/tasks/route.ts", "content": "export async function GET() { ... }" }
],
"note": "Initial generation: task list with a Postgres-backed API route"
}
}
The response includes the builderUrl. The agent can hand that URL straight back to the person it's working for, "here's a live preview," without NEXUS AI, the agent, or the person needing to spin up any infrastructure. Nothing is deployed yet; this is a sandboxed, in-browser preview only.
Step 3 — Pull back any edits with nexusai_builder_pull
If a person opens the builderUrl and tweaks something by hand, the agent's next move before writing more code should be:
{
"tool": "nexusai_builder_pull",
"arguments": { "projectId": "proj_419" }
}
This returns the current file snapshot, browser edits included. The agent now has the real, current state of the project before it generates the next round of changes or decides the app is ready to ship. Skipping this step is the single most common way an agent silently overwrites a person's manual fix.
Step 4 — Deploy and operate without opening a dashboard
Once the preview looks right, the same MCP session moves straight into deployment. No context switch, no separate dashboard login, just more tool calls in the same conversation:
| Tool | What it does |
|---|---|
nexusai_deploy_create |
Builds a container from the current project state and ships it, provisioning any declared database, worker, or storage resources |
nexusai_deploy_logs |
Streams build and runtime logs to confirm the deploy came up clean |
nexusai_deploy_health |
Checks whether the running service is passing health checks |
nexusai_deploy_scale |
Adjusts replica count or resources |
nexusai_deploy_rollback |
Reverts to a previous deployment if something breaks |
A full headless round trip looks like this in practice:
- Agent generates files →
nexusai_builder_push→ gets a preview URL - Person reviews it (optional) → agent calls
nexusai_builder_pullif anything changed - Agent calls
nexusai_deploy_create→ app builds and gets a public HTTPS URL - Agent calls
nexusai_deploy_logsandnexusai_deploy_health→ confirms it's actually up - Days later, a bad change ships → agent calls
nexusai_deploy_rollback→ previous version is live again
At no point in that sequence does a browser dashboard have to open. It can, at any point, for a human who wants to look, but it is never a required step.
Governance doesn't disappear just because the dashboard does
A reasonable worry with headless workflows is losing visibility into what an agent actually did. NEXUS AI headless deployments use the same OAuth-scoped access tokens and role-based permissions as dashboard use, scoped to exactly the actions a given token is allowed to take. Every tool call an agent makes, pushes, pulls, deploys, scales, rolls back, is written to the audit log with the acting identity and a timestamp. A headless deployment is still a fully attributable one; it just doesn't require a person to be the one clicking the buttons.
Try it now: connect an MCP-compatible client to NEXUS AI and ask it to push a small app to a preview with nexusai_builder_push, then deploy it with nexusai_deploy_create, all from the same conversation.
Frequently asked questions
What is headless app deployment?
Headless app deployment is shipping and operating an application entirely through programmatic tool calls, with no person clicking through a web dashboard. An AI agent generates the code, previews it, deploys it, and manages it afterward using API or MCP calls end to end.
How is headless deployment different from using the AI App Builder in a browser?
The underlying platform is the same. The difference is who drives it. In the browser, a person opens the Builder, reviews the preview, and clicks Deploy. In a headless workflow, an MCP-compatible agent calls the same underlying actions, nexusai_builder_push for a preview, nexusai_deploy_create to ship it, as tool calls inside its own conversation, so no dashboard interaction is required at any point.
What does nexusai_builder_push actually return?
It returns a sessionId for the Builder session, a builderUrl for an instant browser preview, a filesCount confirming how many files were written, and a snapshotMessageId identifying that push as a restorable checkpoint.
Can nexusai_builder_pull lose an agent's own changes?
No. Pulling reads the latest snapshot, which includes both agent-pushed files and any browser-side edits layered on top. It does not discard prior pushes; each push remains a separate, restorable checkpoint in the session history.
Is a headless deployment less secure than a dashboard deployment?
No. Headless workflows authenticate with the same OAuth-scoped access tokens and role-based permissions as dashboard sessions, and every tool call is written to the audit log with the acting identity and timestamp, so a headless deployment is fully attributable after the fact.
NEXUS AI — AI-native cloud infrastructure · nexusai.run