Server4Agent

Getting started

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.

Endpoints. REST API at 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.

mcp.config.json
{
  "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.

agent → MCP tool
// 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)
provision.sh
# 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.

task.sh
# 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.

deployment.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.

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.

MCP setup