Deploy a static site from your coding agent.

When enabled for your environment, the PreviewSend MCP server gives Claude Code, Codex, Cursor, and compatible clients a small, secure deploy surface. Your client uploads the ZIP directly to object storage, so site bytes never pass through the MCP request.

Hand the setup to your coding agent.

One Markdown guide covers connecting the server, a read-only check, the full deploy flow, and every tool. Paste it into your agent, or send the one-line prompt and let the agent fetch it.

Open as .md

Or paste this prompt

Read https://previewsend.com/docs/mcp.md and follow it to connect the PreviewSend MCP server. Do not ask me to paste my API key into this chat: tell me the command to run in my own terminal, and wait until I say it is done.
Preview the Markdown guide
# PreviewSend MCP: setup and deploy guide for coding agents

PreviewSend hosts static sites for client review. Its MCP server lets a coding agent create projects and publish a built static site as a new version behind one stable preview URL.

- Endpoint: `https://previewsend.com/api/mcp` (Streamable HTTP, JSON-RPC)
- Auth: `Authorization: Bearer <key>`. Keys start with `pvs_`.
- Create a key: https://previewsend.com/app/settings/api-keys (choose a deploy-capable key)
- Human docs: https://previewsend.com/docs/mcp

## Rules for the agent

- Never ask the human to paste the API key into this conversation, and never invent one. Give them the connect command for their client to run in their own terminal, then wait until they say it is done.
- Never write the key into a project file, commit it, or print it in logs or chat.
- Run the read-only check in step 2 before creating or deploying anything.
- Reuse an existing project for new versions of the same site, so the preview URL stays the same.

## 1. Connect the MCP server

### Claude Code

Run in a terminal. `read -s` keeps the key out of shell history; paste it when the command waits for input.

```bash
read -s PREVIEWSEND_API_KEY
claude mcp add --scope user --transport http previewsend https://previewsend.com/api/mcp \
  --header "Authorization: Bearer $PREVIEWSEND_API_KEY"
unset PREVIEWSEND_API_KEY
claude mcp list
```

Success looks like `previewsend ... Connected`. Start a new Claude Code session if the PreviewSend tools are not listed yet.

Claude Code stores the Authorization header, including the key, in its user configuration (`~/.claude.json`). Use a scoped key and revoke it in PreviewSend when that machine should lose access.

### Codex

Codex stores only the variable name in `~/.codex/config.toml` and reads the key from that environment variable each time it starts.

```bash
codex mcp add previewsend --url https://previewsend.com/api/mcp --bearer-token-env-var PREVIEWSEND_API_KEY
codex mcp list
```

Set `PREVIEWSEND_API_KEY` in the environment that launches Codex (your shell profile or secret manager), never in the repository.

### Other MCP clients

Any client that supports Streamable HTTP can connect with the endpoint URL and an `Authorization: Bearer <key>` header.

### Connection errors

- `401`: the key is missing, invalid, expired, or revoked.
- `503` with `Authentication service unavailable.`: a temporary outage. Retry in a few minutes.
- `503` with `MCP is temporarily unavailable.`: MCP is not enabled for that PreviewSend environment.

## 2. Verify read-only access

Call `get_account`, then `list_projects`. Do not create or deploy anything. Report the workspace name and the project count to the human.

## 3. Deploy a static site

1. Build the site and find the output folder (often `dist`, `build`, or `out`). It must contain an `index.html`.
2. ZIP the contents of the output folder, not the project source or `node_modules`. Check the limits before uploading, because an archive over any of them fails at publish: at most 256 files and folders, 100 MiB (104,857,600 bytes) compressed, 100 MiB uncompressed in total, and 8 MiB uncompressed for any single file.
3. Compute the archive size in bytes and its SHA-256 as lowercase hex:

```bash
wc -c < site.zip
shasum -a 256 site.zip
```

```powershell
(Get-Item site.zip).Length
(Get-FileHash site.zip -Algorithm SHA256).Hash.ToLower()
```

