Cursor contact form

Formgong team ·

Paste this into Cursor. Posts go to Formgong. No database and no Resend.

250 free submissions a month

How forms work in Cursor

Cursor edits the code in your own repository, so the result depends on your stack and on the agent's habits. Asked for a contact form, the agent often adds an API route and an email library such as Nodemailer or Resend. It also adds environment variables with SMTP or API credentials.

You can keep the repository smaller: the form posts to https://formgong.com/submit from the browser. Cursor can also talk to Formgong through its MCP server, so the agent can create the form and fetch the right snippet itself.

Set it up in Cursor

  1. Create a form in Formgong and copy the access key, or let the agent do it through MCP (next step).
  2. Optional: create a personal API token in Formgong (Settings → Integrations & API) and add the remote MCP server https://formgong.com/mcp in Cursor's MCP settings. The agent can then list forms, create one and get its snippet.
  3. Paste the prompt below into the agent chat. It asks for a frontend form only: no API route, no email library, no new secrets.
  4. Review the diff before accepting it. The form should post to Formgong and include access_key, _lang and the hidden botcheck field.
  5. To keep it that way, add a project rule in .cursor/rules (or AGENTS.md): “Forms post to Formgong; do not add backend code for forms.”

Step-by-step guide in the docs

Cursor
Add a contact form to the existing site in this repo, using its current components and styles. Submissions go to Formgong, a hosted form backend. Do not create an API route, serverless function, or environment variable for this form.

Formgong spec (follow exactly):
- Plain HTML: <form action="https://formgong.com/submit" method="POST">. With JavaScript, POST the same fields to https://formgong.com/submit using fetch.
- Hidden field access_key with value fk_your_access_key. The key is public and belongs in frontend code. Do not move it to a server or a secret.
- Hidden field _lang with the page language code, e.g. "en" (on multilingual sites use document.documentElement.lang). Formgong uses it for error messages, the thank-you page, and the autoreply.
- Fields: name, email, message (required); phone is optional. Keep these field names, and use <input type="email"> for email so browsers check the address.
- Honeypot: <input type="text" name="botcheck" tabindex="-1" autocomplete="off"> inside a wrapper with aria-hidden="true", visually hidden with CSS (position:absolute;inset-inline-start:0;top:0;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)). Never fill it.
- Success, plain form POST: optionally add a hidden _redirect field with the absolute https URL of the site's thank-you page. Without it, Formgong shows its own thank-you page.
- Success, fetch: send Accept: application/json (and Content-Type: application/json for a JSON body; for FormData let the browser set it). If the response has success === true, show an inline thank-you message and reset the form; otherwise show the response's message.
- Turnstile: only if I give you a Cloudflare Turnstile site key, add <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script> and <div class="cf-turnstile" data-sitekey="SITE_KEY"></div> inside the form. Otherwise leave it out.
- Optional: add <script src="https://formgong.com/fg.js" async></script> once per page. It fills _lang from <html lang>, sets the Turnstile language, and counts form views without cookies.
- Do not create a backend, API route, server function, database table, or email-sending code (Supabase, Resend, SendGrid, nodemailer), and do not add secrets. No file uploads.

Add to an existing project: npx formgong init (npm: formgong)

Formgong or your own API route?

Build your own route when the submission has to run your business logic: writing to your database, checking a logged-in user or calling internal services.

Use Formgong when the form just needs to reach you reliably. Spam filtering, delivery to email and Telegram, retries for webhooks and the inbox are already done.

Questions and answers

Do I need the MCP server?

No. The prompt alone is enough. MCP is useful when you want the agent to create forms and fetch snippets without copying keys by hand.

Is the API token the same as the access key?

No. The access key (fk_…) is public and goes into the form. The API token (fgp_…) is private: keep it in Cursor's settings, never in the repository.

Which frameworks does this work with?

Any. The agent adapts the snippet to your stack; the endpoint and field names stay the same.

Start free