MCP Server

Quick Start

Two end-to-end walkthroughs: one for chat-class agents (ChatGPT, Claude.ai), one for desktop coding agents (Claude Code, Codex). Pick the one that matches your environment.

Chat agent flow (ChatGPT, Claude.ai)

Endpoint: https://www.webase.com/mcp/managed/messages. The agent generates source files via MCP; Webase compiles automatically in the background. Preview is live within a few seconds of the last write.

  1. Discover constraints. Call get_runtime_constraints to learn the entry-point candidates, import map, Tailwind / HashRouter rules, and the data API URL shape.
  2. Create an empty app.
    tools/call create_application
      { name: "Daily Standup", description: "Team standup tracker" }
    The default build_mode is browser_bundler, which is what chat agents want.
  3. (Optional) Define schemas.
    tools/call create_data_model
      {
        application_id_or_slug: "daily-standup",
        name: "Posts",
        fields: [
          { name: "user",   field_type: "String" },
          { name: "plan",   field_type: "Text" },
          { name: "date",   field_type: "Date" }
        ]
      }
  4. Write the source tree. One MCP call writes everything; pass delete_missing: true to mirror an external file tree exactly.
    tools/call bulk_update_source_files
      {
        application_id_or_slug: "daily-standup",
        files: [
          { filename: "src/index.tsx",      content: "..." },
          { filename: "src/App.tsx",        content: "..." },
          { filename: "public/index.html",  content: "..." },
          { filename: "package.json",       content: "{...}" }
        ],
        delete_missing: true
      }
  5. Get the preview URL.
    tools/call get_preview_url
      { application_id_or_slug: "daily-standup" }
    // → { "preview_url": "https://www.webase.com/preview/daily-standup", ... }
    The bundle finishes within a few seconds of the previous step.
  6. Iterate. Edit individual files with update_source_file, mutate records with create_record / update_record / delete_record, run evaluate_application for a quality signal.
  7. Deploy. deploy_application pushes the compiled bundle to Netlify and returns the production URL.

Coding agent flow (Claude Code, Codex)

Endpoint: https://www.webase.com/mcp/external/messages. The agent codes with any local toolchain (Vite, Next, plain esbuild — full npm), builds locally, and uploads the compiled tree.

  1. Discover constraints. Call get_runtime_constraints — only the external_static and data_api sections apply.
  2. Create the app with build_mode external_static.
    tools/call create_application
      { name: "Daily Standup", build_mode: "external_static" }
  3. Build locally with anything. npm create vite, next build, plain esbuild — your call. Real npm dependencies, real Tailwind via PostCSS, BrowserRouter is fine because Webase serves index.html as the SPA fallback.
  4. Upload the build. One call uploads the compiled assets and (optionally) the source snapshot, atomically, in a single transaction.
    # In a shell on the agent's machine:
    BUILD_TAR=$(tar -cz -C dist . | base64)
    SRC_TAR=$(tar -cz . --exclude=node_modules --exclude=dist --exclude=.git | base64)
    
    # Then via MCP:
    tools/call upload_build
      {
        application_id_or_slug: "daily-standup",
        build_tarball_base64:  "$BUILD_TAR",
        source_tarball_base64: "$SRC_TAR"
      }
    The new build becomes active atomically; the previous active build is marked superseded.
  5. Preview is live immediately. Webase serves index.html at /preview/<slug> and any other asset at /preview/<slug>/<path>. Hashed asset filenames get long-lived immutable cache headers automatically.
  6. Iterate. Edit, rebuild, upload again. Each upload_build creates a new Build row; activation is atomic.
  7. Roll back if needed. list_buildsrollback_build(build_id). Activation flips, preview swaps instantly.

What every agent should know

  • Reads are cheap. Repeatedly call get_application, list_source_files(include_content: true), list_records(humanize_keys: true) — none cost message credits.
  • Records use field IDs as keys in their canonical storage form. Pass humanize_keys: true on reads to swap field names in.
  • Evaluations are free. evaluate_application returns a structured score + per-requirement check without consuming credits.
  • Deploy is separate from preview. get_preview_url returns the Webase-hosted preview; deploy_application publishes to Netlify.