Why give Claude Code a real form backend
Claude Code is a terminal-native agent: it reads and writes your codebase directly. Tell it to "add a contact form" and it can scaffold the UI, an API route, an email integration, and spam handling. That's impressive — and it's also a backend you now have to run, secure, and maintain for what is usually just "email me the submission."
The splitforms MCP server gives Claude Code a better option: use splitforms as the backend. Through the Model Context Protocol, the agent calls typed tools to create a form on your account, retrieve your public access key, and generate front-end code that points at the real endpoint. The result is a working, hosted backend — email delivery, a dashboard, spam filtering, webhooks — with no server files added to your repo.
Because the agent works with live account context instead of guessing, the wiring is correct the first time: real form IDs, the actual access key, confirmable submissions. And the same connection lets Claude Code read submissions later to debug a production form without leaving the terminal.
Step 1: Connect the splitforms MCP server
Get your MCP token from the MCP settings in your dashboard (sk_mcp_... — a secret, distinct from your public access key). The quickest setup is the installer:
npx @splitforms/mcp install --token sk_mcp_xxxxxxxxxxxxOr add it to Claude Code's MCP configuration manually:
{
"mcpServers": {
"splitforms": {
"command": "npx",
"args": ["-y", "@splitforms/mcp"],
"env": { "SPLITFORMS_TOKEN": "sk_mcp_xxxxxxxxxxxx" }
}
}
}Reload Claude Code. It now has seven splitforms tools available — list_forms, get_form, create_form, list_submissions, get_submission, generate_form_html, and get_access_key — all on the free tier. Keep SPLITFORMS_TOKEN in the MCP config only; never commit it.
Step 2: Ask Claude Code to build and wire the form
Describe the form in plain language. Claude Code uses the tools instead of writing a backend:
Using the splitforms MCP server, create a form called "Contact"
with fields name, email, and message. Get the account access key,
then add a styled contact form to app/contact/page.tsx whose submit
handler POSTs the form data plus access_key to
https://splitforms.com/api/submit. Add a hidden honeypot field and
a thank-you state.Claude Code calls create_form to provision the form, get_access_key for your public key, and writes the component into your project wired to the real endpoint. No route.ts, no email SDK, no SMTP — splitforms receives, stores, emails, and filters spam.
To verify later: "list the last 10 submissions for the Contact form" → the agent calls list_submissions and prints them, so you can confirm a live form is healthy from the terminal.
Step 3: Understand the two credentials
This is the one thing to get right. There are two separate credentials and they live in two separate places:
- MCP token (
sk_mcp_...) — a secret. Authorizes Claude Code to act on your account. Lives only in the MCP config'senvblock. Never in your repo or client code. - Access key (
sf_live_...) — public. Authenticates the shipped form's POST request. Lives in the form's client-side code. Safe to view-source.
The generated handler uses only the public key:
const ACCESS_KEY = "sf_live_..."; // public, from get_access_key
async function onSubmit(e) {
e.preventDefault();
const data = new FormData(e.currentTarget);
data.append("access_key", ACCESS_KEY);
const res = await fetch("https://splitforms.com/api/submit", {
method: "POST",
body: data,
});
// handle success / error
}Step 4: Test and ship
Submit a test entry and confirm it lands in your dashboard and inbox in ~5 seconds — or ask Claude Code to list recent submissions. Add your production domain to Allowed Domains before launch. Troubleshooting: contact form not working.
What to do next
- Same flow in Cursor: add a form backend in Cursor with MCP
- Prompt-only AI builders: Lovable · v0 · Bolt.new
- Tool reference and prompts: splitforms MCP
- Ready to start: get a free access key
FAQ
What can Claude Code do once the splitforms MCP server is connected?
Claude Code gains seven splitforms tools: list_forms, get_form, create_form, list_submissions, get_submission, generate_form_html, and get_access_key. So you can ask it to create a form, wire it into your codebase with your real access key, and later read or debug live submissions — all from the terminal, without opening a dashboard or pasting keys by hand.
How do I add an MCP server to Claude Code?
Claude Code reads MCP servers from its configuration. You can add the splitforms server with the claude mcp add command or by editing the MCP config to include the npx-launched server with your SPLITFORMS_TOKEN in the env block. Once added, restart or reload Claude Code and the splitforms tools become available to the agent. The server runs via npx, so there's nothing to install globally.
Why use MCP instead of just telling Claude Code to write a form?
Claude Code can write a form and a backend from scratch — but then you own and maintain that backend. With the MCP server, Claude Code uses splitforms as the backend: it creates the form on your account, fetches your real access key, and generates front-end code pointed at the correct endpoint. The agent acts with live account context through a typed protocol, so it confirms rather than guesses. You ship a working hosted backend with no server code in your repo.
Is the MCP token safe to put in my project?
Keep the MCP token (SPLITFORMS_TOKEN, sk_mcp_...) in your Claude Code MCP configuration only — it's a secret that authorizes the agent to act on your account. It should never be committed to your repo or placed in client-side code. The public access key (sf_live_...) is the only credential that belongs in the shipped form. Treat them as two distinct things: private token for the agent, public key for the form.
Can Claude Code read form submissions to help debug a live form?
Yes. Ask it to list recent submissions or fetch a specific one, and it calls list_submissions / get_submission to read the payload, headers, source URL, and spam status inline. That's a fast way to confirm a production form is receiving data correctly, or to inspect why a particular submission was flagged — without leaving the terminal.
Does this only work for Next.js projects?
No. The generated form is plain front-end code that POSTs to the splitforms endpoint, so it works in any stack Claude Code is editing — Next.js, Astro, a static HTML site, Vue, Svelte, anything. The MCP integration is about how the agent talks to splitforms; the form itself is framework-agnostic.