Template Platform
Template MCP Connection Guide
Safely edit template drafts with AI using a controlled flow: propose, review, apply, then publish.
Architecture
- Draft/source of truth: Postgres (`template_page_drafts`, `template_draft_chat_history`)
- Live output: Cloudflare KV (`domain` or `domain:slug`)
- Safe flow: Propose -> Human Approve -> Apply -> Publish
Endpoints
POST /api/dashboard/templates/mcp/propose
Generate proposed HTML from an instruction.
POST /api/dashboard/templates/mcp/apply
Apply approved proposed HTML into the draft.
GET /api/dashboard/templates/mcp/history?draftId=...
Read instruction/proposal history for one draft.
POST /api/dashboard/templates/drafts/:id/publish
Publish draft HTML to KV (live).
Recommended Workflow
- Open Template Studio and load a draft.
- Write your instruction and click AI Propose Edit.
- Review proposed HTML (edit manually if needed).
- Click Apply Proposal.
- Preview the draft and then click Publish Live.
- If needed, rollback from snapshot history.
Safety Model
- MCP never writes directly to live KV pages.
- Publish is always an explicit user action.
- All operations are ownership-checked per deployment.
- Rollback is always available through snapshot history.
