WC
Documentation

MCP Server Documentation

Connect your AI agents to deploy web applications directly to Netlify or Vercel using the Model Context Protocol.

Quick Start

1Create an API Key

Go to your dashboard and create a new API key. Keys start with wcd_ and are shown only once.

2Configure Your AI Client

Add the MCP server configuration to your AI client. See the configuration section below for client-specific instructions.

Endpoint: https://opzero.sh/api/mcp

3Start Deploying

Your AI agent can now use the deploy_files tool to deploy websites. Try asking it to "deploy a simple HTML page to Netlify".

Client Configuration

Claude Desktop Configuration

Add this to your claude_desktop_config.json file

On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "webcontainer-deploy": {
      "url": "https://opzero.sh/api/mcp",
      "headers": {
        "Authorization": "Bearer wcd_YOUR_API_KEY"
      }
    }
  }
}

Authentication

All requests must include an Authorization header with your API key:

Authorization: Bearer wcd_YOUR_API_KEY

Security Note: API keys provide full access to your deployment projects. Keep them secure and never commit them to version control.

OAuth 2.0 Authentication

For web-based integrations and third-party applications

Opzero.sh supports OAuth 2.0 with PKCE for secure authentication from web applications and AI platforms like Claude and ChatGPT.

Discovery Endpoint

https://opzero.sh/.well-known/oauth-authorization-server

MCP Server Discovery

https://opzero.sh/.well-known/mcp.json

The MCP Server Card provides automatic discovery of server capabilities, tools, and authentication requirements for AI clients.

Supported Scopes

  • openid - OpenID Connect authentication
  • profile - Access to user profile information
  • email - Access to user email
  • deploy - Permission to deploy projects
  • preview - Permission to create previews
  • read - Read-only access to projects

Grant Types

  • authorization_code - Standard OAuth flow with PKCE
  • refresh_token - Token refresh for long-lived sessions

For AI Integration: Most AI platforms (Claude, ChatGPT) will automatically discover OAuth endpoints from the .well-known URLs when you add Opzero.sh as a custom connector.

Deploy Tools

Full-Stack Preview Workflow

The WebContainer preview system enables AI agents to create, iterate, and deploy full-stack applications in real-time using cloud browsers.

How It Works

1Create Preview

Call create_preview with your project files. A cloud browser boots a WebContainer, runs npm install, and starts the dev server.

2Iterate with Hot Reload

Use update_preview to push file changes. They appear instantly via hot module replacement.

3User Tests Preview

Share the live view URL with users. They can interact with the app while you continue making changes.

4Deploy to Production

Once approved, call deploy_preview to push to Cloudflare, Netlify, or Vercel.

Recommended Workflow for AI Agents

// Step 1: Get a starter template
const template = await call("get_template", { template: "vite-react" });

// Step 2: Modify files based on user requirements
const files = {
  ...template,
  "src/App.jsx": `export default function App() {
    const [count, setCount] = useState(0);
    return <button onClick={() => setCount(c => c + 1)}>Count: {count}</button>;
  }`
};

// Step 3: Create the preview (boots WebContainer, npm install, starts dev server)
const preview = await call("create_preview", { files });
// Returns: { sessionId, previewUrl, liveViewUrl }

// Step 4: Iterate based on user feedback
await call("update_preview", {
  sessionId: preview.sessionId,
  files: { "src/App.jsx": "// Updated code..." }
});
// Changes appear instantly via hot reload!

// Step 5: Deploy when ready
await call("deploy_preview", {
  sessionId: preview.sessionId,
  name: "my-counter-app",
  target: "cloudflare"
});

// Step 6: Clean up
await call("close_preview", { sessionId: preview.sessionId });

Supported Frameworks

FrameworkDetectionDev Command
Vite / Vite + Reactvite in scriptsnpm run dev
Next.jsnext in depsnpm run dev
Express / Node.jsexpress in depsnpm start
Create React Appreact-scripts in depsnpm start
StaticNo package.jsonnpx serve .

⏱️ Timeout Expectations

  • WebContainer boot: 5-10 seconds
  • npm install: 30-120 seconds (depends on dependencies)
  • Dev server start: 5-15 seconds
  • Total create_preview: 60-150 seconds typical
  • Hot reload updates: Instant (<1 second)

Preview Tools Reference

Complete API reference for WebContainer preview tools. Use these to create, iterate, and deploy full-stack apps.

Troubleshooting

Authentication Failed

  • Verify your API key starts with wcd_
  • Check that the Authorization header format is Bearer wcd_...
  • Ensure the API key hasn't been deleted from your dashboard

Deployment Failed

  • Check that all file paths are valid (no leading slashes)
  • Ensure file contents are valid strings
  • Verify your Netlify/Vercel token is configured in your account

Tool Not Found

  • Use the tools/list method to see available tools
  • Check for typos in the tool name
  • Ensure you're using the correct JSON-RPC format

Ready to deploy?

Create your API key and start deploying with AI agents.