mock-server

Build OpenAPI mock servers with custom handlers, seeding, and Docker.

15.9k|914|Updated Aug 16, 2023
One-click install
npx skills add https://github.com/scalar/scalar --skill mock-server-scalar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mock-server
Source: https://github.com/scalar/scalar/tree/main/.agents/skills/mock-server
Command: npx skills add https://github.com/scalar/scalar --skill mock-server-scalar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

OpenAPI mock servers enable reliable testing and debugging by simulating real API behavior, and this skill provides a clear reference for implementing and debugging with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.

Core Features & Use Cases

  • Package: @scalar/mock-server
  • Runtime: Node.js (package engine: >=22)
  • Main API: createMockServer(options)
  • Docs:
    • Getting started
    • Custom request handlers (x-handler)
    • Data seeding (x-seed)
    • Docker
  • Custom Request Logic with x-handler: adds dynamic per-operation behavior
  • Seed Data with x-seed: seeds initial data at startup
  • Docker Usage: run the mock server in Docker for isolated environments

Quick Start

Start a mock server from an OpenAPI document to simulate real API responses and test client integrations.

Frequently Asked Questions about mock-server

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an OpenAPI mock server for local API testing?

You can seed initial mock data at startup using the x-seed extension in your OpenAPI document, which populates the mock server with predefined records for reliable testing.

Can I add custom request handling logic to an OpenAPI mock server?

You can add custom request handling logic to an OpenAPI mock server using the x-handler extension, enabling dynamic per-operation behavior for advanced testing scenarios.

How do I seed initial data for an OpenAPI mock server?

Yes, you can run an OpenAPI mock server in Docker to create isolated environments, ensuring consistent testing conditions across different development setups.

Does the mock server support running in Docker for isolated environments?

To build an OpenAPI mock server, use the createMockServer(options) API from @scalar/mock-server to simulate real API responses and test client integrations during local development.

What Node.js version is required to run an OpenAPI mock server?

Running an OpenAPI mock server with @scalar/mock-server requires Node.js version 22 or higher, ensuring a stable runtime environment for reliable setup and debugging.

Can I configure authentication on an OpenAPI mock server?

Yes, the OpenAPI mock server supports authentication configuration, allowing you to simulate secure API behavior and test protected endpoints during local development.