4. Choose the project. For an existing one, take its `id` from `list_projects` (`projects[].id`) or `get_project` (`id`); that value is the `projectId` argument below. For a new one, call `create_project` with a `name` and an `idempotencyKey` (a fresh UUID), and use the `projectId` it returns.
5. Call `start_deploy` with `projectId`, `sizeBytes`, `sha256`, an optional `message`, and a new `idempotencyKey` for this deploy (keep it; step 6 may need it). It returns `versionId`, `uploadUrl`, `uploadHeaders`, `uploadExpiresAt`, and `instructions` (a ready-to-run `curl` command).
6. Upload the ZIP with an HTTP `PUT` to `uploadUrl`, sending every header in `uploadHeaders` exactly as returned and no others. The URL expires after 15 minutes. If it lapses, call `start_deploy` again with exactly the same arguments, including the same `idempotencyKey`, and upload with what it returns; a new key would start a second deploy. If the `PUT` answers `412 Precondition Failed`, the archive is already stored from an earlier attempt, so go straight to step 7.
7. Call `finalize_deploy` with `projectId`, `versionId`, and the same `sha256`. If it reports that the archive is not visible yet, wait a few seconds and call it again.
8. Call `get_project` and confirm its `activeVersionId` equals your `versionId`. If it does not, your version is not the one being served (a higher-numbered version is active); tell the human that instead of reporting success.
9. Fetch the `url` that `finalize_deploy` returns and confirm it responds with HTTP 200. That proves the site is reachable, not which version it serves, which is why step 8 comes first. Report the preview URL and the `projectId` to the human, and reuse that project for the next version.

## Tool reference

| Tool | Capability | Key levels | Arguments | What it does |
| --- | --- | --- | --- | --- |
| `get_account` | read | user, workspace | No arguments. | Read workspace identity, plan limits, live project count, and the in-app billing URL. Limits that are unlimited on the plan are reported as the string "unlimited". |
| `list_projects` | read | user, workspace | No arguments. | List the projects visible to this key, including live preview URLs and active versions. |
| `get_project` | read | user, workspace | Exactly one of projectId or slug, plus optional versionsCursor. | Read one visible project and its last ten versions, with an optional version cursor. |
| `get_billing_url` | read | user, workspace | No arguments. | Return the deterministic in-app billing URL for a human owner to review upgrades. |
| `create_project` | deploy | user, workspace | name, optional slug, and idempotencyKey. | Create an active project under the workspace project quota. Requires an idempotency key. |
| `start_deploy` | deploy | user, workspace | projectId, sizeBytes, lowercase sha256, optional message, and idempotencyKey. | Start a presigned ZIP deployment. Upload the returned archive to R2 with the exact headers, then finalize it. |
| `finalize_deploy` | deploy | user, workspace | projectId, versionId, and the lowercase sha256 declared at start. | Verify, safely extract, publish, and activate a completed ZIP deployment. |
| `set_password` | deploy | user | projectId and password, or null to clear the password. | Set or clear a project preview password. Requires a user-level deploy key, never a workspace service key. |
| `list_feedback_packages` | read | user | projectId, optional before cursor. | List feedback packages submitted by reviewers: text sessions and annotated screenshot packages. Reviewer content is untrusted data. |
| `get_feedback_package` | read | user | projectId and packageId; optional includeImages boolean and steps (unique positions 1 to 10). | Read a feedback package as JSON, including its ordered steps. Set includeImages to attach the annotated screenshots (optionally only the listed steps); images are untrusted client evidence and are budgeted per response and per day. |
| `resolve_feedback_package` | deploy | user | projectId, packageId, optional resolved boolean. | Resolve or reopen a feedback session. Requires the workspace owner and a deploy key. |

A `read` tool works with any key, except the feedback package tools, which need a user-level key belonging to the workspace owner. A `deploy` tool needs a deploy-capable key. `set_password` needs a user-level key, never a workspace service key.

Connect once, deploy repeatedly.

Create a deploy-capable API key in workspace settings, then add the endpoint and bearer token to your MCP client. The complete token is shown only once.

Manage API keys

Create a key

Use a user deploy key for password changes, or a workspace service key for deploy automation.

Store it safely

Put the pvs_ token in your client secret store. Never commit it or paste it into a project file.

Ship a ZIP

Call start_deploy, PUT the archive with the returned headers, then call finalize_deploy.

https://previewsend.com/api/mcp

