Get the FREE Ultimate OpenClaw Setup Guide →

nest-openapi

A modern, modular set of utilities for building OpenAPI-driven NestJS apps.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ts-oas-nest-openapi npx -y @nest-openapi/mcp

How to use

nest-openapi provides a spec-driven MCP server that exposes OpenAPI operations as MCP tools. By using the MCP module for Nest OpenAPI, you can generate tooling endpoints that reflect your OpenAPI spec, enabling automated validation, request/response shaping, and mock capabilities via MCP tooling. This server ties together the validation, serialization, and mock capabilities described in the OpenAPI-driven packages and makes them accessible as reusable MCP commands that can be invoked as part of your API automation and integration workflows.

Once running, you can discover available MCP tools generated from your OpenAPI specification and execute them against your NestJS application. This enables you to perform operations such as validating requests, serializing responses, mocking endpoints, or executing operation-specific actions, all driven by a single source of truth (the OpenAPI spec) and integrated with your NestJS controllers and routes.

How to install

Prerequisites:

  • Node.js (v14+ recommended) and npm/yarn installed
  • Access to a project that uses NestJS and an OpenAPI spec driven by nest-openapi packages

Install the MCP server package:

npm install @nest-openapi/mcp

Alternatively, run via npx (no local install required):

npx -y @nest-openapi/mcp

Usage (example):

  1. Ensure your OpenAPI spec is available in the project, for example at openapi.json or as a TS module.
  2. Run the MCP server that exposes operations from your spec as MCP tools.
  3. Use the generated MCP tools in your workflows or tests to interact with your NestJS application.

Environment and configuration:

  • You may provide the path to your OpenAPI spec via environment variables or configuration files as supported by the MCP package (consult the package docs for exact options).
  • If needed, configure the base URL for your NestJS app and any authentication headers required by your OpenAPI operations.

Tip: For a smoother setup, keep the OpenAPI spec in a predictable location (e.g., ./openapi.json) and reference it in your MCP configuration or environment so tooling remains consistent across environments.

Additional notes

Tips and common issues:

  • Ensure your OpenAPI spec is valid and aligned with your NestJS controllers to avoid generated tool mismatches.
  • If using cache or precompiled serialization, verify that the OpenAPI spec changes are reflected by restarting the MCP server.
  • When running with Docker or CI, pass necessary environment variables for the spec path and the base URL of your NestJS app.
  • Check compatibility with NestJS versions (v9+ is common) and adapters (Express/Fastify) as noted by nest-openapi packages.

Configuration hints:

  • You can customize per-operation behavior via the OpenAPI-driven MCP configuration options supported by the package (e.g., enabling/disabling certain tools, or adjusting validation/serialization behaviors).
  • Monitor OpenAPI spec-driven tooling through logs to quickly diagnose mismatches between the spec and runtime behavior.

Related MCP Servers

Sponsor this space

Reach thousands of developers