Skip to content

feat(mcp): MPP-gated deploy flow — agents pay to host persistent services #28

@hellno

Description

@hellno

Summary

Part 2 of MPP compute on Jack Cloud. Part 1 (execute_code, PR #27) ships instant sandboxed code execution. This issue covers persistent hosting: an agent pays via MPP and gets a live URL that stays up.

Context

  • PR feat(mcp): MPP payment sessions + execute_code tool #27 adds execute_code MCP tool with MPP payments (live, verified)
  • gakonst tweet: "desperately need MPP-enabled compute & hosting"
  • /execute handles the "compute" half. This issue handles the "hosting" half.
  • Design docs: ~/.gstack/projects/getjack-org-jack/hellno-machine-payments-design-*.md

What this enables

Agent calls deploy_project MCP tool without a human account. Jack returns an MPP session challenge. Agent opens a Tempo payment channel ($5 min deposit). Agent deploys code, gets a live URL. Subsequent deploys (redeploys, iterations) deduct from session balance. Services suspend when balance hits zero.

Architecture

Agent → MCP Worker → deploy_project tool
                      ├── chargeSession() → ComputeSession DO
                      │   ├── No session → 402 MPP challenge (session intent)
                      │   └── Valid voucher → deduct $0.05 per deploy
                      ├── bundleCode(files) → esbuild-wasm
                      ├── Create project via control plane API (ephemeral org)
                      ├── Upload deployment via FormData
                      └── Return { url, deployment_id, expires_at }

Key decisions needed

  1. Bundler location: Extract apps/mcp-worker/src/bundler.ts to packages/bundler/ so template and MCP worker share one implementation? Or duplicate?
  2. Ephemeral orgs: MPP sessions need a control plane org to own projects. Create ephemeral orgs with no human owner? Or reuse existing org model with a machine flag?
  3. Deploy TTL: 24h auto-expire? Or keep alive until session balance exhausted? (Design doc says "until balance exhausted with 7-day inactivity timeout")
  4. Runtime metering: Free deploys, metered runtime (requests + CPU). Requires dispatch worker changes. How much latency does DO balance checking add? (Design doc targets <5ms p50)
  5. Cleanup: Cron to garbage-collect expired/abandoned deployments from dispatch namespace

Implementation pieces

  • deploy_project MCP tool with MPP session gating
  • Ephemeral org creation in control plane for MPP sessions
  • Session-to-project cardinality tracking in ComputeSession DO
  • Extract bundler to shared package (DRY with MCP worker)
  • Dispatch worker metering integration (Phase 2)
  • Auto-suspend on zero balance (Phase 2)
  • Cleanup cron for expired deployments (Phase 2)

Pricing model (from design doc)

Resource Rate
Deploy / redeploy $0.05 per deploy
Worker requests $0.50 / million
CPU time $12.50 / million ms
D1 reads/writes $0.25-1.00 / million

Deploys have a small fixed cost. Runtime is metered. Session minimum $5 USDC.

Dependencies

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions