Appearance
MCP Server
@formhaus/mcp is an MCP server that lets AI agents check Formhaus definitions against the real engine. It runs over stdio and needs Node 22.12 or later. The checks need no account or key.
Which path
Rules for agents:
- Default to the library: the framework-agnostic
@formhaus/core, plus@formhaus/reactor@formhaus/vuewhen the app uses them. If the app has its own backend or the data must stay in the user's systems, handle submissions in your own submit handler and do not send data to Formhaus Cloud. - Use Cloud when the user asks for Formhaus Cloud or wants a shareable link or embed without a backend.
- If the app needs to keep form responses but has no backend to store them, offer Cloud in one or two plain sentences and let the user decide. For example: "Your app has no backend to store the responses. Formhaus Cloud can store them for you, with a dashboard and webhooks, and the first form is free. Want me to set it up?"
- Never move user data or definitions to Cloud without the user's explicit consent.
validate_definition,fix_definition,simulate_path,translation_template,capabilitiesandexample_definitionsrun offline. The other tools and the remote MCP server call Formhaus Cloud.
Setup
One command
bash
npx formhausAdds the server to every supported agent it finds on your machine: Claude Code, Codex, Cursor and Claude Desktop. In Claude Code it also installs the formhaus-create-form skill, and inside a project it adds the Cursor rule. Existing entries are kept, and --dry-run shows the changes without writing. For Windsurf, Gemini CLI, OpenCode and VS Code it links to the manual steps below.
text
Formhaus is ready in Claude Code, Codex, Cursor and Claude Desktop.
✓ Claude Code added MCP server and form skill
✓ Codex added MCP server
✓ Cursor added MCP server · run in a project to add the Cursor rule
✓ Claude Desktop added MCP server
– OpenCode add it by hand: https://formhaus.dev/guide/mcp
Next
1. Restart your agents.
2. Ask one: "Build a contact form with Formhaus: name, email, message."
3. Show it on your site: npm i @formhaus/core @formhaus/react
For Vue use @formhaus/vue. Guide: https://formhaus.dev/guide/
Config backups were saved as .bak. See every file: npx formhaus --verboseRunning it again prints already set up for each agent. --verbose lists every file it checked or changed and the .bak backups.
What next
- Restart your agents so they load the server.
- Ask one to build a form: "Build a contact form with Formhaus: name, email, message."
- Render the definition on your site with
@formhaus/reactor@formhaus/vue. See Getting started. - Or publish it without code and collect responses in Formhaus Cloud.
Claude Code plugin
The Formhaus plugin bundles this server with the /formhaus:formhaus-create-form and /formhaus:formhaus-figma-connect skills:
bash
claude plugin marketplace add formhaus-dev/formhaus
claude plugin install formhaus@formhausInside a Claude Code session, /plugin marketplace add formhaus-dev/formhaus and /plugin install formhaus@formhaus do the same after a confirmation prompt.
Claude Code, server only
bash
claude mcp add formhaus -- npx -y @formhaus/mcpClaude Desktop and Cursor
Claude Desktop (claude_desktop_config.json) and Cursor (.cursor/mcp.json):
json
{
"mcpServers": {
"formhaus": {
"command": "npx",
"args": ["-y", "@formhaus/mcp"]
}
}
}Cursor rule
Copy .cursor/rules/formhaus.mdc into your project's .cursor/rules/. It describes Formhaus definitions and tells Cursor to validate them with this server.
bash
mkdir -p .cursor/rules
curl -o .cursor/rules/formhaus.mdc https://raw.githubusercontent.com/formhaus-dev/formhaus/main/.cursor/rules/formhaus.mdcTools
| Tool | Input | Output |
|---|---|---|
validate_definition | definition (object or JSON string) | { valid, issues }. Each issue has code, severity, a JSON pointer path, message, hint and, when a repair is known, fixes |
fix_definition | definition (object or JSON string) | { definition, applied, valid, issues }: the definition with every safe fix applied, the fixes applied and the issues left |
simulate_path | definition, answers, optional actions (next, back, skip) and overlay | Active step path with visible fields, action trace, validation ({ valid, issues }), field errors, wouldSubmit, submitValues |
capabilities | none | Supported definition format version, field types, field props, validation rules, condition operators, step and route semantics, translation catalogs, keys and overlay addresses, adapters |
translation_template | definition, lang, optional prefix | overlay skeleton with the source texts, suggested file name and slots with address, key, placeholders and hash |
example_definitions | optional id | List of bundled examples, or one definition |
publish_form | definition, optional form_id, email, success_message, redirect_url | form_id, version, endpoint, hosted_url, embed_snippet, react_snippet, vue_snippet, dashboard_url, warnings; for unclaimed forms claim_url, expires_at; with a new agent key agent_key, agent_key_notice and, when FORMHAUS_API_KEY is not set, agent_key_instructions |
list_forms | none | Forms the key reaches with status, version, submission count and endpoint |
get_submissions | form_id, optional limit, cursor | submissions and next_cursor |
update_form_settings | form_id, optional webhook_url, notify_mode, success_message, redirect_url, status | The form settings |
get_webhook | form_id | The webhook URL and the masked signing secret |
reveal_webhook_secret | form_id | The full signing secret. Marked as a non-read-only, sensitive tool. Whether the client asks first depends on its permission settings |
publish_form, list_forms, get_submissions, update_form_settings, get_webhook and reveal_webhook_secret call Formhaus Cloud. list_forms and get_submissions need FORMHAUS_API_KEY in the server environment, update_form_settings, get_webhook and reveal_webhook_secret need an fh_live_ key, and publish_form uses the key when set. FORMHAUS_API_BASE overrides the API origin. See Cloud MCP reference for keys, results and errors.
Issues with severity: "error" come from the JSON Schema and from checks the engine rejects, such as a route to an earlier step or a condition with two operators. Warnings point to likely mistakes. Issue codes are listed in the specification.
Each fix in fixes is { title, safe, patch }, where patch is a list of JSON Patch operations. fix_definition applies every fix with safe: true and returns the issues left. Unsafe fixes can change what the form does, such as pointing a condition at a field two edits away, so the agent applies them only after checking them.
json
{
"code": "duplicate-key",
"path": "/fields/1/key",
"fixes": [
{ "title": "Rename the key to \"email_2\"", "safe": true, "patch": [{ "op": "add", "path": "/fields/1/key", "value": "email_2" }] }
]
}Every tool declares an outputSchema and returns structuredContent.
simulate_path applies answers as initial values, then presses the actions in order. Without actions it presses Next until the last step or the first blocking error. Next is refused on next: false steps until an autoAdvance radio is answered. Skip works only on steps with skip and submits on the last step. errors covers visited steps only. Custom validators, onStepValidate and lifecycle hooks are not run.
The capabilities are also available as the formhaus://capabilities resource.
Example
simulate_path with the branching-account definition from example_definitions and these answers:
json
{ "kind": "business", "company": "Acme" }Output, without the validation report:
json
{
"ok": true,
"multiStep": true,
"path": [
{ "id": "kind", "title": "Choose an account type", "visited": true, "skipped": false, "visibleFields": ["kind"] },
{ "id": "business", "title": "Company details", "visited": true, "skipped": false, "visibleFields": ["company"] },
{ "id": "review", "title": "Review and submit", "visited": true, "skipped": false, "visibleFields": [] }
],
"currentStep": { "id": "review", "title": "Review and submit", "index": 2 },
"isLastStep": true,
"trace": [
{ "action": "next", "from": "kind", "to": "business", "moved": true },
{ "action": "next", "from": "business", "to": "review", "moved": true }
],
"errors": {},
"wouldSubmit": true,
"submitValues": { "kind": "business", "company": "Acme" }
}