mc-postman-viewer
v1.1.0
Published
World-class CLI to visualize Postman collections in a browser — Monaco editor, interactive canvas, full API docs, dark/light themes, and one-click PDF export.
Maintainers
Readme
mc-postman-viewer
A world-class CLI that turns any Postman collection into a beautiful, interactive browser UI — Monaco editor, visual API canvas, full documentation, built-in mock server, integrated REST client, dark/light themes, and one-click PDF export.
Screenshots




Features
| Feature | Details |
|---|---|
| Monaco Editor | Full JSON editor with syntax highlighting, minimap, and auto-format |
| Visual Canvas | Collapsible folder tree with method badges, auth indicators, and hover effects |
| API Documentation | Table of contents + full endpoint reference with params, headers, and request body tables |
| Mock Server | Instantly serve canned responses from collection example responses on a separate port |
| Mock Client | Built-in REST client with route/example dropdowns, Monaco response viewer, and header management |
| PDF Export | Clean print window with white-background, print-safe layout |
| Dark / Light Theme | Seamless toggle — CSS custom properties ensure every element switches correctly |
| Animated Splitter | Drag to resize editor and canvas panes; gradient handle with pulse animation |
| WebSocket Live Reload | Hit ↺ Reload to re-read the file or re-fetch the URL without restarting |
| 4 View Modes | Both · Editor only · Canvas only · Docs only |
| Splash Screen | Animated welcome screen with feature highlights on first load |
| Guided Tour | Step-by-step walkthrough of every UI element |
| Context Help | Hover ? badges on any control for instant inline explanations |
| Local file or URL | Load from disk with -f or fetch from any HTTP URL with -r |
Quick Start
Run without installing
npx mc-postman-viewer -f ./my-collection.jsonInstall globally
npm install -g mc-postman-viewer
postman-viewer -f ./my-collection.jsonThe browser opens automatically at http://localhost:3000.
Usage
postman-viewer [options]
Options:
-f, --file <path> Path to a local Postman collection JSON file
-r, --url <url> URL to fetch a Postman collection JSON from
-p, --port <number> Port to run the viewer on (default: 3000)
--mock Start a mock server from collection example responses
--mock-port <number> Port for the mock server (default: 4001)
--no-open Do not auto-open the browser
-V, --version Output the version number
-h, --help Display helpExamples
# Load a local file
postman-viewer -f ./samples/petstore.json
# Fetch from a URL
postman-viewer -r https://raw.githubusercontent.com/your-org/repo/main/collection.json
# Start viewer + mock server together
postman-viewer -f ./samples/mock-demo.json --mock
# Mock server on a custom port
postman-viewer -f ./samples/mock-demo.json --mock --mock-port 5000
# Custom viewer port, no auto-open
postman-viewer -f ./collection.json -p 4000 --no-open
# Use npx directly without installing
npx mc-postman-viewer -f ./my-collection.jsonPanes
Left — Monaco Editor The raw collection JSON is loaded into the Monaco editor (same engine as VS Code). Inspect, search, and read the full source with syntax highlighting and minimap.
Right — Canvas A visual, folder-grouped tree of every endpoint. Each folder is collapsible. Rows show:
- HTTP method badge with colour coding
- Endpoint name and URL
- Auth type badge (Bearer, OAuth2, API Key, Basic)
Right — Documentation A rendered API reference suitable for sharing or printing:
- Cover page with collection name and description
- Table of contents with method badges
- Per-endpoint sections: URL, description, parameters, headers, and request body
Right — Mock Client A full REST client for testing your mock server:
- Route dropdown auto-populated from the running mock server
- Example dropdown selects a specific saved response via
X-Mock-Response-Name - Monaco editor for the response body (syntax highlighted, pretty-printed, read-only)
- Response headers table
- Status badge (colour-coded) and response time
Mock Server
The --mock flag starts a second Express server on --mock-port (default 4001). It reads every response[] example in the collection and registers them as live HTTP routes.
postman-viewer -f ./samples/mock-demo.json --mockConsole output shows every registered route:
Mock Server running at http://localhost:4001
Routes index: http://localhost:4001/mock-routes
Registered 9 mock route(s):
GET /v2/pets [200 OK – pet list, 500 Internal Server Error]
GET /v2/pets/:petId [200 OK – single pet, 404 Not Found]
POST /v2/pets [201 Created, 400 Bad Request]
...Selecting a specific example response
Pass the X-Mock-Response-Name header with the exact example name:
# Returns the 404 example instead of the default 200
curl http://localhost:4001/v2/pets/1 -H "X-Mock-Response-Name: 404 Not Found"Route index
curl http://localhost:4001/mock-routesReturns a JSON array of all registered routes with their example names.
Keyboard & Controls
| Control | Action |
|---|---|
| Drag splitter | Resize editor / canvas panes |
| Click folder header | Collapse / expand folder |
| Both / Editor / Canvas / Docs | Switch view layout |
| Canvas / Documentation / Mock Client | Switch right pane content |
| 🌙 Dark / ☀ Light | Toggle theme |
| ↺ Reload | Re-read file or re-fetch URL live |
| ⬇ Export PDF | Open print-ready docs in a new window |
| ? (help badges) | Hover any ? badge for context-sensitive help |
| Tour button | Click to start the guided walkthrough |
HTTP Method Colours
| Method | Colour | |---|---| | GET | Green | | POST | Blue | | PUT | Amber | | PATCH | Purple | | DELETE | Red | | HEAD | Gray | | OPTIONS | Teal |
Sample Collections
Three ready-to-use collections are included in samples/.
mock-demo.json — Mock Server Demo
A Petstore-style collection with full example responses on every endpoint — designed specifically to test the mock server and built-in client.
postman-viewer -f ./samples/mock-demo.json --mockFolders: Pets · Store · Users
Routes: 9 · Examples: 16 (200, 201, 204, 400, 404, 500)
petstore.json — Petstore API
A classic REST API for a pet store (no saved examples — viewer/docs use).
postman-viewer -f ./samples/petstore.jsonFolders: Pets · Store · User
Endpoints: 16 · Auth: Bearer, API Key
github-api.json — GitHub REST API
A curated subset of the GitHub v3 API.
postman-viewer -f ./samples/github-api.jsonFolders: Authentication · Repositories · Branches & Commits · Pull Requests · Issues
Endpoints: 18 · Auth: Bearer (PAT)
Postman Collection Format
mc-postman-viewer supports Postman Collection v2.1. To export from Postman:
- Open your collection in Postman
- Click the ⋯ menu next to the collection name
- Select Export
- Choose Collection v2.1
- Save the
.jsonfile and pass it topostman-viewer -f
For mock server support, make sure your requests have saved example responses (response[] in the collection JSON).
