@rsdoctor/mcp-server 是一个 MCP Server,旨在帮助用户更便捷地使用 Rsdoctor 的构建数据。它可以与 Rsdoctor 的本地构建分析数据配合使用,通过问答的形式,帮助你快速获取构建分析结果。
- Types
- ESM
- License
- MIT
- Deps
- 0
- Install Size
- 1.2 MB
- Vulns
- 0
- Published
npm install @rsdoctor/mcp-serverpnpm add @rsdoctor/mcp-serveryarn add @rsdoctor/mcp-serverbun add @rsdoctor/mcp-serverdeno add npm:@rsdoctor/mcp-servervlt install @rsdoctor/mcp-servervp add @rsdoctor/mcp-servernpx rsdoctor-mcppnpm exec rsdoctor-mcpnpx rsdoctor-mcpbunx rsdoctor-mcpdeno run npm:@rsdoctor/mcp-servervlx rsdoctor-mcpvp exec rsdoctor-mcp@rsdoctor/mcp-server
English | 简体中文
Introduction
@rsdoctor/mcp-server is an MCP Server designed to help users more conveniently utilize Rsdoctor's build data. It works with Rsdoctor's local build analysis data and helps you quickly obtain build analysis results through a Q&A interface.
Features
Currently supports four main types of analysis capabilities:
- Build Artifact Analysis: Analyzes the size and composition of build artifacts
- Dependency Analysis: Analyzes project dependencies and duplicate dependency issues
- Bundle Optimization Suggestions: Provides suggestions for bundle size optimization and code splitting
- Build Performance Suggestions: Analyzes build time and provides build performance optimization suggestions
Examples
1. Bundle Optimization Analysis
By asking "Please help me to optimize the bundle or artifacts", the tool will analyze the build artifacts and provide optimization suggestions.
Example video:
https://github.com/user-attachments/assets/c73e55a9-445d-481d-8dbd-cf99bfca680f
2. Dependency Analysis
By asking "Please investigate the referrer dependency of node_modules/dayjs/index.js", the tool will analyze the dependency relationships of the specified module.
Example video:
https://github.com/user-attachments/assets/312cf5ce-19bd-49e7-87bb-aab1fc8a6a43
3. Build Performance Analysis
By asking "Please help me find files or loaders with high compilation time and provide optimization suggestions", the tool will analyze build time and provide optimization suggestions.
Example video:
https://github.com/user-attachments/assets/cc0f5441-4950-420c-bbad-635e21e87492
Configuration
Parameters
compiler
- Configure the name of the linked bundler (optional)
For multi-compiler projects, since each compiler will have its own Rsdoctor build analysis data, you need to configure the compiler parameter to specify which bundler's Rsdoctor data the mcp-server should analyze. Rsdoctor-mcp do not currently support analyzing multiple Rsdoctor data sets simultaneously.
npx @rsdoctor/mcp-server@latest --compiler [compilerName]
port
- Configure the port (optional)
npx -y @rsdoctor/mcp-server@latest --port 9988
Note: By default, the Rsdoctor local server starts on a random port. Therefore, if you want to use the port parameter, you need to configure the port in the plugin:
new RsdoctorRspackPlugin({
port: 9988,
});
Usage
Version Requirements
The following Rsdoctor plugins are required (version requirements):
- @rsdoctor/rspack-plugin >= 1.1.2
- @rsdoctor/webpack-plugin >= 1.1.2
Note: Please ensure you are using the latest version for the best experience.
1. Plugin Configuration
If you haven't added the Rsdoctor plugin yet, you'll need to configure it in your project, 👉🏻 Quick Start.
2. Enable Rsdoctor and Run Local Build
With Rsdoctor enabled, execute the build process. Do not use the MCP Client to start the project, as Rsdoctor's local server will block the MCP Client's conversation process.
npm run build
- Note: If you have set
disableClientServer: true, change it todisableClientServer: false. By default, disableClientServer is set to false.
3. Configure MCP Client
Claude
Add the following configuration to claude_desktop_config.json:
{
"mcpServers": {
"rsdoctor": {
"command": "npx",
"args": ["-y", "@rsdoctor/mcp-server@latest"]
}
}
}
Once connected, you can interact directly with Rsdoctor's build analysis data in the MCP panel of Cursor, asking questions about artifacts, dependencies, optimizations, and more.
Cursor
To integrate @rsdoctor/mcp-server in the Cursor editor, usually you only need to add the server configuration in the .cursor/mcp.json file.
{
"mcpServers": {
"rsdoctor": {
"command": "npx",
"args": ["-y", "@rsdoctor/mcp-server@latest"]
}
}
}
Once connected, you can interact directly with Rsdoctor's build analysis data in the MCP panel of Cursor, asking questions about artifacts, dependencies, optimizations, and more.
VS Code / GitHub Copilot
- Create
.vscode/mcp.jsonin your project root directory. GitHub Copilot will automatically load the MCP Server configuration.
{
"mcpServers": {
"rsdoctor": {
"command": "npx",
"args": ["-y", "@rsdoctor/mcp-server@latest"]
}
}
}
- In the Copilot Chat view, select Agent mode, then start interacting.
Cline
Add the MCP Server configuration in the Cline configuration file.
{
"mcpServers": {
"rsdoctor": {
"command": "npx",
"args": ["-y", "@rsdoctor/mcp-server@latest"]
}
}
}
Once connected, you can interact directly with Rsdoctor's build analysis data in the MCP panel of Cursor, asking questions about artifacts, dependencies, optimizations, and more.
Tools List
- get_chunks
- Retrieve information about all code chunks
- get_chunk_by_id
- Retrieve information about a specific chunk by ID
- Input: chunkId (Number)
- get_modules
- Retrieve information about all modules
- get_module_by_id
- Retrieve information about a module by ID
- Input: moduleId (Number)
- get_module_by_path
- Retrieve information about a module by path
- Input: modulePath (string)
- get_module_issuer_path
- Retrieve the issuer path of a module
- Input: moduleId (string)
- get_package_info
- Retrieve information about the current package
- get_package_dependencies
- Retrieve the list of package dependencies
- get_rule_info
- Retrieve build rule scan results
- get_duplicate_packages
- Retrieve the list of duplicate packages
- get_similar_packages
- Retrieve the list of similar packages
- get_large_chunks
- Retrieve the list of oversized code chunks
- get_media_asset_prompt
- Retrieve media asset optimization suggestions
- get_loader_time_all_files
- Retrieve loader time for each file
- get_loader_times
- Retrieve loader times for compiled directories