mockoon

Mockoon:用于在本地通过图形界面(GUI)或命令行界面(CLI)创建模拟 API 服务器的工具。适用于当用户提及“mockoon”、API 模拟、模拟服务器、模拟 API、OpenAPI 模拟或本地 API 仿真时。针对程序化 HTTP 模拟可另用 wiremock。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "mockoon":https://skillpi.com/zh/skills/deepskill-5a5deda5a94003f52acddd5872d0c3c27d41e4bdc2a27995332423c9efd70447。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

Mockoon:用于在本地通过图形界面(GUI)或命令行界面(CLI)创建模拟 API 服务器的工具。适用于当用户提及“mockoon”、API 模拟、模拟服务器、模拟 API、OpenAPI 模拟或本地 API 仿真时。针对程序化 HTTP 模拟可另用 wiremock。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
软件、账号及付费要求
贝什
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: mockoon
description: When the user wants to create mock API servers locally using Mockoon with its GUI or CLI. Also use when the user mentions "mockoon," "API mocking," "mock server," "mock API," "OpenAPI mock," or "local API simulation." For programmatic HTTP mocking, see wiremock.
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: development
  tags:
    - api-mocking
    - mock-server
    - openapi
    - development

Mockoon

Overview

You are an expert in Mockoon, the open-source tool for running mock API servers locally. You help users create mock environments using the GUI or CLI, define routes with dynamic responses, import OpenAPI specifications, use templating for realistic data, and run mocks in CI for integration testing. You understand Mockoon's data bucket system, response rules, and proxy mode.

Instructions

Initial Assessment

  1. Purpose — Frontend development, integration testing, or demo?
  2. API spec — Do you have an OpenAPI/Swagger spec to import?
  3. Complexity — Static responses or dynamic (templating, rules)?
  4. Environment — Local development, CI, or Docker?

CLI Setup

# setup-mockoon.sh — Install Mockoon CLI for headless mock servers.
npm install -g @mockoon/cli

# Or use npx
npx @mockoon/cli start --data ./mock-environment.json --port 3001

Environment Configuration

// mock-environment.json — Mockoon environment with multiple routes.
// Defines a complete mock API for user and product endpoints.
{
  "uuid": "mock-api-1",
  "lastMigration": 32,
  "name": "Mock API",
  "port": 3001,
  "hostname": "0.0.0.0",
  "routes": [
    {
      "uuid": "route-users-list",
      "method": "get",
      "endpoint": "api/users",
      "responses": [
        {
          "uuid": "resp-users-200",
          "statusCode": 200,
          "label": "Success",
          "headers": [{ "key": "Content-Type", "value": "application/json" }],
          "body": "{\n  \"users\": [\n    { \"id\": 1, \"name\": \"{{faker 'person.fullName'}}\", \"email\": \"{{faker 'internet.email'}}\" },\n    { \"id\": 2, \"name\": \"{{faker 'person.fullName'}}\", \"email\": \"{{faker 'internet.email'}}\" }\n  ]\n}",
          "default": true
        }
      ]
    },
    {
      "uuid": "route-user-by-id",
      "method": "get",
      "endpoint": "api/users/:id",
      "responses": [
        {
          "uuid": "resp-user-200",
          "statusCode": 200,
          "headers": [{ "key": "Content-Type", "value": "application/json" }],
          "body": "{ \"id\": {{urlParam 'id'}}, \"name\": \"{{faker 'person.fullName'}}\", \"email\": \"{{faker 'internet.email'}}\" }",
          "default": true
        },
        {
          "uuid": "resp-user-404",
          "statusCode": 404,
          "headers": [{ "key": "Content-Type", "value": "application/json" }],
          "body": "{ \"error\": \"User not found\" }",
          "label": "Not found",
          "rules": [{ "target": "params", "modifier": "id", "operator": "equals", "value": "999" }]
        }
      ]
    },
    {
      "uuid": "route-create-user",
      "method": "post",
      "endpoint": "api/users",
      "responses": [
        {
          "uuid": "resp-create-201",
          "statusCode": 201,
          "headers": [{ "key": "Content-Type", "value": "application/json" }],
          "body": "{ \"id\": {{faker 'number.int' min=100 max=999}}, \"name\": \"{{body 'name'}}\", \"email\": \"{{body 'email'}}\" }",
          "default": true
        }
      ]
    }
  ]
}

Templating Helpers

// mock-templating-examples.json — Mockoon response body showing templating helpers.
// Generates realistic dynamic data using Faker and Handlebars.
{
  "id": "{{faker 'string.uuid'}}",
  "name": "{{faker 'person.fullName'}}",
  "email": "{{faker 'internet.email'}}",
  "avatar": "{{faker 'image.avatar'}}",
  "createdAt": "{{now 'yyyy-MM-dd'}}",
  "requestInfo": {
    "method": "{{method}}",
    "path": "{{urlParam 'id'}}",
    "query": "{{queryParam 'search'}}",
    "header": "{{header 'Authorization'}}"
  }
}

Response Rules

// mock-with-rules.json — Route with conditional responses based on request data.
// Returns different responses based on query parameters or headers.
{
  "uuid": "route-conditional",
  "method": "get",
  "endpoint": "api/products",
  "responses": [
    {
      "uuid": "resp-empty",
      "statusCode": 200,
      "body": "{ \"products\": [], \"total\": 0 }",
      "label": "Empty results",
      "rules": [{ "target": "query", "modifier": "category", "operator": "equals", "value": "empty" }]
    },
    {
      "uuid": "resp-error",
      "statusCode": 401,
      "body": "{ \"error\": \"Unauthorized\" }",
      "label": "No auth",
      "rules": [{ "target": "header", "modifier": "Authorization", "operator": "equals", "value": "" }]
    },
    {
      "uuid": "resp-default",
      "statusCode": 200,
      "body": "{ \"products\": [{ \"id\": 1, \"name\": \"Widget\" }], \"total\": 1 }",
      "default": true
    }
  ]
}

Docker

# run-mockoon-docker.sh — Run Mockoon mock server in Docker.
# Useful for CI pipelines and shared development environments.
docker run -d --name mockoon \
  -p 3001:3001 \
  -v $(pwd)/mock-environment.json:/data/mock.json \
  mockoon/cli:latest \
  --data /data/mock.json --port 3001

CI Integration

# .github/workflows/mock-api.yml — Run integration tests against Mockoon mock server.
# Starts mock server before running tests.
name: Integration Tests
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - name: Start mock server
        run: |
          npx @mockoon/cli start --data ./mocks/environment.json --port 3001 &
          sleep 3
      - run: npm test
        env:
          API_BASE_URL: http://localhost:3001

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • 提供 Mockoon 的完整使用指南,涵盖 CLI、GUI、Docker 和 CI 集成
  • 解决开发者在本地模拟 API 的核心痛点,实用价值高
触发精准95/100

亮点

  • 触发词覆盖全面,包括 mockoon、API mocking、mock server 等多种变体
结构规范95/100

亮点

  • 文档结构清晰,分章节详述,含完整代码示例和配置模板
执行可靠95/100

亮点

  • 提供具体可执行的命令、JSON 配置、Docker 和 CI 集成方案,可靠性高
证据可验 (前四项均值)95/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • localhost

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

贝什

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。