MCP server
el-form-mcp gives an agent the API reference bundled with the installed version. It can generate a typed React form, check a JSON Schema against sample data and return field-level diagnostics. The host application controls writing and running the code.
Connect a client
A client that supports stdio can start the published package with npx -y el-form-mcp. For the features under development in this checkout, build the local package:
pnpm install --frozen-lockfile
pnpm --filter el-form-mcp build
Use the absolute path to that build in the client's configuration. For clients that accept mcpServers, use:
{
"mcpServers": {
"el-form": {
"command": "node",
"args": ["/absolute/path/to/el-form/packages/el-form-mcp/dist/index.js"]
}
}
}
The executable exchanges MCP messages over standard input and output. Use the client's tool list to discover what its installed version offers.
Tools and prompt
| Name | Input | Result |
|---|---|---|
el_form_overview | {} | Packages, APIs and entry points. |
el_form_list_topics | {} | Available topic keys and titles. |
el_form_get_topic | {"topic":"agent-workflow"} | Full bundled reference for that key. |
el_form_search | {"query":"schema transforms"} | Ranked excerpts and topic keys. |
el_form_scaffold_form | fields, optional api, AutoForm theme, optional includeTest | TSX in code, a portable JSON schema, the chosen API and any theme. |
el_form_validate_schema | JSON schema, optional sample | valid, stage (schema or sample), and issues. |
el_form_explain_validation_error | One of errors or issues | Field paths, messages, codes and suggested repairs. |
The prompt el_form_build_and_verify takes a required string called task. It guides the agent through generation, sample checks, a typecheck and a real submission. Machine consumers use structuredContent. Text-only clients can still read the first text block, including the fenced TSX from a scaffold request.
Field descriptions
Pass one to 100 fields with unique, flat names such as email or deliveryDate. The default type is text. Other types are email, password, number, textarea, checkbox, select, date, url and tel. A select takes options containing distinct, non-empty strings. Labels and option values are trimmed. Each may contain up to 120 characters. Add label for display text and optional: true for an optional field. Generated components export their Zod schema and accept an onSubmit callback. An empty optional control submits as undefined, including an empty number, date or select. A numeric zero and an unchecked checkbox submit as 0 and false. Passwords require eight characters, counted as Unicode code points. A date uses YYYY-MM-DD and must exist on the calendar. A required checkbox accepts either boolean value. To require consent, add a schema rule that checks for true.
The JSON Schema describes portable input. Zod strips unknown object keys when it parses the submission. Treat a generated form as a two-stage acceptance gate. First, use el_form_validate_schema to check portable JSON input. Then run the exported Zod schema or rendered component to confirm the application's runtime validation and callback payload.
The two stages deliberately retain their standards-based format semantics. For example, the portable checker accepts ada@example.c as an email while the generated Zod schema rejects it. The generated Zod schema accepts https://bücher.example/path while the portable JSON Schema URI checker rejects that Unicode host form. Use a punycode hostname when a sample must pass both. Check unusual email and URI boundary cases with the exported schema. A generated useform component uses React 18's useId.
Set includeTest: true to receive a verification object. Save code under its moduleFileName and verification.testSource under its testFileName in the same directory. Type-check these files in your project and run the test with Vitest, jsdom and React Testing Library. The test checks the rendered callback against validSample. Where the scaffold supplies a rejecting case it also returns invalidSample for replay. If your application adds rules, add a test for the corresponding application behavior.
The default API is autoform. The local build supports default, minimal, dark, card, inline and dense. Choose useform without a theme for custom input markup.
Attach a bundled topic
Hosts with an MCP resource picker can attach a guide directly to a conversation. With a connected SDK client, list the resources and read the one you need:
const { resources } = await client.listResources();
const guide = resources.find(resource => resource.name === "schema-transforms");
if (guide) {
const { contents } = await client.readResource({ uri: guide.uri });
for (const item of contents) if ("text" in item) console.log(item.text);
}
The URI for this guide is el-form://reference/schema-transforms. Its Markdown comes from the installed server. Hosts that expose tools can retrieve the same text with el_form_get_topic.
Replay a portable check in a browser
The playground’s Check sample data panel calls the same checker as el_form_validate_schema. Paste a JSON sample, check it and repair any reported fields. In an app using the local package, import the checker directly:
import { checkSchema } from "el-form-mcp/validate";
const result = checkSchema({ type: "number", minimum: 1 }, 0);
// result.valid is false. result.issues[0].code is "minimum".
The function checks JSON Schema and returns the same valid, stage and issues as the tool. Test custom Zod transforms through the rendered form.
Validation results
The checker uses JSON Schema Draft 2020-12 by default and supports explicitly declared Draft-07. Use local definitions for references. Samples keep their original types. Omit sample to check the schema alone. A JSON null in sample is a value to validate.
A completed check can return valid: false. Inspect stage to find out whether the schema or sample needs repair. Malformed tool arguments set isError: true. Both report issues with path, code, message and suggestion. An empty path refers to the root. The path ["lines", 0, "quantity"] refers to the first row's quantity.
Use the invitation form walkthrough for a complete generation, repair and submit test. The machine-readable reference also works in clients without MCP.