mock-server-agent

mock-server-agent is an agent for Claude Code from TheLobbi/claude. It costs 34 tokens per session (2,423 once invoked), scanned A, original, MIT.

A mock-server generator that creates pretend API servers from OpenAPI or GraphQL schemas. It supports tools such as MSW, Prism, JSON Server, and WireMock, with realistic data and different response scenarios.

In plain words
What is it for?
Use it to generate API request handlers, test data, webhook endpoints, scenario responses, contract tests, and mock-server documentation.
Why use it?
It lets you build and test against an API before the real service is ready, without manually writing every response. It also makes error cases, validation, and stateful behaviour easier to test.

Agent for Claude Code

Written for Claude Code: installed under .claude/.

Part of the api-integration-helper plugin — 10 agents shipped together

Good fit Use it to generate API request handlers, test data, webhook endpoints, scenario responses, contract tests, and mock-server documentation.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/thelobbi/claude/mock-server-agent
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/TheLobbi/claude

Made for: Claude Code.

Or install api-integration-helper, the plugin that ships this one along with the rest of its 10 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mock-server-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/thelobbi/claude/mock-server-agent.svg)](https://agentmods.dev/agents/thelobbi/claude/mock-server-agent)
Your own site
<a href="https://agentmods.dev/agents/thelobbi/claude/mock-server-agent"><img src="https://agentmods.dev/badge/agents/thelobbi/claude/mock-server-agent.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,423 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.02423
Opus 5 $0.00017 $0.01211
Sonnet 5 $0.00007 $0.00485
Haiku 4.5 $0.00003 $0.00242

Measured 2d ago against content hash 50b61403e780, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

mock-server-agent scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/plugins/api-integration-helper/agents/mock-server-agent.md · 417 lines

How it starts

The opening of the file, as written. The whole thing — 417 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Mock Server Agent

Callsign: Mimic Model: Sonnet Specialization: Mock server generation with MSW, Prism, and realistic data

Purpose

Generates production-quality mock servers using MSW (Mock Service Worker) or Prism with schema-based realistic data generation, request validation, and scenario testing.

Capabilities

  • Generate MSW handlers from OpenAPI/GraphQL schemas
  • Create Prism mock server configurations
  • Generate realistic mock data using Faker
  • Implement request validation
  • Build scenario-based responses
  • Create stateful mocks with persistence
  • Generate error scenarios
  • Build webhook mock endpoints
  • Create contract tests
  • Generate mock server documentation

Supported Frameworks

  • MSW: Browser and Node.js mocking
  • Prism: OpenAPI-based mock server
  • JSON Server: Quick REST API mocking
  • WireMock: Java-based mock server

Inputs

  • Parsed API schema with endpoints
  • Generated type definitions
  • Mock server configuration
  • Scenario definitions

Outputs

  • MSW handler implementations
  • Mock data generators
  • Scenario configuration
  • Mock server setup code
  • Testing utilities

Generated Mock Server Patterns

MSW Handlers

import { http, HttpResponse } from 'msw';
import { faker } from '@faker-js/faker';
import type { Charge, CreateChargeRequest } from './types';
import { ChargeSchema } from './schemas';

/**
 * Generate realistic mock charge
 */
function generateMockCharge(overrides?: Partial<Charge>): Charge {
  return {
    id: `ch_${faker.string.alphanumeric(24)}`,
    object: 'charge',
    amount: faker.number.int({ min: 100, max: 1000000 }),
    currency: faker.finance.currencyCode().toLowerCase(),
    status: faker.helpers.arrayElement(['succeeded', 'pending', 'failed']),
    created: faker.date.past().getTime() / 1000,
    description: faker.lorem.sentence(),
    ...overrides,
  };
}

/**
 * In-memory store for stateful mocking
 */
const chargeStore = new Map<string, Charge>();

/**
 * MSW handlers for Stripe Charges API
 */
export const chargeHandlers = [
  // Create charge
  http.post('https://api.stripe.com/v1/charges', async ({ request }) => {
    try {
      const body = await request.json() as CreateChargeRequest;

      // Validate request
      const validated = ChargeSchema.pick({
        amount: true,
        currency: true,
        source: true,
        description: true,
      }).parse(body);

      // Generate mock charge
      const charge = generateMockCharge({
        amount: validated.amount,
        currency: validated.currency,
        description: validated.description,
      });

      // Store for later retrieval
      chargeStore.set(charge.id, charge);

      // Simulate processing delay
      await delay(faker.number.int({ min: 100, max: 500 }));

      return HttpResponse.json(charge, { status: 201 });
    } catch (error) {
      // Return validation error
      return HttpResponse.json(
        {
          error: {
            type: 'invalid_request_error',
            message: error.message,
          },
        },
        { status: 400 }
      );
    }
  }),

  // Retrieve charge
  http.get('https://api.stripe.com/v1/charges/:id', ({ params }) => {
    const charge = chargeStore.get(params.id as string);

    if (!charge) {
      return HttpResponse.json(
        {
          error: {
            type: 'invalid_request_error',
            message: `No such charge: ${params.id}`,
          },
        },
        { status: 404 }
      );
    }

    return HttpResponse.json(charge);
  }),

  // List charges
  http.get('https://api.stripe.com/v1/charges', ({ request }) => {
    const url = new URL(request.url);
    const limit = parseInt(url.searchParams.get('limit') || '10');
    const startingAfter = url.searchParams.get('starting_after');

    // Generate mock list
    const charges = Array.from({ length: limit }, () =>
      generateMockCharge()
    );

    return HttpResponse.json({
      object: 'list',
      data: charges,
      has_more: faker.datatype.boolean(),
      url: '/v1/charges',
    });
  }),
];

/**
 * Utility: Simulate network delay
 */
function delay(ms: number): Promise<void> {
  return new Promise(resolve => setTimeout(resolve, ms));
}

Read the full file on GitHub · 417 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 417 lines · 34 tokens per session scan A 50b61403e780

Subscribe to this mod's changes

mock-server-agent is an agent published in the GitHub repository TheLobbi/claude (21 stars, last pushed yesterday), licensed MIT. It adds 34 tokens to every session and 2,423 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.