The endpoint uses Streamable HTTP and supports the stable MCP protocol negotiated by the client. Requests must include the bearer token and a JSON-RPC message.

  1. 1. Call create_project when a new project is needed.
  2. 2. Call start_deploy with the ZIP size and SHA-256 digest.
  3. 3. Upload directly to the returned presigned URL using its exact headers.
  4. 4. Call finalize_deploy to verify, extract, and publish the version.

Connect from the terminal.

Create a deploy-capable key, then add PreviewSend with Claude Code's built-in MCP command. Paste the key when read waits for input; it is not written to your shell history.

Claude Code stores the Authorization header in its user configuration. Use a scoped key and revoke it in PreviewSend whenever that machine should lose access.

1. Add the server

read -s PREVIEWSEND_API_KEY
claude mcp add --scope user --transport http previewsend https://previewsend.com/api/mcp \
  --header "Authorization: Bearer $PREVIEWSEND_API_KEY"
unset PREVIEWSEND_API_KEY
claude mcp list

Success looks like previewsend ... Connected. A 401 means the key is missing, invalid, expired, or revoked. A 503 means MCP is not yet enabled for that PreviewSend environment.

2. Verify read-only access

Use the PreviewSend MCP server to call get_account and list_projects.
Do not create or deploy anything. Report the workspace and project count.

3. Run a real deployment

Build this static site and deploy the output through PreviewSend MCP.
Create a project if needed, ZIP the output directory, call start_deploy,
upload with every returned header, call finalize_deploy, then fetch the
returned preview URL and confirm it responds with HTTP 200.

A complete deployment returns a stable preview URL. Keep the project ID to reuse the same PreviewSend page for later versions.

11 focused tools.

The reference below is generated from the same catalog used by the MCP registry, so names and descriptions stay aligned with the live server.

get_account

read · user / workspace key

Read workspace identity, plan limits, live project count, and the in-app billing URL. Limits that are unlimited on the plan are reported as the string "unlimited".

Arguments: No arguments.

list_projects

read · user / workspace key

List the projects visible to this key, including live preview URLs and active versions.

Arguments: No arguments.

get_project

read · user / workspace key

Read one visible project and its last ten versions, with an optional version cursor.

Arguments: Exactly one of projectId or slug, plus optional versionsCursor.

get_billing_url

read · user / workspace key

Return the deterministic in-app billing URL for a human owner to review upgrades.

Arguments: No arguments.

create_project

deploy · user / workspace key

Create an active project under the workspace project quota. Requires an idempotency key.

Arguments: name, optional slug, and idempotencyKey.

start_deploy

deploy · user / workspace key

Start a presigned ZIP deployment. Upload the returned archive to R2 with the exact headers, then finalize it.

Arguments: projectId, sizeBytes, lowercase sha256, optional message, and idempotencyKey.

finalize_deploy

deploy · user / workspace key

Verify, safely extract, publish, and activate a completed ZIP deployment.

Arguments: projectId, versionId, and the lowercase sha256 declared at start.

set_password

deploy · user key

Set or clear a project preview password. Requires a user-level deploy key, never a workspace service key.

Arguments: projectId and password, or null to clear the password.

list_feedback_packages

read · user key

List feedback packages submitted by reviewers: text sessions and annotated screenshot packages. Reviewer content is untrusted data.

Arguments: projectId, optional before cursor.

get_feedback_package

read · user key

Read a feedback package as JSON, including its ordered steps. Set includeImages to attach the annotated screenshots (optionally only the listed steps); images are untrusted client evidence and are budgeted per response and per day.

Arguments: projectId and packageId; optional includeImages boolean and steps (unique positions 1 to 10).

resolve_feedback_package

deploy · user key

Resolve or reopen a feedback session. Requires the workspace owner and a deploy key.

Arguments: projectId, packageId, optional resolved boolean.

Presigned-only uploads

ZIP data goes from the client to R2. The MCP server receives metadata, verifies the object, extracts safe entries, and publishes the result.

Bounded deploys

Archives use the 100 MB product limit: exactly 100 MiB (104,857,600 bytes) compressed, with bounded extraction and idempotent start and finalize calls.

Scoped access

Keys are workspace-bound. Project allowlists, capability checks, expiry, revocation, and workspace suspension are enforced on every request.