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

@solumon/mcp-server-yapi

v0.1.0

Published

YApi MCP server with LDAP login and Cookie session authentication

Readme

@solumon/mcp-server-yapi

npm version license

YApi MCP Server:通过 LDAP 账号登录,用 Cookie 会话访问 YApi,让 LLM 用自然语言管理接口文档。

基于 kales0202/mcp-server-yapi 改造,鉴权改为 LDAP + 本地会话缓存。

核心功能

  • LDAP 登录: /api/user/login_by_ldap,无需配置项目 Token
  • 会话缓存: Cookie 持久化到 ~/.mcp-server-yapi/session.json,进程重启可复用
  • 项目管理: 获取项目基本信息、列出可访问项目
  • 接口管理: 创建/保存、获取接口信息
  • 接口分类: 创建分类、获取分类菜单
  • 接口列表: 获取项目或分类下的接口列表
  • 路径模糊匹配: 按 path 模糊查询接口,无需记住接口 ID

客户端配置

安装要求

  • Node.js >= 18.19.0
  • Cursor / Windsurf / Claude Desktop 等支持 MCP 的客户端

配置示例

{
  "mcpServers": {
    "mcp-server-yapi": {
      "command": "npx",
      "args": ["-y", "@solumon/mcp-server-yapi"],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_USERNAME": "your_ldap_username",
        "YAPI_PASSWORD": "your_password",
        "MCP_DEBUG_CONSOLE": "false"
      }
    }
  }
}

| 环境变量 | 说明 | |---------|------| | YAPI_BASE_URL | YApi 服务地址 | | YAPI_USERNAME | LDAP 登录账号(请求时映射为接口字段 email) | | YAPI_PASSWORD | LDAP 登录密码 | | YAPI_SESSION_FILE | 可选,会话 Cookie 本地缓存路径,默认 ~/.mcp-server-yapi/session.json | | MCP_DEBUG_CONSOLE | 是否输出调试日志,默认 false |

登录成功后会把 Cookie 缓存到本地(权限 0600)。进程重启后会优先复用,失效(40011)时自动重新登录。

访问不同 YApi 项目时,在工具参数中传入对应的 project_id 即可(账号需对该项目有权限)。

本地开发调试

git clone https://github.com/solumon/mcp-server-yapi.git
cd mcp-server-yapi
npm install
npm run build

本地联调配置:

{
  "mcpServers": {
    "mcp-server-yapi": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-yapi/dist/index.js"],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_USERNAME": "your_ldap_username",
        "YAPI_PASSWORD": "your_password",
        "MCP_DEBUG_CONSOLE": "false"
      }
    }
  }
}

可用工具

  • list_project: 列出可访问项目(可传 group_id 限定分组;不传则汇总所有分组)
  • get_project: 获取项目基本信息(需提供 project_id
  • add_cat: 新增接口分类
  • get_cat_menu: 获取分类菜单列表
  • list_cat: 获取某个分类下接口列表
  • get_interface: 按接口 ID 获取完整详情,或按 project_id + router_path 模糊匹配
  • list_interface: 获取接口列表数据
  • save_interface: 新增或者更新接口

发布

npm login
npm publish

scoped 包已配置 "publishConfig": { "access": "public" },可直接公开发布。