Prism CLI

Prism is a CLI for OpenAPI tests: clients receive responses from the API description while the backend is still being built.

  • 5,064 ★ on the repository
  • Last commit
  • Apache-2.0
CLI

Extended access

Why this level

  • The CLI starts a local HTTP server and can fetch its specification by URL.
  • Proxy mode forwards HTTP requests to the specified API, including mutations if the client sends them.
All reasons and checks

stoplightio/prism

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/prism

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The CLI starts a local HTTP server and can fetch its specification by URL.
  • Proxy mode forwards HTTP requests to the specified API, including mutations if the client sends them.

This is third-party code. Review the repository files before installing.

What it does

Prism is a CLI for starting a mock HTTP server from an API specification. Developers supply an OpenAPI document or Postman collection and receive an endpoint for a client before the backend is ready. It generates contract-based responses and validates requests. In proxy mode, Prism forwards traffic to an existing API and identifies differences from its specification. The same schema can therefore support initial client development and later contract checks against the implementation.

Who it is for. Frontend developers and testers who have agreed on API requests and responses but are still waiting for the backend.

Good fit when

  • An API designer shares OpenAPI and a developer connects a client to its mock.
  • A tester compares a running service’s responses with the agreed specification.
  • A CI job starts an HTTP server from the contract stored alongside its tests.
  • An API consumer checks valid requests before gaining access to the real system.

Not a fit when

  • The team expects mock-created data to persist between requests like a database.
  • A developer wants to generate OpenAPI automatically from recorded HTTP traffic.
  • The product needs real business logic beyond the described responses.

Example request

Start Prism locally from our OpenAPI and show available paths. Do not call the real API or enable proxy mode yet.

Limitations

The local CLI requires Node.js; the README installation section specifies version 18.20.1 or later. Persistence of mock data across requests remains unchecked on the project roadmap. Recording HTTP traffic and learning a specification from it is also listed as future work. The server binds to localhost by default, making a Docker instance unreachable from outside its container unless its binding address and port exposure are configured explicitly.

How to disable. Stop `prism mock` or `prism proxy` and remove its startup from CI. Restore the client’s normal API endpoint; the specification file remains on disk.

FAQ

How do I start a mock server?

After installation run `prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml`. The CLI lists available URLs; call one with your client, then substitute your own specification.

Why does a URL with basePath return 404?

Prism does not require `basePath` in the request path. The README example uses `http://localhost:4010/hello`, while `/api/v1/hello` fails. Use the exact URL printed by the CLI.

How do I validate an existing API?

`prism proxy` forwards requests to a running service and reports differences from OpenAPI. Select a test environment, point the client at the proxy and compare the reported errors with the agreed API description.

Why is my running Docker mock unreachable?

Prism binds to localhost by default. The README recommends `-h 0.0.0.0` for Docker; also expose the required container port after setting the binding address.

Which specification formats are supported?

The README lists OpenAPI 2.0, 3.0, 3.1 and Postman collections. Choose a file in a supported format and use it as the mock source.

Discussion

No questions or reviews yet.

CLI tools

The CLI generates API tests from schemas and gives agents reproducible failures in responses and operation sequences.

CLIExtended access3.7KRepository stars
Official

aimock is a test-API CLI that validates local fixture files before starting a server or exercising the application.

CLIExtended access1KRepository stars

MCP server: an agent sends GET, POST, PUT, DELETE and PATCH to your REST API and gets back status, headers and body

MCP serverExtended access103Repository stars

The interactive HTTP client lets you inspect a browser request, change parameters and explore its response in the terminal.

CLIExtended access10.7KRepository stars
Editors’ pick

A CLI for testing and red teaming LLM applications: compares models, runs automated CI checks and finds vulnerabilities

CLIExtended access26.9KRepository stars
Official

Postman's official MCP server: workspaces, collections, specs and environments straight from your agent

MCP serverExtended access326Repository stars

README in short

The author distinguishes the local open-source server from hosted Stoplight options. The CLI runs standalone or in CI. README examples demonstrate mocking and a contract-validation proxy separately.

README badge

Report a problem

Foxx AIPrism
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.