Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

proxy

proxy starts a GraphQL HTTP server that executes incoming operations against an upstream GraphQL server and merges the response with mock data generated by a provider. This is ideal for interactive demos or manual testing with tools like GraphiQL, Postman or Curl.

mockql proxy [OPTIONS] --port <PORT> --graphql-url <GRAPHQL_URL> <COMMAND>

<COMMAND> is the provider transport: cli or http.

Local Server

The proxy exposes:

  • POST /graphql for GraphQL requests.
  • GET /graphiql and GET / for a GraphiQL interface.
  • GET /health for a health check.

CLI Provider

Use cli when you want MockQL to call an installed assistant CLI. CLI provider setup and defaults are documented in CLI Providers.

mockql proxy \
  --port 4000 \
  --graphql-url https://swapi-graphql.netlify.app/graphql \
  cli --provider codex --model gpt-5.4-mini

Open http://localhost:4000/graphiql

HTTP Provider

Use http when you want MockQL to call an HTTP provider. HTTP provider setup, flags, and authentication are documented in HTTP Providers.

mockql proxy \
  --port 4000 \
  --graphql-url https://swapi-graphql.netlify.app/graphql \
  http <provider> [provider options]

Open http://localhost:4000/graphiql

Options

OptionDescription
--port <PORT>Port for the mock GraphQL server.
--graphql-url <GRAPHQL_URL>GraphQL server URL used for schema introspection and upstream execution.
--schema <SCHEMA>Optional path to a GraphQL schema file. If omitted, the schema is loaded from --graphql-url via introspection.
--introspection-header <INTROSPECTION_HEADERS>Additional headers to include in the introspection query if no local schema was provided. Specify as name:value; repeat the flag for multiple headers.
--timeout <TIMEOUT>Timeout for provider execution, e.g. 30s or 2m. Default: 1m.
--format <FORMAT>Serialization format for the mock response prompt. Possible values: json, toon. Default: json.