AI Agent Test Data Generation via MCP Server
An AI coding agent working inside Claude Desktop or Cursor can read your
code, write new files, and run your test suite — but it can't open a
browser, log into a dashboard, and click "generate" to get a batch of
realistic test data. It has no hands for a UI. AI agent test data
generation only works if there's something the agent can call: a tool
with a defined schema it can invoke mid-session, the same way it calls a
file-write or a shell command. That's exactly what the Model Context
Protocol (MCP) is for, and it's why we shipped
@jsonfabrica/mcp-server
on npm.
What AI agent test data generation requires over MCP
MCP lets an AI client — Claude Desktop, Cursor, or anything else that
speaks the protocol — launch a small local server over stdio and treat
its exposed functions as tools it can call during a conversation. The
agent decides when to call jsonfabrica_generate_from_template the same
way it decides when to call read_file. For that to work, three things
have to exist: a server process the client can start, a set of tool
definitions with typed inputs and outputs, and — underneath all of it —
some actual operation the tool call triggers. MCP server test data
generation is that last piece: the tool call has to result in real,
schema-conformant data coming back, not a stub.
@jsonfabrica/mcp-server, concretely
We published @jsonfabrica/mcp-server v0.1.1 as a local MCP server: the
AI client launches it itself over stdio, no separate process to manage,
no port to open. It exposes the JsonFabrica gateway as a set of MCP
tools — jsonfabrica_create_template, jsonfabrica_generate_from_template,
jsonfabrica_generate_adhoc, jsonfabrica_create_batch,
jsonfabrica_create_sequence, and more. Mid-session, an agent can create
a template matching the shape of your User or Order model, generate
a batch of realistic records against it, and drop the result straight
into a fixture file or a seed script — without you leaving the editor to
go configure anything by hand.
Why this required building nothing new
Here's the part worth being explicit about: every one of those MCP
tools is a thin, typed wrapper around an endpoint that already existed
in the JsonFabrica REST API. jsonfabrica_generate_from_template calls
the same generation endpoint a CI pipeline or a seed script would call.
Writing the MCP server was a matter of describing existing requests and
responses as tool schemas — input validation, output shape, a short
description for the model to read — not building new generation logic,
new data models, or a new backend. The API was already the product; the
MCP server just gives it a second front door.
What a UI-first tool would have had to wrap instead
Contrast that with a tool where the primary interface is a dashboard: form fields, dropdowns, a "generate" button wired to internal state that was never meant to be called from outside a browser session. Exposing that to an AI agent means building an API it never had — endpoints, request validation, auth, versioned responses — essentially rebuilding the product's backend to have something to wrap. AI agent test data generation isn't a feature you bolt onto a UI-first product after the fact; it's a natural consequence of the product being API-first from the start. If the REST API is solid, wrapping it for MCP is a week of typed schemas. If it isn't, MCP support means building the API you should have had all along.
What this actually changes in a coding session
In practice, it collapses a context switch. Instead of stopping to write a one-off fixture by hand, or tabbing to a dashboard to generate a CSV and importing it back, an agent working on a PR can generate the test data it needs — realistic, schema-conformant, matching the model it's currently editing — as part of the same conversation that's writing the tests. No manual step, no separate tool, no copy-pasting JSON between windows. That's the practical payoff of MCP server test data generation: not a new capability bolted onto the model, but an existing capability finally reachable from where the work is actually happening.