Agent skill

Mock Server

by scalar in scalar/scalar

Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.

MITAuto-check passedBackend & APIs

Install Mock Server

skills CLI
$ npx skills add scalar/scalar --skill mock-server -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install scalar/scalar mock-server --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/scalar/scalar.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/mock-server .claude/skills/mock-server && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mock-server
GitHub stars
16k
Token cost
~1.2k tokens
SKILL.md length
476 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.

  • Works in 5 steps: Processes and loads the OpenAPI… → Seeds schema data from x-seed extensions… → Registers authentication routes for… → …
  • Tasks that involve OpenAPI specifications
  • SKILL.md covers Overview, Quick Start, createMockServer() Options and Built-in Behavior, plus 4 more sections
  • Calls npx and docker

What it does

Mock Server is an agent skill from scalar/scalar. Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering OpenAPI specifications and Containers. It works with OpenAPI and Docker. The repository describes itself as: Scalar is an open-source API platform: 🌐 Modern REST API Client 📖 Beautiful API References ✨ 1st-Class OpenAPI/Swagger Support. The licence is MIT.

When your agent uses it

  • Tasks that involve OpenAPI specifications
  • Tasks that involve Containers

Example prompts

  • “/mock-server”

Requirements

  • Node.js
  • Docker

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Processes and loads the OpenAPI description document.
  2. Seeds schema data from x-seed extensions (idempotent: only when collection is empty).
  3. Registers authentication routes for declared security schemes.
  4. Registers operation routes for each path + method.
  5. Exposes the source document at

What it can do on your machine

Read from SKILL.md and the folder at commit 854b0f4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx
    • docker

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • scalar.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mock Server loads about 1.2k tokens when it runs. Until then it costs about 38 tokens; SKILL.md has 476 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~38
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from scalar/scalar at commit 854b0f4, republished under its MIT licence (© scalar). 476 words, ~1,161 tokens.

