This is how the hosted service is deployed. You can use it to run your own multi-tenant copy.
Architecture
| Worker | Config | Entry | Domain |
|---|---|---|---|
skills-playground-hosted |
wrangler.jsonc |
packages/server/src/worker-hosted.ts |
app.<your-domain> |
skills-playground-mcp |
wrangler.mcp.jsonc |
packages/server/src/worker-mcp.ts |
mcp.<your-domain> |
Both bind the same D1 database as DB and the same R2 bucket as BUNDLES. The app worker can also bind Analytics Engine as ANALYTICS.
Prerequisites: a Cloudflare account on the Workers Paid plan, wrangler logged in, and your domain on Cloudflare.
1. Create D1 and R2
wrangler d1 create skills-playground-prod
wrangler r2 bucket create skills-playground-bundles
wrangler r2 bucket create skills-playground-bundles-preview
Put the D1 database_id into both wrangler.jsonc and wrangler.mcp.jsonc. Both configs must name the same R2 bucket: wrangler.mcp.jsonc ships with skills-playground-bundles-prod, so change it to skills-playground-bundles (or create that bucket instead).
2. Apply migrations
wrangler d1 execute skills-playground-prod --remote --file=packages/server/migrations/0001_initial_schema.sql
wrangler d1 execute skills-playground-prod --remote --file=packages/server/migrations/0002_hosted_multitenant.sql
wrangler d1 execute skills-playground-prod --remote --file=packages/server/migrations/0003_mcp_oauth.sql
3. Set secrets
Create a GitHub OAuth app with the callback https://app.<your-domain>/api/v1/auth/oauth/github/callback, then:
wrangler secret put GITHUB_CLIENT_ID
wrangler secret put GITHUB_CLIENT_SECRET
wrangler secret put EMAIL_PROVIDER_KEY
# MCP worker
wrangler secret put JWT_SECRET --config wrangler.mcp.jsonc
Set EMAIL_PROVIDER_KEY before you let anyone sign in. Without it, magic-link sign-in runs in development mode and returns the sign-in token in the API response instead of emailing it.
4. Set URLs
APP_URL and MCP_PUBLIC_URL are set in the vars of both configs. Change them to your domains. They are used for OAuth redirects, discovery metadata and connection links.
5. Deploy
pnpm install && pnpm build
wrangler deploy --config wrangler.jsonc
wrangler deploy --config wrangler.mcp.jsonc
Both configs attach their domains with custom_domain routes, so Cloudflare creates the DNS records and certificates.
6. Verify
curl https://app.<your-domain>/health # {"status":"ok","worker":"hosted",...}
curl https://mcp.<your-domain>/health # {"status":"ok","service":"mcp"}
curl https://app.<your-domain>/.well-known/oauth-authorization-server
Logs and rollback
wrangler tail
wrangler deployments list
wrangler rollback <deployment-id>