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

@vurb/openapi-gen

v3.7.1

Published

OpenAPI-to-Vurb Server Generator. Parses OpenAPI 3.x and Swagger 2.0 specs and generates a complete, ready-to-run MCP Server with full MVA tool stacks (Presenters, Tools, Registry, Server) — all features configurable via YAML.

Downloads

281

Readme


Parse any OpenAPI 3.x or Swagger 2.0 spec and generate a complete, ready-to-run MCP Server powered by Vurb.ts — with Presenters, Tools, ToolRegistry, and server bootstrap. All features configurable via YAML.

What It Generates

output/
├── models/                # M — Zod schemas (data boundary)
│   ├── pet.schema.ts
│   └── store.schema.ts
├── views/                 # V — createPresenter() (perception layer)
│   ├── pet.presenter.ts
│   └── store.presenter.ts
├── agents/                # A — Agent layer — defineTool()
│   ├── pet.tool.ts
│   └── store.tool.ts
├── server.ts              # MCP Server bootstrap
└── index.ts               # ToolRegistry + registerAll barrel

Every file follows the MVA Convention — the standard directory structure for Vurb.ts projects.

Quick Start

# 1. Generate from OpenAPI spec
npx openapi-gen --input ./petstore.yaml --output ./generated

# 2. Run the generated server
API_BASE_URL=https://api.example.com npx tsx ./generated/server.ts

Configuration

Create an openapi-gen.yaml file in your project root:

input: ./specs/petstore.yaml
output: ./generated

features:
  tags: true              # Add tags to tools
  annotations: true       # Infer readOnly, destructive, idempotent from HTTP method
  presenters: true        # Generate Presenter files with response schemas
  descriptions: true      # Include summaries/descriptions on actions
  serverFile: true        # Generate server.ts bootstrap
  deprecated: comment     # 'include' | 'skip' | 'comment'

naming:
  style: snake_case       # 'snake_case' | 'camelCase'
  deduplication: true     # Auto-suffix duplicates

server:
  name: petstore-mcp
  version: 1.0.0
  transport: stdio        # 'stdio' | 'sse'
  toolExposition: flat    # 'flat' | 'grouped'

CLI Options

| Flag | Description | Default | |------|-------------|---------| | --input <path> | Path to OpenAPI YAML/JSON spec | From config | | --output <dir> | Output directory | ./generated | | --config <path> | Path to config file | Auto-detect | | --base-url <expr> | Base URL expression for fetch calls | ctx.baseUrl | | --server-name <name> | MCP Server name | openapi-mcp-server | | --context <import> | Custom context type import | Default ApiContext |

Programmatic API

import { parseOpenAPI, mapEndpoints, emitFiles, mergeConfig } from '@vurb/openapi-gen';

const spec = parseOpenAPI(yamlString);
const mapped = mapEndpoints(spec);
const config = mergeConfig({ features: { tags: true }, includeTags: ['pet'] });
const files = emitFiles(mapped, config);

for (const file of files) {
    writeFileSync(`./out/${file.path}`, file.content);
}

Swagger 2.0 Support

Swagger 2.0 specs are automatically detected and converted to OpenAPI 3.0 internally. No extra configuration needed — just point to your spec:

# Works with Swagger 2.0 specs out of the box
npx openapi-gen --input ./petstore-v2.json --output ./generated

The converter handles:

| Swagger 2.0 | → OpenAPI 3.0 | |---|---| | host + basePath + schemes | servers array | | definitions | components.schemas | | parameters[in: body] | requestBody | | parameters[in: formData] | requestBody (multipart) | | #/definitions/Pet | #/components/schemas/Pet | | produces / consumes | Per-operation content types |

Runtime mode (loadOpenAPI()) also accepts Swagger 2.0:

import { loadOpenAPI } from '@vurb/openapi-gen';

// Swagger 2.0 JSON — auto-converted internally
const tools = loadOpenAPI(swagger2Json, { baseUrl: 'https://petstore.swagger.io/v2' });
registry.registerAll(...tools);

Pipeline

OpenAPI 3.x / Swagger 2.0 Spec (YAML/JSON)
        │
        ▼
  ┌──────────────────┐
  │ Swagger2Converter │  → Auto-detect & convert 2.0 → 3.0 (if needed)
  └──────────────────┘
        │
        ▼
  ┌─────────────┐
  │ OpenApiParser │  → ApiSpec IR (groups, actions, params, responses)
  └─────────────┘
        │
        ▼
  ┌───────────────┐
  │ EndpointMapper │  → Named actions (snake_case), dedup, annotations
  └───────────────┘
        │
        ▼
  ┌────────────┐
  │ CodeEmitter │  → TypeScript files (Presenters, Tools, Registry, Server)
  └────────────┘

Installation

npm install @vurb/openapi-gen

Peer Dependencies

| Package | Version | |---------|---------| | vurb | ^2.0.0 | | zod | ^3.25.1 \|\| ^4.0.0 |

Requirements

  • Node.js ≥ 18.0.0
  • Vurb.ts ≥ 2.0.0 (peer dependency)

License

Apache-2.0