---
title: "Netlify for Coding Agents: Build and Ship a Full App"
description: "A reference for coding agents using Netlify CLI, Database, Async Workloads, AI Gateway, and the Netlify MCP server."
source: "https://www.netlify.com/knowledge-base/netlify-for-coding-agents/"
last_updated: "2026-07-24T12:51:21.000Z"
---
An agent that writes an app can also provision its backend and ship it, without a human clicking through a dashboard. Netlify exposes each primitive through a CLI command, an SDK, or the MCP server, and every step returns structured output an agent can parse. This reference maps the full build-and-ship flow: authenticate, publish, add data and compute, call models, and connect the MCP server so an agent can drive Netlify directly.

It assumes you have read [Publishing and updating live sites with the Netlify CLI](https://www.netlify.com/guides/publish-and-update-sites-with-the-netlify-cli/), which covers the deploy loop in detail. This page is the wider map: what else an agent can reach, and how.

## Authenticate once, non-interactively

Generate a personal access token and pass it as an environment variable so every command runs without a browser login:

```
export NETLIFY_AUTH_TOKEN=your_token_value
```

Scope the token to the narrowest access the task needs rather than reusing a full-access token across agents.

## Publish and update a live site

Build your output, then deploy the folder and read the URL back as JSON:

```
URL=$(netlify deploy --dir=dist --no-build --prod --json | jq -r '.url // .deploy_url')
```

Re-running the same command against the same site ships a revision to the same URL. Each deploy is an immutable snapshot, so a bad revision rolls back instantly. For throwaway output, `netlify deploy --allow-anonymous` returns a claimable URL with no account, though Netlify removes unclaimed sites after one hour. The [CLI publishing guide](https://www.netlify.com/guides/publish-and-update-sites-with-the-netlify-cli/) covers the stateless patterns an agent needs.

## Add a database

Provision managed Postgres with one command:

```
netlify db init
```

That installs `@netlify/database` and scaffolds migrations under `netlify/database/migrations/` (add `--boilerplate=drizzle` for a Drizzle starter). Netlify provisions the instance and applies migrations on deploy. Each agent run gets its own database branch off production data, so you can change schema and data in isolation before you publish. See [Netlify Database](https://docs.netlify.com/build/data-and-storage/netlify-database/).

## Add request and background compute

Write request handlers as [Netlify Functions](https://docs.netlify.com/build/functions/overview/) (JavaScript, TypeScript, or Go) with a Web-standard `Request`/`Response` signature and a `config.path`. For work that should outlive a request, reach for [Async Workloads](https://docs.netlify.com/build/async-workloads/overview/): an event-triggered function with durable, retryable steps. An agent building a checkout flow can put the API in a Function and the charge-fulfill-notify sequence in a workload, with no queue to stand up. Object storage comes from [Netlify Blobs](https://docs.netlify.com/build/data-and-storage/netlify-blobs/) with zero setup.

## Call models through the AI Gateway

The [AI Gateway](https://docs.netlify.com/build/ai-gateway/overview/) lets your code call OpenAI, Anthropic, and Google models through their official SDKs with no provider keys. Netlify injects `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, and the matching base URLs into every compute context, and bills token usage to your Netlify credits:

```
import OpenAI from 'openai';const openai = new OpenAI(); // credentials injected by the AI Gateway
const reply = await openai.chat.completions.create({  model: 'gpt-5',  messages: [{ role: 'user', content: prompt }],});
```

The Gateway activates after the first production deploy. An agent that generates an app calling a model can therefore ship it without ever handling a secret.

## Connect the MCP server

The [Netlify MCP server](https://docs.netlify.com/welcome/build-with-ai/netlify-mcp-server/) gives an AI assistant direct access to Netlify: creating deploys, managing Functions and Edge Functions, provisioning Blobs and Netlify Database, editing `netlify.toml`, setting environment variables, and calling the AI Gateway. Add the remote server:

```
npx -y add-mcp https://netlify-mcp.netlify.app/mcp
```

One-click installers exist for Cursor, LM Studio, and VS Code. With the MCP server connected, an agent runs Netlify operations as tool calls instead of shelling out to the CLI.

## Or hand the whole task to an Agent Runner

Netlify can also host the agent. [Agent Runners](https://docs.netlify.com/build/build-with-ai/agent-runners/overview/) run Claude Code, OpenAI Codex, or Google Gemini against your project with its context, environment variables, and build settings already in scope. Start one from the CLI:

```
netlify create agents
```

Each run works on its own branch, gets a Deploy Preview and an isolated database branch, and lets you review changes before they reach production. Agent Runners need a GitHub-connected repository for continuous deployment; GitLab, Bitbucket, and Azure DevOps are not supported for that path.

## The full loop

An agent can take a task from prompt to production entirely through these interfaces:

1.  **Provision:** `netlify db init` for data, Functions and Async Workloads for compute, Blobs for storage.
2.  **Build:** generate the app; call models through the AI Gateway with no keys.
3.  **Ship:** `netlify deploy --prod --json` and hand the URL back.
4.  **Revise:** rebuild and redeploy to the same URL; roll back if needed.

Every step is a command or an SDK call with structured output, which is what makes Netlify legible to an agent rather than a series of dashboard screens.

## Resources

-   [Publishing and updating live sites with the Netlify CLI](https://www.netlify.com/guides/publish-and-update-sites-with-the-netlify-cli/)
-   [Netlify Database](https://docs.netlify.com/build/data-and-storage/netlify-database/), [Async Workloads](https://docs.netlify.com/build/async-workloads/overview/), and [Blobs](https://docs.netlify.com/build/data-and-storage/netlify-blobs/)
-   [AI Gateway](https://docs.netlify.com/build/ai-gateway/overview/)
-   [Netlify MCP server](https://docs.netlify.com/welcome/build-with-ai/netlify-mcp-server/)
-   [Agent Runners](https://docs.netlify.com/build/build-with-ai/agent-runners/overview/)