mock

A command that creates Postman mock servers from an API collection or specification. A mock server returns example responses so frontend developers can build and test before the real backend is ready.

In plain words
What is it for?
Creating a mock URL from a Postman collection or local OpenAPI specification, generating missing examples, and providing configuration for frontend integration.
Why use it?
Frontend work can be blocked when an API is incomplete or unavailable. Mock responses provide a temporary endpoint for development, integration tests, and demonstrations.

Command

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.

agentmods
npx agentmods add commands/postman-devrel/postman-claude-code-plugin/mock
Clone the repo
git clone --depth 1 https://github.com/Postman-Devrel/postman-claude-code-plugin
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,065 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
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 $0.00017 $0.01065
Opus 5 $0.00009 $0.00532
Sonnet 5 $0.00003 $0.00213
Haiku 4.5 $0.00002 $0.00106

Measured 2d ago against content hash 2b89abd85d5d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

mock scanned grade B with 2 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.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

curl -X POST https://<mock-id>.mock.pstmn.io/pets -d '{"name":"Buddy"}'

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl https://<mock-id>.mock.pstmn.io/pets
commands/mock.md · 102 lines

How it starts

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

Create Mock Servers

Spin up a Postman mock server from a collection or spec. Get a working mock URL for frontend development, integration testing, or demos.

Prerequisites

The Postman MCP Server must be connected. If MCP tools aren't available, tell the user: "Run /postman:setup to configure the Postman MCP Server."

Workflow

Step 1: Find the Source

Call getWorkspaces to get the user's workspace ID. If multiple workspaces exist, ask which to use.

From existing collection:

  • Call getCollections with the workspace parameter
  • Select the target collection

From local spec:

  • Find OpenAPI spec in the project
  • Import it first:
    1. Call createSpec with workspaceId, name, type, and files
    2. Call generateCollection. Async (HTTP 202). Poll getGeneratedCollectionSpecs or getSpecCollections for completion, with increasing waits between polls (2s, 4s, 8s). Note: getAsyncSpecTaskStatus may return 403 on some plans.

Step 2: Check for Examples

Mock servers serve example responses. Call getCollection and check if requests have saved responses.

If examples are missing:

Your collection doesn't have response examples. Mock servers need
these to know what to return.

Generating realistic examples from your schemas...

For each request without examples:

  1. Call getCollectionRequest to get the schema
  2. Generate a realistic example response from the schema
  3. Call createCollectionResponse to save the example

Step 3: Check for Existing Mocks

Before creating a new mock, call getMocks to check if one already exists for this collection. If found, call getMock to get its URL and present it. Only create a new mock if none exists or the user explicitly wants a new one.

Step 4: Create Mock Server

Call createMock with:

  • Workspace ID
  • Collection UID in ownerId-collectionId format (from getCollection response's uid field)
  • Environment ID (if applicable)
  • Name: <api-name> Mock
  • Private: false (or true if user prefers)

Read the full file on GitHub · 102 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 · 102 lines · 17 tokens per session scan B 2b89abd85d5d

Subscribe to this mod's changes

mock is a command published in the GitHub repository Postman-Devrel/postman-claude-code-plugin (38 stars, last pushed 27d ago), licensed Apache-2.0. It adds 17 tokens to every session and 1,065 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other commands, from other repositories