npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nuxt-openapi-wrapper

v3.1.0

Published

An openapi client wrapper for Nuxt fetch client.

Readme

Nuxt Typesafe OpenAPI Fetch wrapper

npm version npm downloads License Nuxt

Generates a typesafe fetch client for Nuxt and Nitro using Openapi-ts.

Usage

Install the module:

npx nuxi module add nuxt-openapi-wrapper

Configure the api clients:

export default defineNuxtConfig({
  modules: ['nuxt-openapi-wrapper'],
  openAPIWrapper: {
    // config options for openAPI-ts
    openApiTsConfig: {},
    apis: {
      github: {
        baseUrl: 'https://api.github.com',
        // no explicit openAPI document. Will look for an openapi.{json,yaml} in the ./openapi/github directory
      },
      gitlab: {
        baseUrl: 'https://gitlab.com',
        // explicit openAPI document.
        openApi:
          'https://gitlab.com/gitlab-org/gitlab/-/raw/master/doc/api/openapi/openapi.yaml?inline=false',
      },
    },
  },
});

That's it! You can now use Nuxt OpenAPI wrapper in your Nuxt app ✨

const x = await $fetchGithub('/advisories/{ghsa_id}' /* auto completion! */, {
  pathParams: {
    // support for path parameters!
    ghsa_id: '2', // typesafety!
  },
});

console.log(x.description); // typesafe response type!

Customizing the client

Often you want to customize the client, e.g. so it always adds an authentication header to requests.

Disable auto import for the base client

export default defineNuxtConfig({
  modules: ['nuxt-openapi-wrapper'],
  openAPIWrapper: {
    apis: {
      github: {
        baseUrl: 'https://api.github.com',
        clients: { nuxt: { autoImport: false }}
        ...

Add a new ts file to your composables folder, e.g. ./composables/githubClient.ts.

// import the base client explicitly
import {
  $fetchGithub as _$fetchGithub,
  useGithubFetch as _useGithubFetch,
  useLazyGithubFetch as _useLazyGithubFetch,
} from '#openapi-wrapper';

// you might need to add // @ts-ignore error
export const $fetchGithub: typeof _$fetchGithub = (path, opts?) => {
  // customize the request
  opts ??= {};

  opts.onRequest = (ctx) =>
    ctx.options.headers.append('Authorization', 'Bearer 1234');

  opts.onResponse = (ctx) => console.log('response!');

  return _$fetchGithub(path, opts);
};

// Do the same for useGithubFetch and useLazyGithubFetch

You can also create a custom Nitro fetch client. E.g. by creating a ./server/utils/githubClient.ts file.

Nuxt composable example

Nitro utils example

MCP Integration (AI Agent Support)

This module integrates with nuxt-mcp-dev to expose your OpenAPI schemas as MCP (Model Context Protocol) tools. This allows AI agents like Claude to query your API schemas during development.

Enabling MCP

MCP tools are automatically enabled when nuxt-mcp-dev is installed. You can explicitly control this behavior:

export default defineNuxtConfig({
  modules: ['nuxt-openapi-wrapper', 'nuxt-mcp-dev'],
  openAPIWrapper: {
    // Enable/disable MCP tools for all APIs (default: true when nuxt-mcp-dev is installed)
    exposeToMcp: true,
    apis: {
      github: {
        baseUrl: 'https://api.github.com',
        // Override at the API level
        exposeToMcp: false,
      },
      gitlab: {
        baseUrl: 'https://gitlab.com',
        // This API will use the module-level setting (true)
      },
    },
  },
});

Available MCP Tools

When enabled, the following tools are registered for AI agents to query your OpenAPI schemas. All tools require schemaName to select which API schema to query.

| Tool | Optional Parameters | Description | |------|---------------------|-------------| | nuxt-openAPI-wrapper__get-openAPI-schema | - | Gets the entire OpenAPI schema | | nuxt-openAPI-wrapper__get-openAPI-schema-paths | pathRegex, supportedHTTPMethods | Gets API paths, filtered by regex and/or HTTP methods | | nuxt-openAPI-wrapper__get-openAPI-schema-webhooks | webhookNameRegex | Gets webhooks, filtered by name regex | | nuxt-openAPI-wrapper__get-openAPI-schema-security | schemeNameRegex | Gets security schemes and global security requirements | | nuxt-openAPI-wrapper__get-openAPI-schema-tags | tagNameRegex | Gets tags, filtered by name regex | | nuxt-openAPI-wrapper__get-openAPI-schema-externalDocs | - | Gets external documentation links | | nuxt-openAPI-wrapper__get-openAPI-schema-extensions | extensionNameRegex | Gets extension fields (x-*) | | nuxt-openAPI-wrapper__get-openAPI-schema-components-schemas | schemaNameRegex | Gets component schemas | | nuxt-openAPI-wrapper__get-openAPI-schema-components-responses | responseNameRegex | Gets component responses | | nuxt-openAPI-wrapper__get-openAPI-schema-components-parameters | parameterNameRegex | Gets component parameters | | nuxt-openAPI-wrapper__get-openAPI-schema-components-examples | exampleNameRegex | Gets component examples | | nuxt-openAPI-wrapper__get-openAPI-schema-components-requestBodies | requestBodyNameRegex | Gets component request bodies | | nuxt-openAPI-wrapper__get-openAPI-schema-components-headers | headerNameRegex | Gets component headers | | nuxt-openAPI-wrapper__get-openAPI-schema-components-links | linkNameRegex | Gets component links | | nuxt-openAPI-wrapper__get-openAPI-schema-components-callbacks | callbackNameRegex | Gets component callbacks | | nuxt-openAPI-wrapper__get-openAPI-schema-components-pathItems | pathItemNameRegex | Gets component path items | | nuxt-openAPI-wrapper__write-openAPI-schema | overwrite | Writes the schema to absoluteFilePath (required) |

All regex parameters are case-insensitive. The supportedHTTPMethods parameter accepts an array of lowercase HTTP methods (e.g., ["get", "post"]).

Contribution

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release