← Back to Overview

MOCK SERVERS

Creating Mock Servers

Built-in multi-instance mock servers for offline API simulation — no external tools needed.

Creating a new mock server with name and port

Overview

API Studio includes built-in multi-instance mock servers for offline API simulation. No external tools, Docker containers, or cloud services needed. Each server runs on a configurable port on localhost and is available in Advanced Mode via the Mock+MCP view.

Use cases

Frontend Development

Build UIs without waiting for the backend to be ready

Integration Testing

Test against predictable, deterministic responses

Demo Environments

Showcase features with canned API responses

Offline Prototyping

Design and test APIs without network connectivity

Creating a Server

Create a new mock server in three steps:

1

Open the Mock+MCP view from the top-level view switcher

2

In the Mock Servers section, click + New Mock Server

3

Enter a name and port (e.g., 3100)

Note: The server is created but NOT started yet. Add routes before starting so it has something to respond with.

Configuration

Each mock server has the following configurable settings:

SettingDescription
nameDisplay name for the server in the sidebar
portPort number (1024–65535). Must be unique across all mock servers
auto-startAutomatically start when VS Code opens
swagger enabledServe interactive Swagger UI at /_swagger
max log entriesMaximum request log entries retained (default: 100)
Storage: Mock server configurations are stored in .openpost/mock-servers.json in your workspace root.

Starting & Stopping

Control server state with the play/stop button in the server list:

Running— Server is listening on the configured port
Stopped— Server is idle, port is free
Start — begins listening on the configured port. All configured routes respond to matching requests.
Stop — closes the HTTP server and frees the port.
Unmatched requests — any request that doesn't match a configured route returns 404.
Running mock server with green indicator and Swagger enabled

Auto-Start

Enable auto-start to automatically launch the server when VS Code opens — useful for development servers that should always be available.

Starts automatically after extension activation
Failed auto-starts show an error notification (e.g., port already in use)
Toggle from the server's configuration panel

Multiple Servers

Run as many mock servers as you need simultaneously — each on a different port with independent route configs, logs, and settings.

Common multi-server setup

ServerPortPurpose
REST API3100Main application API
Auth Service3101OAuth / token endpoints
Webhooks3102Webhook receiver for testing callbacks

Each server operates completely independently — starting, stopping, or modifying one does not affect the others.

Import & Export

Share mock server configurations with your team:

Export

Right-click a server → Export. Saves full config + all routes as a JSON file. Includes response bodies, headers, and settings.

Import

Load an exported JSON file to recreate a server with all its routes and configuration.

Tip: Commit exported mock server configs to git so your entire team can import and run the same mock setup.

Next

Ko-fi