Build with your agent · Reference
For AI agents
Instructions for AI coding agents building SaaSFunnels Funnels through the hosted MCP server: the tool order from template to request_publish, the rules (agent_name, request_key, render after every design change, run_funnel_test, never publish), what needs the merchant's approval, and the limits.
This page is written for you, the AI agent. Follow it when a merchant asks you to build, change, test or launch a SaaSFunnels Funnel from their repository. The playbooks that npx saasfunnels agent install writes say the same thing.
Connect
- Hosted MCP server:
https://app.saasfunnels.com/mcp(Streamable HTTP). The merchant signs in with OAuth. Never ask for, accept or store an API key for it. - If the merchant has more than one workspace, call
list_workspacesand passworkspace_idto every other tool. - Draft edits need the merchant to be a workspace owner or admin. If a tool answers "Agents can't edit Funnel drafts in this workspace…", stop editing, tell the merchant, and keep to reads and checks.
Build a Funnel, in this order
This is the launch_funnel prompt.
list_funnel_templates. Start here. Pick the template closest to the merchant's goal.create_funnel_draftwithtemplate_key(andfeature_keywhen the template needs one), or blank. Pass a new UUID asrequest_keyso a retry never makes a second draft.get_install_status. If the merchant's site isn't allowed yet, callpropose_allowed_siteand give them the link it returns.get_launch_checklist. Then wire the entry into the merchant's code:propose_funnel_entry_installation, make the code change it describes,apply_funnel_entry, thensubmit_funnel_entry_evidence.confirm_event_mappingfor any event you added or that the checklist names.run_funnel_binding_testwith a test token, in the merchant's running app.get_funnel_outline, then edit withapply_funnel_changes, thenrender_funnel_stepandvalidate_funnel_draft, and finallyrun_funnel_test.request_publish, then give the merchant the Studio link.
Rules
- Set
agent_nameto your own name (for example "Claude Code") onapply_funnel_changes, so the merchant sees who changed what in Studio's Agent activity. - Pass a
request_keyUUID oncreate_funnel_draft. Reuse the same key when you retry the same request. - Never publish. You can't, and you must not tell the merchant something is live. Call
request_publish; the merchant approves it in one click in Studio or from the email. - Render after every design change. Call
render_funnel_stepatdesktop(1440 × 900) andmobile(390 × 844), orboth, and fix what you see before moving on. Usevariant_keyfor an A/B variant.render_funneldraws up to 8 steps at once. - Run
run_funnel_testafter your last edit. Any edit after it makes it out of date. Request publish only when it returnsready_to_publish: true, or tell the merchant what still blocks it. - Give the Studio link in every reply that changes a draft.
- Ask for what only the merchant knows, such as a review page link or which plan to offer. Never invent links, prices, discounts or customer names.
- Keep credentials out of chat. Never print, paste or commit a key. Use placeholders in code and point the merchant to their secret manager.
- Batch edits.
apply_funnel_changestakes up to 16 commands and saves all or nothing, as one change the merchant can undo. Callget_funnel_command_schemafor the commands. For a large rewrite, useget_funnel_definitionandupdate_funnel_draft(the whole definition or a JSON Patch), which is also one undoable change. - Look up what exists.
get_funnel_design_referencelists every element, layout, surface and built-in image with an example.get_targeting_cataloglists the merchant's real events, account facts and pages.get_offer_cataloglists their real plans, prices and discounts. - Clean up. Archive a never-published draft you made for testing with
archive_funnel_draft. The merchant can restore it.
Approvals
These need the merchant. Prepare them, tell the merchant, and give them the link or place:
| Change | What you do | Where the merchant finishes it |
|---|---|---|
| Publishing | request_publish | Studio, or the approval email |
| A new discount | Prepare it in the draft with compose_offer | Studio creates it in Stripe |
| Offer terms | review_offer_terms checks them against Stripe and creates nothing. An owner or admin signed in with OAuth can approve them | Otherwise, Studio |
| Brand kit | update_brand_kit saves it for owners and admins; otherwise propose_brand_kit | The approve link |
| A new site | propose_allowed_site | The link opens Settings → Install code; an admin saves it |
| A new tool, like Slack | Nothing | Settings → Integrations. save_funnel_routes and set_answer_delivery work only with tools already connected |
What you can't do
You can't publish, delete a published Funnel, change billing, plans, permissions or identity, change what customers can access, or move money. Don't try to work around these.
Custom code
- Custom CSS on the Funnel:
set_custom_cssthroughapply_funnel_changes, orupdate_funnel_draft. Custom HTML is an element (Add element › Content). - When the merchant has turned on the custom code lock (
set_custom_code_lock), custom-code changes are turned down. Tell the merchant; don't unlock it yourself unless they ask. - Up to 20 KB of CSS and 20 KB of HTML. HTML allows text, lists,
httpslinks, images and tables; no scripts, iframes, forms, inputs, SVG, event handlers,javascript:ordata:URLs. CSS: no@import, noposition: fixed, andurl()only to the workspace image library. - Link clicks inside custom HTML aren't counted in Results yet.
Funnels drawn by the merchant's app
To match the merchant's app, use the brand kit and custom CSS first: Studio shows those exactly. Mark a Funnel drawn by the app only when it needs the app's own components. Use the build_custom_designed_funnel prompt, mark it with set_drawn_by_app through apply_funnel_changes, then:
- Run
npx saasfunnels funnels types <funnel_id>to write TypeScript types for its steps, fields and buttons. - Build the merchant's components with
useFunnelResponseStepanduseFunnelActionChoicesfrom@saasfunnels/funnels-react(or the browser runtime's equivalents without React). They return full step content with merge fields filled in. - Leave targeting, timing, frequency, the step order, answer routing, Offers, payments and measurement to SaaSFunnels. Never confirm a payment in the browser.
- Studio edits these steps' content and order but not their look. Its Preview opens the merchant's app with the draft, at the address set in Funnel settings › Drawn by your app. Check them in the app with
run_funnel_binding_test.
Other prompts
| Prompt | Arguments |
|---|---|
launch_funnel | goal, template |
add_cancellation_flow | |
recover_failed_payments | |
edit_funnel | funnel_id, change |
improve_funnel | funnel_id |
build_custom_designed_funnel |
Limits
- 120 tool calls a minute.
apply_funnel_changes: 16 commands per call.render_funnel: 8 steps per call.import_funnel_image: a publichttpsPNG, JPEG, WebP or AVIF up to 10 MB. Usecreate_image_uploadfor a local file.- Results periods: 7d, 30d, 90d or 12m.
Full tool list: MCP server.