3-minute quickstart
Connect Server4Agent to an MCP-compatible host, give your agent an API key, and let it provision a persistent server it can build on. Your account budget cap keeps spending in check.
https://api.server4agent.com. MCP at https://mcp.server4agent.com (a dedicated subdomain, not a path under the API host).0. Connect MCP
Add Server4Agent to your MCP-compatible host with one config block. Use a scoped API key from your dashboard, then keep the same endpoint across clients.
{
"mcpServers": {
"server4agent": {
"url": "https://mcp.server4agent.com",
"headers": {
"Authorization": "Bearer $SERVER4AGENT_API_KEY"
}
}
}
}1. Provision a server
The agent asks for a server. Over MCP it's a single tool call; over HTTP it's one request authenticated by its API key. There is no plan to choose.
// Your agent calls the create_server MCP tool (no arguments, no plan)
{ "tool": "create_server", "arguments": {} }
// → { "id": "srv_2k9", "tier": "small", "status": "running", "url": null }
// (the public URL arrives once the agent deploys)# Or provision over HTTP, authenticated by the agent's API key
curl -X POST https://api.server4agent.com/servers \
-H "Authorization: Bearer $SERVER4AGENT_API_KEY"
# → { "id": "srv_2k9", "url": null, "status": "running", "tier": "small" }2. Give it a goal
Send a task to the server. The build agent plans, writes code, and runs it inside the persistent workspace.
# Give the agent's server a goal, it plans, writes code, and runs it
curl -X POST https://api.server4agent.com/servers/srv_2k9/tasks \
-H "Authorization: Bearer $SERVER4AGENT_API_KEY" \
-d '{ "goal": "Build a landing page with a waitlist form and deploy it." }'
# → { "task_id": "tsk_71a", "status": "running" }3. Ship to a public URL
When the agent deploys, the result is live at *.apps.server4agent.com with managed TLS. Subscribe to webhooks to get the URL the moment it's live.
# When the task finishes, the deployment is live at a public URL
# (you can also receive it via a deployment.live webhook)
{
"event": "deployment.live",
"server_id": "srv_2k9",
"url": "https://srv_2k9.apps.server4agent.com"
}4. It persists
The server keeps its workspace and state between tasks. When it is idle, it scales to zero; the next request wakes it again.
Start from your own code
Instead of building from a goal, seed a project from a git repo or an uploaded archive. Server4Agent clones or unpacks it, then the on-server agent installs dependencies, starts the app, and confirms the service is up — you supply the code, it figures out how to run it. Watch init_phase move to ready. Pass any env the code needs as secrets (write-only); anything it needs that you didn't provide pauses bring-up at awaiting_secrets with the list of keys.
# Or seed a project from your own repo and let it come up on its own
curl -X POST https://api.server4agent.com/servers/srv_2k9/projects \
-H "Authorization: Bearer $SERVER4AGENT_API_KEY" \
-d '{ "name": "checkout-service",
"source": { "kind": "git",
"git_url": "https://github.com/your-org/checkout-service" },
"secrets": [ { "key": "DATABASE_URL", "value": "postgres://…" } ] }'
# → { "id": "proj_9f2", "init_run_id": "tsk_c40", "init_phase": "seeding" }
# The on-server agent installs, starts, and healthchecks it. Poll
# GET /projects/proj_9f2 until init_phase = "ready" (or use the
# project.ready webhook) — the service is then up on its project URL.
#
# If the code needs env you didn't provide, it stops at "awaiting_secrets"
# with a required_secrets list; PUT /projects/proj_9f2/secrets to supply them
# and bring-up resumes.Runnable examples
Every step above exists as a zero-dependency script you can clone and run: MCP and REST quickstarts plus three template walkthroughs live in the examples directory on GitHub.
Next: MCP server→Connect an agent
Create a key, paste the MCP config, and give your agent a persistent server it can build on.