AI

Generate Test Data in Cursor IDE with MockHero MCP

The Problem

Cursor IDE has become the go-to editor for AI-assisted development. Its built-in agent can write code, refactor files, and debug issues. But when it comes to test data, Cursor's agent falls back on hardcoded values or basic Faker snippets. You end up with { name: "Test User", email: "test@example.com" } scattered across your project.

What you really need is realistic, relational data that matches your actual schema. But generating that data usually means leaving Cursor, setting up a separate seed script, and running it manually. That context switch kills the flow that makes Cursor productive in the first place.

The Solution: MockHero MCP in Cursor

Cursor supports the Model Context Protocol (MCP), which lets the agent call external tools directly. By adding MockHero as an MCP server, you give Cursor's agent the ability to generate realistic test data without leaving your editor. Just describe what you need in natural language, and the agent handles the rest.

Quick Setup

Create or edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "mockhero": {
      "command": "npx",
      "args": ["-y", "@mockhero/mcp-server"],
      "env": {
        "MOCKHERO_API_KEY": "mh_your_api_key"
      }
    }
  }
}

Restart Cursor, and the MockHero tool will appear in the agent's available tools list.

Step-by-Step Guide

1. Get your MockHero API key

Sign up at mockhero.dev/sign-up and copy your API key from the dashboard.

2. Create the MCP configuration

In your project root, create a .cursor directory if it does not exist, then add mcp.json with the configuration shown above. Replace mh_your_api_key with your actual key.

3. Restart Cursor

Cursor reads MCP configuration on startup. After saving the file, restart the editor to pick up the new server.

4. Ask the agent to generate data

Open the Cursor agent panel and type a request like:

"Generate a seed script for my Prisma database with 30 users,
100 posts, and 200 comments. Use realistic data."

The agent will use MockHero's MCP tool to generate the data and write the seed script directly into your project.

5. Run the seed script

The agent can also run the script for you, or you can execute it from the terminal:

npx tsx prisma/seed.ts

Why MockHero MCP in Cursor vs Alternatives

  • In-editor experience — no context switching. Data generation happens inside your normal Cursor workflow.
  • Natural language — describe your schema in plain English. The agent maps it to MockHero's 156+ field types.
  • Relational data — the agent automatically sets up ref fields so foreign keys are valid across all tables.
  • Deterministic — pass a seed value for reproducible data in CI/CD pipelines.

Get Started

Add MockHero to Cursor in under a minute. Sign up free, drop in the MCP config, and let your AI agent handle test data generation.

M

MockHero Team

Guides and tutorials for generating realistic test data with the MockHero API.

Start generating test data for free

1,000 rows/month on the free tier. No credit card required.

Get Your API Key

Related Articles