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

swaggertools-mcp

v1.0.5

Published

MCP server for querying OpenAPI/Swagger documents, including fuzzy operation matching.

Readme

swagger-mcp

English | 中文

用于加载和查询 OpenAPI/Swagger 文档的 MCP 服务。 支持在用户只提供部分路径或关键词时进行接口模糊匹配。

功能特性

  • 加载远程 OpenAPI 3.x 文档(JSON/YAML)
  • 基于内存的文档缓存(TTL)
  • 按 method/tag/关键词筛选接口
  • 通过不完整路径进行接口模糊解析
  • 查看接口完整请求/响应结构
  • 查看 components.schemas 以及被哪些接口引用

工具列表

  • openapi.load
  • openapi.health
  • openapi.reload
  • openapi.list_operations
  • openapi.resolve_operation
  • openapi.get_operation
  • openapi.explain_operation
  • openapi.get_schema

openapi.explain_operation 适合直接回答“这个接口怎么调”:会输出参数分类、请求体示例和响应示例。

省 token 默认策略:

  • openapi.resolve_operationtopK 默认 3
  • openapi.get_operation:默认 resolveRefs=falseresponseFormat=compact
  • openapi.explain_operation:默认 resolveRefs=falsedetailLevel=brief

环境要求

  • Node.js 18+
  • pnpm 10+

快速开始

pnpm install
pnpm dev

构建并运行:

pnpm build
pnpm start

Codex MCP 配置示例

{
  "mcpServers": {
    "swagger-mcp": {
      "command": "npx",
      "args": ["-y", "swaggertools-mcp", "--docPath", "http://dev.manage.zw.uav.sczlcq.com/v3/api-docs"]
    }
  }
}

如果你在本仓库本地联调,也可以继续用 pnpm dev 启动。

参数说明

  • openapi.load 支持运行时入参:urlheadersforceRefresh
  • url(或回退到启动参数 --docPath)必须是 OpenAPI 文档的 http/https 地址
  • 启动参数 --docPath 变为可选,用于在未传 openapi.load.url 时作为默认来源
  • 不再通过 .env 或其他环境变量读取默认文档地址

docId: "default" 行为

  • 如果服务中已加载过文档,default 会映射到最近一次加载的 docId
  • 如果尚未加载文档,会返回错误并提示先调用 openapi.load

常见问题

  • 错误:Document not found: default
    • 先调用 openapi.load
    • 确保 MCP 启动参数中已设置 --docPath