English | 简体中文
@rsdoctor/mcp-server is an MCP Server tool 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.
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
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
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
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
- Configure the name of the linked bundler (optional)
npx @rsdoctor/mcp-server@latest --compiler web
- Configure the port (optional)
npx -y @rsdoctor/mcp-server@latest --port 1000
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,
});
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.
For single compiler projects, no configuration is required—simply configure the MCP Client directly.
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.
npx -y @rsdoctor/mcp-server@latest --compiler [compilerName]
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.
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.
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.
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.
- 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