Download SKILL.mdSave it as .claude/skills/mock-server/SKILL.md (or your agent's skills folder).
name
mock-server
description
Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.

Scalar Mock Server Skill

Reference for implementing and debugging mock APIs with @scalar/mock-server. Use this when you need realistic API responses from an OpenAPI description document, custom request behavior, seeded data, or Docker-based mock environments.

Overview

Quick Start

Fastest way to run a mock server from a local OpenAPI description:

bash
npx @scalar/cli document mock openapi.json --watch

Programmatic setup:

ts
import { serve } from '@hono/node-server'
import { createMockServer } from '@scalar/mock-server'

const app = await createMockServer({
  document: './openapi.yaml',
  onRequest({ context, operation }) {
    console.log(context.req.method, context.req.path, operation.operationId)
  },
})

serve({ fetch: app.fetch, port: 3000 })

createMockServer() Options

At least one of the following is required:

  • document: OpenAPI description document as URL, file path, or object
  • specification: deprecated alias for document

Optional:

  • onRequest({ context, operation }): callback before each request is processed
  • validateRequest: set to false to always return a mock response instead of rejecting contract violations with 422 (default: true)
  • logger: pass false to silence the authentication instructions printed on startup, or a (line) => void sink to redirect them (default: logs to the console)

Built-in Behavior

When the server starts, it:

  1. Processes and loads the OpenAPI description document.
  2. Seeds schema data from x-seed extensions (idempotent: only when collection is empty).
  3. Registers authentication routes for declared security schemes.
  4. Registers operation routes for each path + method.
  5. Exposes the source document at:
    • /openapi.json
    • /openapi.yaml

Custom Request Logic with x-handler

Use x-handler in an operation for dynamic behavior instead of static examples.

Helpers available in x-handler:

  • store for in-memory persistence (list, get, create, update, delete, clear)
  • faker for generated test data
  • req for request data (body, params, query, headers)
  • res for response examples by status code (res['200'], res['404'], ...)

Status behavior:

  • store.get() / store.update() => 200 when found, 404 when not found
  • store.create() => 201
  • store.delete() => 204 when deleted, 404 when not found
  • store.list() => 200
  • Returning null/undefined triggers 404 (uses responses.404 example/schema when provided)
Show full SKILL.md (184 more words)Show less

Seed Data with x-seed

Use x-seed on components.schemas.<SchemaName> to seed initial data at startup.

Helpers available in x-seed:

  • seed.count(n, factory)
  • seed(array)
  • seed(factory) (single item shortcut)
  • faker, store, and schema

Key rule: the schema key name is used as the collection name.

Docker Usage

Run the Docker image:

bash
docker run -p 3000:3000 scalarapi/mock-server --url https://api.example.com/openapi.yaml

Document source priority (high to low):

  1. --url <URL>
  2. OPENAPI_DOCUMENT
  3. OPENAPI_DOCUMENT_URL
  4. /docs volume-mounted files

Useful routes:

  • Mock endpoints: from your OpenAPI paths
  • API reference UI: /scalar
  • Description document: /openapi.json, /openapi.yaml

Troubleshooting Checklist

  • Confirm the OpenAPI description document is valid and reachable.
  • Confirm at least one document source is configured (document, --url, env var, or mounted file).
  • If seeded data is missing, check x-seed exists on schema keys and the collection was empty on startup.
  • If auth-protected routes return unauthorized responses, verify matching securitySchemes and request credentials.
  • If custom logic fails, inspect x-handler runtime errors (mock server returns 500 with handler error details).
  • For an unhandled 500 (one whose error is Internal Server Error), read its operation object — it names the method and OpenAPI path that failed, plus the operationId when the document declares one.

© scalar, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/mock-server of scalar/scalar.

Open the folder on GitHubat commit 854b0f4

Compare with similar skills

Mock Server next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mock Server compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mock Server this skillscalar/scalar16k—~1.2kAutomated safety check: PassMIT
Yapi Skillhashgraph-online/awesome-codex-plugins1.2k—~2kAutomated safety check: PassApache-2.0
C4 Containeraiskillstore/marketplace4307 repos~1.4kAutomated safety check: PassNone
Spring Boot Project Creatorgiuseppe-trisciuoglio/developer-kit355—~3.4kAutomated safety check: NotesMIT
Migrate Dotnet9 To Dotnet10dotnet/skills5.6k2 repos~4.8kAutomated safety check: PassMIT
Generate MCP Servertrycompai/comp2k—~2.7kAutomated safety check: PassApache-2.0

Similar skills

  • Yapi Skill

    hashgraph-online/awesome-codex-plugins

    Python stdlib scripts for the YApi OpenAPI (no Java/Docker/MCP) — search interfaces, query details, and sync/upsert one interface's docs from a YApi-native payload (often converted from OpenAPI).

    1.2k GitHub stars~2k tokensUpdated today
    Backend & APIsAuto-check passed
  • C4 Container

    aiskillstore/marketplace

    Expert C4 Container-level documentation specialist. An agent skill from aiskillstore/marketplace.

    430 GitHub starsUsed in 7 repos~1.4k tokens
    Backend & APIsAuto-check passed
  • Spring Boot Project Creator

    giuseppe-trisciuoglio/developer-kit

    Creates and scaffolds a new Spring Boot project (3.x or 4.x) by downloading from Spring Initializr, generating package structure (DDD or Layered architecture), configuring JPA, SpringDoc OpenAPI…

    355 GitHub stars~3.4k tokensUpdated 28 days ago
    Backend & APIsAuto-check: notes
  • Official

    Migrate a .NET 9 project or solution to .NET 10 and resolve all breaking changes.

    5.6k GitHub starsUsed in 2 repos~4.8k tokens
    DevOps & CloudAuto-check passed
  • Generate MCP Server

    trycompai/comp

    A skill your agent uses when generating an MCP server from an OpenAPI spec with Speakeasy.

    2k GitHub stars~2.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Turns an API description, such as an OpenAPI file or a Postman collection, into a connector plugin for ToolJet's marketplace and checks it with the repo's validator.

    41k GitHub stars~2.1k tokensUpdated today
    Backend & APIsAuto-check passed

More from scalar/scalar

  • Scalar's design system — design tokens, theming (@scalar/themes), CSS variables, and the @scalar/components library.

    16k GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Minimal starter runbook for cloud agents to install dependencies, run packages, execute tests, and troubleshoot the Scalar monorepo quickly.

    16k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Openapi Glossary

    scalar/scalar

    Use consistent OpenAPI terminology and definitions when writing documentation, educational material, and tooling guidance.

    16k GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Scalar Docs

    scalar/scalar

    Skill for writing and updating scalar.config.json — Scalar Docs configuration reference for users and LLMs.

    16k GitHub stars~3.6k tokensUpdated today
    Auto-check passed
  • Typescript

    scalar/scalar

    Write clear, predictable TypeScript and Vue TypeScript code with strong typing, maintainability, and consistent documentation conventions.

    16k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Vue Components

    scalar/scalar

    Build Vue 3 components with TypeScript and Tailwind using clean structure, composable logic, accessibility, and maintainable patterns.

    16k GitHub stars~886 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Mock Server

What does Mock Server do?

Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker. Mock Server is an agent skill from scalar/scalar. Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.

When should I use Mock Server?

Mock Server fits situations like: tasks that involve OpenAPI specifications; tasks that involve Containers.

How do I install Mock Server in Claude Code?

Run `npx skills add scalar/scalar --skill mock-server -a claude-code`. Or copy the skill folder (.agents/skills/mock-server in scalar/scalar) into .claude/skills/mock-server in your project. Claude Code loads it when a task matches its description.

How do I install Mock Server in Codex?

Run `npx skills add scalar/scalar --skill mock-server -a codex`. Or copy the skill folder (.agents/skills/mock-server in scalar/scalar) into .agents/skills/mock-server in your project. Codex loads it when a task matches its description.

Can I use Mock Server in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add scalar/scalar --skill mock-server -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mock-server, .gemini/skills/mock-server, .github/skills/mock-server and .opencode/skills/mock-server in your project.

What does Mock Server need to run?

Going by SKILL.md and its folder, Mock Server needs the command-line tools its instructions call (npx and docker). Our summary lists: Node.js; Docker.

Does Mock Server access the network?

SKILL.md names 1 domain. As links in the text: scalar.com. This is read from the text; nothing was executed.

Is Mock Server safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mock Server use?

Mock Server is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mock Server use?

About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mock Server?

Skills that share tags, products or a category with Mock Server: Yapi Skill (hashgraph-online/awesome-codex-plugins, 1.2k stars), C4 Container (aiskillstore/marketplace, 430 stars), Spring Boot Project Creator (giuseppe-trisciuoglio/developer-kit, 355 stars) and Migrate Dotnet9 To Dotnet10 (dotnet/skills, 5.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mock Server?

scalar (a GitHub organization) maintains it in scalar/scalar, which has 16,241 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 8, 2026.

Source: scalar/scalar on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.