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

yapi-to-definition

v0.1.2

Published

MCP server that generates TypeScript or JavaScript definitions from private YApi interface links.

Readme

YApi to Definition

Generate TypeScript types or JavaScript JSDoc definitions from private YApi interface links. Credentials stay in the MCP process and are never tool arguments or results.

MCP configuration

{
  "mcpServers": {
    "yapi-auto-mcp": {
      "command": "npx",
      "args": ["-y", "yapi-to-definition", "--stdio"],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN_123": "project-123-token",
        "YAPI_TOKEN_456": "project-456-token"
      }
    }
  }
}

The project id is parsed from /project/<id>/ in the YApi interface URL. Configure one YAPI_TOKEN_<id> variable for each project. Use plain environment-variable names and plain URL strings; do not include Markdown escapes or ${PROJECTID} placeholders.

STDIO MCP clients can use the same npx command. Codex supports STDIO commands, arguments, and environment variables in MCP configuration.

Local development

npm install

For multiple YApi domains, configure each project once with the included helper. The default config file is ~/.config/yapi-to-definition/config.json on macOS/Linux and %APPDATA%\\yapi-to-definition\\config.json on Windows.

npm run config -- add https://yapi.example.com 123

For a YApi instance installed below a path, include it in the base URL:

npm run config -- add https://example.com/yapi 123

The command prompts for the token without echoing it. For secret-manager or CI environments, store only an environment-variable reference:

npm run config -- add https://yapi.example.com 123 --token-env YAPI_TOKEN_PROJECT_123

The older single-project YAPI_BASE_URL, YAPI_PROJECT_ID, and YAPI_TOKEN combination is also supported.

The generated configuration file contains a project token unless --token-env is used. Keep it user-readable only and never commit it. Configuration is reloaded on every tool call, so adding another project does not require restarting the MCP server.

Connect to Codex

Add the local STDIO server in Codex settings, or add this to ~/.codex/config.toml:

[mcp_servers.yapi_to_definition]
command = "npx"
args = ["-y", "yapi-to-definition", "--stdio"]

[mcp_servers.yapi_to_definition.env]
YAPI_BASE_URL = "https://yapi.example.com"
YAPI_TOKEN_123 = "project-123-token"

Restart Codex, then ask:

Generate TypeScript definitions from https://yapi.example.com/project/123/interface/api/456

Use language: "js" when JavaScript JSDoc output is needed. The MCP server exposes one read-only tool: generate_yapi_definition.

Other MCP clients can use the same STDIO command and arguments. No Codex-only API is required.