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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rsdoctor/mcp-server

v0.1.2

Published

@rsdoctor/mcp-server 是一个 MCP Server,旨在帮助用户更便捷地使用 Rsdoctor 的构建数据。它可以与 Rsdoctor 的本地构建分析数据配合使用,通过问答的形式,帮助你快速获取构建分析结果。

Readme

@rsdoctor/mcp-server

介绍

@rsdoctor/mcp-server 是一个 MCP Server,旨在帮助用户更便捷地使用 Rsdoctor 的构建数据。它可以与 Rsdoctor 的本地构建分析数据配合使用,通过问答的形式,帮助你快速获取构建分析结果。

主要功能

目前支持以下四大类分析能力:

  • 产物信息分析: 分析构建产物的体积、组成等信息
  • 依赖问题分析: 分析项目依赖关系、重复依赖等问题
  • 产物优化建议: 提供产物体积优化、代码分割等建议
  • 编译优化建议: 分析编译耗时,提供编译性能优化建议

使用示例

1. 产物优化分析

通过提问 "Please help me to optimize the bundle or artifacts",工具会分析构建产物并给出优化建议。

示例视频:

https://github.com/user-attachments/assets/c73e55a9-445d-481d-8dbd-cf99bfca680f

2. 依赖分析

通过提问 "Please investigate the referrer dependency of node_modules/dayjs/index.js",工具会分析指定模块的依赖关系。

示例视频:

https://github.com/user-attachments/assets/312cf5ce-19bd-49e7-87bb-aab1fc8a6a43

3. 编译性能分析

通过提问 "Please help me find files or loaders with high compilation time and provide optimization suggestions",工具会分析编译耗时并给出优化建议。

示例视频:

https://github.com/user-attachments/assets/cc0f5441-4950-420c-bbad-635e21e87492

配置说明

启动参数

  • 配置链接的编译器名【可选】

多编译器项目中,因为每个编译器会有一份 Rsdoctor 构建分析数据,所以需要配置 compiler 参数,来指定 mcp-server 分析某一个编译器的 Rsdoctor 数据。我们暂不支持同时分析多份 Rsdoctor 数据。

npx @rsdoctor/mcp-server@latest --compiler web

port

  • 配置端口【可选】
npx -y @rsdoctor/mcp-server@latest --port 1000

需要注意的是,Rsdoctor 本地 Server 启动端口默认是随机的,所以如果要使用 port 参数,需要在 plugin 中配置 port 端口:

new RsdoctorRspackPlugin({
  port: 9988,
});

用法

💡 版本要求

需要使用以下 rsdoctor 插件(版本要求):

  • @rsdoctor/rspack-plugin >= 1.1.2
  • @rsdoctor/webpack-plugin >= 1.1.2

注意:请确保使用最新版本以获得最佳体验。

1. 插件配置

如果还没有添加 Rsdoctor 插件,那么需要在项目中配置,👉🏻 快速开始

2. 开启 Rsdoctor 并执行本地构建

开启 Rsdoctor 的情况下,执行构建。不要使用 MCP Client 启动项目,因为 Rsdoctor 的挂载的本地服务会卡住 MCP Client 的对话进程

npm run build
  • 注:如果配置了 disableClientServer: true,需要修改为 disableClientServer: false,disableClientServer 默认是 false。

3. 配置 MCP Client

Claude

在 claude_desktop_config.json 中添加如下配置:

{
  "mcpServers": {
    "rsdoctor": {
      "command": "npx",
      "args": ["-y", "@rsdoctor/mcp-server@latest"]
    }
  }
}

连接成功后,此时你可以在 Cursor 的 MCP 面板中直接与 Rsdoctor 构建分析数据进行交互,提问产物、依赖、优化等相关问题。

Cursor

Install MCP Server

在 Cursor 编辑器中集成 @rsdoctor/mcp-server,通常只需在 .cursor/mcp.json 文件中添加服务器配置。

{
  "mcpServers": {
    "rsdoctor": {
      "command": "npx",
      "args": ["-y", "@rsdoctor/mcp-server@latest"]
    }
  }
}

连接成功后,此时你可以在 Cursor 的 MCP 面板中直接与 Rsdoctor 构建分析数据进行交互,提问产物、依赖、优化等相关问题。

VS Code / GitHub Copilot

Install in VS Code

  1. 在项目根目录创建 .vscode/mcp.json,GitHub Copilot 默认会自动加载 MCP Server 配置
{
  "mcpServers": {
    "rsdoctor": {
      "command": "npx",
      "args": ["-y", "@rsdoctor/mcp-server@latest"]
    }
  }
}
  1. 在 Copilot Chat 面板中选择 Agent 模式,然后开始交互。

Cline

在 Cline 配置文件中添加 MCP Server 配置。

{
  "mcpServers": {
    "rsdoctor": {
      "command": "npx",
      "args": ["-y", "@rsdoctor/mcp-server@latest"]
    }
  }
}

连接成功后,此时你可以在 Cursor 的 MCP 面板中直接与 Rsdoctor 构建分析数据进行交互,提问产物、依赖、优化等相关问题。

Tools 列表

  1. get_chunks
  • 获取所有代码块信息
  1. get_chunk_by_id
  • 根据 ID 获取特定代码块信息
  • 输入: chunkId (Number)
  1. get_modules
  • 获取所有模块信息
  1. get_module_by_id
  • 根据 ID 获取模块信息
  • 输入: moduleId (Number)
  1. get_module_by_path
  • 根据路径获取模块信息
  • 输入: modulePath (string)
  1. get_module_issuer_path
  • 获取模块的来源路径
  • 输入: moduleId (string)
  1. get_package_info
  • 获取当前包信息
  1. get_package_dependencies
  • 获取包的依赖列表
  1. get_rule_info
  • 获取构建规则扫描结果
  1. get_duplicate_packages
  • 获取重复安装的包列表
  1. get_similar_packages
  • 获取相似包列表
  1. get_large_chunks
  • 获取体积过大的代码块列表
  1. get_media_asset_prompt
  • 获取媒体资源优化建议
  1. get_loader_time_all_files
  • 获取每个文件的 loader 耗时
  1. get_loader_times
  • 获取编译目录的 loader 耗时