@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.
@rsdoctor/mcp-server provides four core analysis capabilities:
By asking "Please help me to optimize the bundle or artifacts", the tool will analyze the build output and provide optimization suggestions.
Example video:
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:
By asking "Please help me find files or loaders with high compilation time and provide optimization suggestions", the tool will analyze compilation time and provide optimization suggestions.
Example video:
The following Rsdoctor plugin versions are required:
Note: Please ensure you are using the latest version for the best experience.
If you haven't added the Rsdoctor plugin yet, you need to configure it in your project. 👉🏻 Quick Start.
Enable Rsdoctor and run the build. Do not use MCP Client to start the project, as Rsdoctor's local service will block the MCP Client's dialogue process.
disableClientServer: true
is configured, it needs to be modified to disableClientServer: false
, and disableClientServer
defaults to false..cursor/mcp.json
file in the project root directory:Add configuration in claude_desktop_config.json
:
Add configuration in the configuration file:
Parameter | Description | Default | Example |
---|---|---|---|
compiler | Specify the name of the compiler to analyze | Automatically detected | --compiler web |
port | Specify the MCP Server port | Latest port number (written to ~/.cache/rsdoctor/mcp.json ) | --port 1000 |
In a multi-compiler project, each compiler will have a separate Rsdoctor build analysis data. Use the --compiler
parameter to specify the compiler to analyze:
Tool | Description | Parameters |
---|---|---|
get_chunks | Get all code block information | - |
get_chunk_by_id | Get specific code block information | chunkId (Number) |
get_large_chunks | Get code blocks with large volume | - |
get_media_asset_prompt | Get media resource optimization suggestions | - |
Tool | Description | Parameters |
---|---|---|
get_modules | Get all module information | - |
get_module_by_id | Get module information | moduleId (Number) |
get_module_by_path | Get module by path | modulePath (String) |
get_module_issuer_path | Get module source path | moduleId (String) |
get_package_info | Get package information | - |
get_package_dependencies | Get dependency list | - |
get_duplicate_packages | Get duplicate package list | - |
get_similar_packages | Get similar package list | - |
Tool | Description | Parameters |
---|---|---|
get_loader_time_all_files | Get file loader time | - |
get_loader_times | Get compilation directory loader time | - |
get_rule_info | Get build rule scan results | - |
Issue: Unable to connect to Rsdoctor MCP Server or no data returned successfully
Solution:
--port
parameter, please ensure the Rsdoctor startup port configuration is correct.