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

@yunser-new/yapi-mcp

v0.0.6

Published

MCP server for using the Yapi API

Downloads

15

Readme

YAPI MCP 工具

这是一个用于获取 YAPI 接口信息的 MCP(Model Context Protocol)工具。

功能特点

  • 通过 URL 获取 YAPI 接口详细信息
  • 支持工具名称自定义前缀
  • 支持命令行参数配置

安装

# 安装依赖
npm install @modelcontextprotocol/sdk axios zod

配置

工具运行需要以下配置:

  1. YAPI Token:从 YAPI 平台获取的访问令牌
  2. YAPI URL:YAPI 服务器地址

使用方法

基本使用

node yapi-mcp.ts --token=your_token --url=https://yapi.example.com

参数说明

  • --token: (必需)YAPI 访问令牌
  • --url: (必需)YAPI 服务器地址
  • --prefix: (可选)工具名称前缀

示例

  1. 基本使用(工具名称为 getApiSpec):
node yapi-mcp.ts --token=your_token --url=https://yapi.example.com
  1. 使用自定义前缀(工具名称为 customPrefixGetApiSpec):
node yapi-mcp.ts --token=your_token --url=https://yapi.example.com --prefix=customPrefix

工具使用

在支持 MCP 的环境中,可以通过以下方式调用工具:

// 基本调用
getApiSpec({
    url: "https://yapi.example.com/project/22/interface/api/14799"
})

// 带前缀调用(如果配置了前缀)
customPrefixGetApiSpec({
    url: "https://yapi.example.com/project/22/interface/api/14799"
})

返回数据

工具会返回接口的详细信息,包括:

  • 接口标题
  • 请求路径
  • 请求方法
  • 请求参数
  • 响应数据结构
  • 接口描述 等

注意事项

  1. 确保提供的 YAPI Token 具有足够的访问权限
  2. URL 必须是完整的 YAPI 接口地址
  3. 如果使用前缀功能,建议使用有意义的前缀名称

错误处理

工具会在以下情况返回错误:

  • 无效的 YAPI URL
  • Token 无效或过期
  • 接口不存在
  • 网络连接问题

开发说明

如需修改或扩展工具功能,主要文件说明:

  • yapi-mcp.ts: 主程序文件
  • .npmrc: npm 配置文件,用于设置 registry 和认证信息