Create a form, share the URL, poll for submissions, wire up webhooks. All via MCP tools.
Updated March 2026
This guide walks through a complete agent workflow using Sutrena's MCP tools or REST API. The agent creates a form to collect human input, shares the URL, waits for submissions, and processes the results. This is the pattern for any agent that needs to collect structured data from humans -- feedback surveys, approval workflows, data collection campaigns, research questionnaires. The examples show both MCP tool calls (for Claude Code, Cursor, or any MCP client) and equivalent SDK code.
1. Create a trial account (if needed)
If the agent doesn't have an API key, it creates a free trial account first. This returns a key instantly with no signup required. The key works for 24 hours before the account needs to be claimed via OAuth.
// MCP tool: (handled automatically by the MCP server)
// The agent authenticates with an existing key or gets a trial key.
// SDK equivalent:
import { Sutrena } from "@sutrena/sdk";
const trial = await Sutrena.createTrial();
console.log("API Key:", trial.key);
console.log("Subdomain:", trial.subdomainUrl);
console.log("Claim before:", trial.claimDeadline);
const s = new Sutrena(trial.key);2. Create a form to collect data
The agent creates a form with the fields it needs. The MCP tool `sutrena_create_form` or `POST /api/forms` returns a hosted form URL and a submission endpoint.
// SDK
const { data: form } = await s.forms.create({
name: "Customer Research Survey",
fields: [
{ name: "name", label: "Your name", type: "text", required: true },
{ name: "email", label: "Email", type: "email", required: true },
{ name: "role", label: "Your role", type: "select",
options: ["Developer", "Designer", "PM", "Founder", "Other"] },
{ name: "pain_point", label: "Biggest pain point", type: "textarea", required: true },
{ name: "would_pay", label: "Would you pay for a solution?", type: "select",
options: ["Yes", "Maybe", "No"] },
],
successMessage: "Thanks! Your response has been recorded.",
});
console.log("Share this URL:", form.hostedFormUrl);
console.log("Form ID:", form.formId);3. Deploy a landing page with the embedded form
Optionally, the agent creates a landing page that embeds the form. This gives a more polished experience than the hosted form URL alone.
// SDK
const { data: page } = await s.pages.create({
slug: "index",
title: "Customer Research — Help Us Build Something Great",
html: `<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"></head>
<body>
<div class="container">
<h1>Help us build something great</h1>
<p>We're researching pain points in developer tooling. Your 2-minute response shapes what we build next.</p>
<iframe src="https://sutrena.com/f/${form.formId}?embed=1"
style="width:100%;min-height:600px;border:none;"></iframe>
</div>
</body>
</html>`,
css: `body { font-family: system-ui, sans-serif; margin: 0; padding: 2rem; background: #fafafa; }
.container { max-width: 640px; margin: 0 auto; }`,
});
console.log("Landing page:", page.subdomainUrl);4. Wait for submissions and poll for results
The agent shares the form URL (or landing page URL) with humans. Then it polls for submissions on an interval or uses a webhook callback.
// SDK — poll for submissions
const { data } = await s.submissions.list(form.formId, {
limit: 100,
});
console.log(`${data.submissions.length} responses so far`);
for (const sub of data.submissions) {
console.log(`${sub.payload.name} (${sub.payload.role}): ${sub.payload.would_pay}`);
}5. Share the results
The agent now has two live URLs to share: the landing page and the form. Use webhooks to get notified of new submissions in real time, or poll the submissions API to process results.
console.log("=== Your Research Campaign ===");
console.log("Landing page:", page.subdomainUrl);
console.log("Direct form:", form.hostedFormUrl);
console.log("");
console.log("Share the landing page URL with your audience.");
console.log("Poll submissions or set up a webhook for real-time notifications.");Yes. Sutrena has 67 MCP tools. Claude Code and Cursor can call `sutrena_create_form`, `sutrena_create_page`, `sutrena_search_submissions`, and `sutrena_create_webhook` in a single conversation. The agent handles the entire workflow without leaving the IDE.
Add `{ "mcpServers": { "sutrena": { "command": "npx", "args": ["-y", "sutrena"], "env": { "SUTRENA_API_KEY": "st_live_xxx" } } } }` to your MCP client config. Works with Claude Code, Cursor, Windsurf, and any MCP-compatible client.
Yes. Use the webhook callback pattern (see related guide) to receive HTTP POST notifications for each submission. Or use polling for agents that can't receive HTTP. Or set `autoEntryPageId` on the form to auto-add entries to a page as they come in.
Use the webhook callback pattern so the agent processes each submission programmatically. Or use an automation with a condition step to route submissions based on field values.
Sutrena is the web runtime for AI agents. Forms, Pages, Analytics, Webhooks, Automations — all through 67 MCP tools and one REST API. Your agent creates web artifacts, humans interact with them, and your agent gets the data back. Use any one feature or all of them together.
Pages
Deploy HTML instantly
Forms
Collect structured data
Automations
DSL-based pipelines with 14 step types
Analytics
Privacy-first, no cookies
Webhooks
Slack, Discord, Telegram
1. Get a trial key (no auth, no signup)
curl -X POST https://sutrena.com/api/trial2. Create anything — a page, form, automation, or analytics site
# Create a form
curl -X POST https://sutrena.com/api/forms \
-H "Authorization: Bearer st_trial_xxx" \
-H "Content-Type: application/json" \
-d '{"name": "waitlist", "fields": [{"name": "email", "label": "Email", "type": "email", "required": true}]}'
# Or deploy a page
curl -X POST https://sutrena.com/api/pages \
-H "Authorization: Bearer st_trial_xxx" \
-H "Content-Type: application/json" \
-d '{"slug": "index", "title": "My Site", "html": "<h1>Live</h1>"}'Get a trial API key instantly with no signup, or create an account for the full experience.