# Let an AI Agent Deploy a Website

> Connect Claude Code, Codex or Cursor to the Netlify or Vercel MCP server, run a test deploy, and update the same site without a new URL.

## What a Website-Publishing MCP Server Does

An AI agent can deploy a website only if it has access to a host. The Model Context Protocol (MCP) is one way to give the agent that access. The hosting provider runs an MCP server, and your AI client (the app where you use the agent) connects to it. The agent then gets tools to create projects, deploy files and examine the result. The other way is a command-line tool that the agent runs in a terminal.

Two large static hosts publish official MCP servers:

| Host | MCP server URL | Sign-in |
|---|---|---|
| Netlify | `https://netlify-mcp.netlify.app/mcp` | Your Netlify account, authorized when the client prompts you |
| Vercel | `https://mcp.vercel.com` | OAuth with your Vercel account |

The [Netlify MCP server](https://github.com/netlify/netlify-mcp) lets agents create, manage and deploy projects, change access controls, manage environment variables and work with form submissions. [Vercel MCP](https://vercel.com/docs/agent-resources/vercel-mcp) covers projects and deployments, deployment logs, documentation search and Web Analytics. Vercel added a `deploy_to_vercel` tool in July 2026. For Cloudflare Pages and GitHub Pages, agents usually deploy with a command-line tool (CLI), such as Wrangler or git, instead.

A connection has three parts: the server URL, a transport that your client supports, and authorization. The transport is the method that carries the messages. This guide uses Netlify for the examples. Where Vercel is different, the guide shows the Vercel equivalent.

## Start With the Client

A hosted MCP server needs a client that supports:

- Remote MCP servers
- The Streamable HTTP transport
- OAuth sign-in in the browser
- Tool discovery after sign-in

Client interfaces vary. The name of the setting can be MCP server, custom connector, app or tool server. Workspace administrators can also control whether people can add connections.

Vercel MCP accepts only clients that Vercel reviewed. Its list includes Claude Code, Claude.ai and Claude for desktop, ChatGPT, Codex CLI, Cursor, VS Code with Copilot, Windsurf and Gemini CLI, among others.

Some clients accept only local STDIO commands. These are MCP servers that run as programs on your computer. If your client is one of them, use the local Netlify server instead of the hosted URL (see below). It needs Node.js 22 or later.

## Add the Server

For Claude Code, run this command ([MCP docs](https://code.claude.com/docs/en/mcp)):

```bash
claude mcp add --transport http netlify https://netlify-mcp.netlify.app/mcp
```

Start `claude`. Type `/mcp`. Follow the browser steps to sign in.

For Codex CLI, run this command ([MCP docs](https://learn.chatgpt.com/docs/extend/mcp)):

```bash
codex mcp add netlify --url https://netlify-mcp.netlify.app/mcp
```

Codex detects OAuth and opens the browser. If it does not, run `codex mcp login netlify`. The Codex CLI, the Codex IDE extension and the ChatGPT desktop app share this configuration. One setup covers all three.

For Cursor, add the server to `.cursor/mcp.json`:

```json
{
"mcpServers": {
"netlify": {
"url": "https://netlify-mcp.netlify.app/mcp"
}
}
}
```

In Claude.ai, Claude Desktop and ChatGPT, Netlify is ready to use. According to [Netlify's setup page](https://docs.netlify.com/build/build-with-ai/netlify-mcp-server/), it is a ready-made connector in Claude and an app in ChatGPT. For Vercel in Claude, open **Settings** > **Connectors** > **Add custom connector**. Enter `https://mcp.vercel.com`.

To use Vercel instead of Netlify, replace the name and the URL:

```bash
claude mcp add --transport http vercel https://mcp.vercel.com
```

```bash
codex mcp add vercel --url https://mcp.vercel.com
```

If you cannot use remote MCP servers, use the local fallback:

```bash
claude mcp add netlify -- npx -y @netlify/mcp
```

```bash
codex mcp add netlify -- npx -y @netlify/mcp
```

To see the configured servers, run `claude mcp list` or `codex mcp list`.

## Understand the Authorization Step

Sign-in must open the sign-in page of the host in your browser. Sign in there. Approve the connection. Do not paste your password, a verification code or an access token into the AI conversation.

Know what access you give. Vercel states that a connection to its MCP server [gives the AI tool the same access as your Vercel user account](https://vercel.com/docs/agent-resources/vercel-mcp). The server alone is not enough. You also give the connection access to the teams that it works with. Treat the connection like a logged-in teammate. Keep human confirmation turned on for actions that change things.

If sign-in succeeds but no tools appear:

1. Refresh the server list in the client, or run `/mcp` in Claude Code or Codex.
2. Start a new chat or session.
3. Ask the agent to run a simple read call (a call that only reads data). Netlify suggests: "Use the Netlify MCP server to run a test call to get-user." For Vercel, ask the agent to list your teams and projects.
4. If the client still shows a stale sign-in, remove the server and add it again.
5. Find out whether a workspace administrator restricted connections.

If the local Netlify server has authentication trouble, its README allows a temporary `NETLIFY_PERSONAL_ACCESS_TOKEN` in the MCP configuration. When you solve the problem, remove the token. Never commit the token to a repository.

## Run a Minimal Publishing Test

Start with one tiny page in a new folder. Then a failure points at the connection, not at your project:

```html

MCP publishing test
First MCP publish

```

Ask the agent:

> Using the Netlify MCP server, create a new project called mcp-publish-test, deploy the folder that contains this index.html, and return the live URL and the project ID. Remember the project ID for the next step.

Open the URL. Make sure that the heading appears.

Then ask:

> Change the heading to "MCP update confirmed" and deploy again to the existing project mcp-publish-test. Do not create a new project. Return the URL.

Reload the original URL. The new heading at the same URL shows that tool discovery, file access, deployment and project reuse all work. If you do not need the test project, delete it afterwards.

## MCP Server or CLI?

Coding agents such as Claude Code and Codex can also deploy with the CLI of each host in your terminal. Both paths are legitimate. They suit different situations.

| Situation | Better path |
|---|---|
| The agent runs in a chat app without a terminal | Hosted MCP server |
| You want the agent to inspect projects, deployments and logs | MCP server |
| The project is a folder on your computer with images, fonts and PDFs | CLI, or Netlify's local MCP server |
| A framework must run a production build first | CLI after the build |
| You deploy to Cloudflare Pages or GitHub Pages | CLI (Wrangler) or a git push |

A remote MCP server runs on the machines of the provider. It cannot read arbitrary files from your computer. The client must send the contents of the files through a tool call. For a real project with binary assets, such as images, fonts and PDFs, the CLI is often simpler:

```bash
netlify deploy --dir=dist
```

```bash
vercel
```

```bash
npx wrangler pages deploy dist
```

Without `--prod`, `netlify deploy` creates a draft deploy. After the first deployment of a project, `vercel` creates a preview deployment. Review the result. Then deploy to production with `netlify deploy --dir=dist --prod` or `vercel --prod`. See the guides for [Netlify](/blog/publish-ai-site-netlify/), [Vercel](/blog/publish-ai-site-vercel/) and [Cloudflare Pages](/blog/how-to-publish-an-ai-generated-site-on-cloudflare-pages/).

One note for Codex: its default `workspace-write` sandbox [keeps network access off](https://learn.chatgpt.com/docs/agent-approvals-security). A sandbox limits what the commands of Codex can do. Codex asks for approval before it runs commands that need the network. When Codex asks, approve the deploy command. If you trust the project, you can also enable network access in `config.toml`.

## Give the Agent a Bounded Task

Tell the agent the source folder, the build command, the output directory and the destination project. For example:

```text
Build this website with npm run build and deploy the dist folder
to the existing Netlify project acme-landing as a draft.
Show me the files included and the draft URL.
Do not deploy to production until I approve the draft.
```

Before you approve production, review the page, a few direct asset URLs and any access settings. Keep deployment credentials outside the website files.

## Preserve the Site Identity

The most common workflow mistake is to create a new project for every revision. Each new project gets a new URL. Links that you already shared then no longer show the latest version.

After the first deploy, save the project name or ID. Give it to the agent again for updates:

> Deploy the updated dist folder to the existing Netlify project acme-landing. Do not create a new project, and confirm the production URL is still https://acme-landing.netlify.app.

The CLIs help here too. Wrangler caches the project name after the first deployment. The Vercel CLI links the folder to its project. As a result, later deploys go to the same place.

## Static Hosting Boundaries

A static host serves files. It does not turn a server application into a static site. Before you deploy, do these steps:

- Run the static production build of the framework.
- Remove development-only references such as `localhost`.
- Do not expose private environment variables in the built files.
- Make sure that client-side routes work on a static host.
- Make sure that asset paths are relative to the published root.

If the project needs a server process or a private database connection, a static deploy is not enough. The project needs functions or a different runtime (a system that runs server code).

## Common Connection Errors

### The client says the URL is unsupported

Make sure that the client supports remote Streamable HTTP MCP servers, not only STDIO. Enter the endpoint exactly. Include `https://`. For Vercel, make sure that your client is on its list of approved clients.

### Sign-in completed but the client still says disconnected

Refresh or restart the session. If an organization manages the client, look at its connector policy. For Vercel, make sure that you gave the connection access to the correct team.

### The deploy worked but images are missing

That is usually the local-file boundary, not an authentication failure. A remote MCP server cannot read files from your computer. Deploy the folder with the CLI or with the local MCP server from Netlify.

### The update created a new URL

The agent created a new project. Repeat the request with the original project name or ID. Tell the agent explicitly to deploy to the existing project.

### The page opens but the app is broken

Make sure that the deployed folder contains the built static output and an `index.html`. Open the browser developer tools. They show missing asset paths or references to a local development server.

## Connection Checklist

A complete MCP publishing test proves all of these:

- The server URL is correct.
- Sign-in completes in the browser.
- The tools of the host appear in the client.
- A small static page deploys.
- The returned URL opens.
- A revision updates the same project and URL.
- Large or binary files go through the CLI or a local server.
- No credentials appear in chat or in the deployed files.

When these tests pass, use the same small loop in the real project. Pick the existing project, and change the files. Deploy a draft, and review it. Then promote the draft to production at the same URL.

A docs portal with Ask AI
and support tickets

Connect a repository, or describe your product to start. Each docs site has search, Ask AI, an API console, an MCP server and support tickets.

Publishes from GitHub on every push

Works with Mintlify repositories

API console from your OpenAPI file

MCP server and llms.txt for AI agents

Ask AI and support tickets

Analytics for people and AI agents

Start Free →

Questions? Ask AI in our docs
No card required.

---

[View the canonical page](https://revdoku.com/blog/how-to-connect-an-mcp-client-to-a-website-publishing-server/) · [Browse llms.txt](https://revdoku.com/llms.txt)
