Skip to main content

Let your AI agent build the mock API for you

Start Buggregator with MCP_ENABLED=true and connect your AI agent to it. Then ask in plain words for the endpoint you need. The agent reads the list of fake data generators, tries a template on a sample request, and saves the mock rule. Your app calls it under http://127.0.0.1:8000/mock/... and gets fake data back.

Steps

1. Turn MCP on

MCP is off by default. Set the environment variable, or mcp.enabled: true in buggregator.yaml.

bash
MCP_ENABLED=true

2. Connect your agent

For Claude Code, run this in your project. buggregator is the path to the binary. For other MCP clients, see the MCP docs.

bash
claude mcp add buggregator -- buggregator mcp

In Docker, use the HTTP transport on port 8001 instead.

yaml
services:
  buggregator:
    image: ghcr.io/buggregator/server:latest
    ports:
      - 127.0.0.1:8000:8000
      - 127.0.0.1:8001:8001    # MCP HTTP port
    environment:
      MCP_ENABLED: "true"
      MCP_TRANSPORT: http
      MCP_ADDR: ":8001"
bash
claude mcp add --transport http buggregator http://localhost:8001/mcp

3. Ask for the endpoint

Say what the API should return. For example:

text
"Create a mock for GET /users/{id} that returns the id from the path,
a fake name and a fake email as JSON. Preview it before you save it."

The agent uses mock_template_helpers to find generators, mock_rule_preview to run the template on a sample request without saving, and mock_rule_create to save it.

4. Turn a 404 into a rule

If your app already called a path that has no rule, ask the agent to look at mock_requests_list and create a rule from that request. It uses mock_rule_from_request.

5. Call the mock

The rule also appears on the Mock server page, where you can edit it.

bash
curl http://127.0.0.1:8000/mock/users/42

Why it works

Buggregator's MCP server exposes the mock server as tools: list, read, preview, create, update and delete rules, and import an OpenAPI spec. A preview gives the same answer as the REST API's preview and saves nothing, so the agent sees a template error before the rule exists. To let the agent only read and preview, set MCP_MOCK_WRITE=false.

Checked on with Buggregator v2.13.0

Setup in 60 seconds

No registration. No account. Start it and point your app at it.

1

Start Buggregator

One file, installed with one command. The web UI opens on port 8000. Prefer containers? Use the Docker tab.

$ curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
$ HTTP_ADDR=127.0.0.1:8000 \
  SMTP_ADDR=127.0.0.1:1025 \
  VAR_DUMPER_ADDR=127.0.0.1:9912 \
  MONOLOG_ADDR=127.0.0.1:9913 \
  PROXY_ADDR=127.0.0.1:8080 \
  ~/.local/bin/buggregator

The script picks the file for your CPU: Intel/AMD or ARM.

One file for Linux, macOS and Windows, about 40 MB. Nothing else to install.

This run line keeps it on this computer. Without the *_ADDR settings it listens on all network interfaces

Rather not run a script? Download the file yourself

Runs on Windows, macOS and Linux, on Intel/AMD and ARM.

Prefer not to do it yourself? Your AI agent can set Buggregator up for you