MM

mcpland/mock-mcp

Browser automation

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

10 stars 2 forks 품질 73 트렌드 18MIT

Mock MCP Server - AI-driven mock data orchestration with OpenAPI JSON Schema for testing

개요

Mock MCP Server - AI-generated mock data based on your definitions. The project uses a architecture that enables multiple MCP clients (Cursor, Claude Desktop, etc.) to run simultaneously without port conflicts, while providing robust claim-based concurrency control for mock batch processing. 1. Add mock-mcp as a dev dependency inside your project. 2. Add mock-mcp to your MCP client configuration (Cursor, Claude Desktop, etc.): The adapter command connects to a shared daemon process that is automatically started when needed. This eliminates port conflicts when running multiple MCP clients simultaneously. 3. Use connect to retrieve a mock client and request data for intercepted calls. 4. Prompt your AI client to run the persistent test command and provide mocks through the tools. Testing modern web applications often feels like preparing for a battle—you need the right weapons (test cases), ammunition (mock data), and strategy (test logic).

README

원문 README의 일부입니다. 원문 보기.

mock-mcp

Mock MCP Server - AI-generated mock data based on your OpenAPI JSON Schema definitions. The project uses a Daemon + Adapter architecture that enables multiple MCP clients (Cursor, Claude Desktop, etc.) to run simultaneously without port conflicts, while providing robust claim-based concurrency control for mock batch processing.

Table of Contents

Quick Start

  1. Install the package. Add mock-mcp as a dev dependency inside your project.
npm install -D mock-mcp
# or
yarn add -D mock-mcp
# or
pnpm add -D mock-mcp
  1. Configure the Model Context Protocol server. Add mock-mcp to your MCP client configuration (Cursor, Claude Desktop, etc.):
{
  "mcpServers": {
    "mock-mcp": {
      "command": "npx",
      "args": ["-y", "mock-mcp@latest", "adapter"]
    }
  }
}

Note: The adapter command connects to a shared daemon process that is automatically started when needed. This eliminates port conflicts when running multiple MCP clients simultaneously.

  1. Connect from your tests. Use connect to retrieve a mock client and request data for intercepted calls.
import { render, screen, fireEvent } from "@testing-library/react";
import { connect } from "mock-mcp";

const userSchema = {
  summary: "Fetch the current user",
  response: {
    type: "object",
    required: ["id", "name"],
    properties: {
      id: { type: "number" },
      name: { type: "string" },
    },
  },
};

it("example", async () => {
  const mockClient = await connect();
  const metadata = {
    schemaUrl: "https://example.com/openapi.json#/paths/~1user/get",
    schema: userSchema,
    instructions: "Respond with a single user described by the schema.",
  };

  fetchMock.get("/user", async () => {
    const response = await mockClient.requestMock("/user", "GET", { metadata }) // add mock via mock-mcp
    return response.data
  });

  const result = await fetch("/user");
  const data = await result.json();
  expect(data).toEqual({ id: 1, name: "Jane" });
}, 10 * 60 * 1000); // 10 minute timeout for AI interaction
  1. Run with MCP enabled. Prompt your AI client to run the persistent test command and provide mocks through the tools.
GitHub에서 전체 README 보기

설치

npx -y mock-mcp@latest adapter
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "mock-mcp": { "command": "npx", "args": ["-y", "mock-mcp@latest", "adapter"] } } }