AgentDAO Developers

    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

    1. Open Template Studio and load a draft.
    2. Write your instruction and click AI Propose Edit.
    3. Review proposed HTML (edit manually if needed).
    4. Click Apply Proposal.
    5. Preview the draft and then click Publish Live.
    6. 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.