编译错误分析工具链

MCP构建工具链是一个高级编译工具链,具有编译错误分析和过滤功能,旨在最小化令牌使用,使LLM模型能够处理编译过程中的警告和错误并进行修复。

  • by jlopezm
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 jlopezm/mcp-build-toolchain

使用说明

mcp构建工具链mcp服务器

具有编译错误分析和过滤功能的高级构建工具链

MCP的目标是尽量减少令牌的使用,以允许LLM模型处理编译过程中的警告和错误并进行修复。 因此,一些构建日志的结果可能会大到发送到模型。

使用Clinules可以将信息发送到特定项目以及如何处理结果。 还可以使用第二个文件,在其中可以添加警告和/或错误,以避免模型试图修复它们。

关键组件

MCP工具:获取编译错误

graph TD
    A[get-compilation-errors] --> B[Analyzes build output]
    B --> C[Extracts errors/warnings]
    C --> D[Filters using .clinerules]
    D --> E[Provides structured results]

主要特点:

  • 将原始编译日志处理为结构化数据
  • 与.clinerules整合,实现精准过滤
  • 首先优先考虑关键错误
  • 生成可操作的补救步骤

.clinerules配置

创建 .clinerules 在项目根中控制错误处理:

描述如何编译以及如何对不同的错误/警告做出反应:


# Files
Command to build/compile: `.\build.cmd`
outfile to read to get warnings and errors result from the compilation: `output_log_file.log`, use absolute path.

# Tasks
- If user request to check or solve compilation errors or warnings follow to following procedure
- In case user request to compile or build use the command: build.cmd *Replace by user command*
- Use mcp server tool "mcp-build-toolchain" function "get-compilation-errors" to get the list of warnings and errors.
- In case the user tells file names, description or regular expression to filter the errors, create the regular expression and use the parameter 'regexp'
- After getting the errors and warnings try to fix them and compile again. Repeat the operation 5 times until no errores are reported.
- Check `docs/avoidable_errors.md` and do nothing with errors or warning reported in this file.
- Filter by default the errors and warnings: "*text to filter errors*" or "*text to filter warnings*"
    - This filter is applied in any position of the line and is case insensitive.
- Don't modify anything furthermore than the needed to fix the errors or warnings.
- If there is a fix that can have different solutions, ask the user for the solution to apply.

错误文档

维持 docs/avoidable_errors.md 常见问题:

## Avoidable Warnings
- W0611: Unused import → Remove unused packages
- E302: Expected 2 blank lines → Follow PEP8 spacing

## Ignorable Errors  
- E266: Too many leading '#' → Style preference
- W504: Line break after binary operator → Project-specific

提示示例

配置

"mcpServers": {
"mcp-build-toolchain": {
      "command": "uvx",
      "args": [
        "mcp-build-toolchain"
      ],
      "disabled": false,
      "autoApprove": []
    }
}

快速启动

安装

克劳德桌面

在MacOS上: ~/Library/Application\ Support/Claude/claude_desktop_config.json 在Windows上: %APPDATA%/Claude/claude_desktop_config.json

Development/Unpublished Servers Configuration ``` "mcpServers": { "mcp-build-toolchain": { "command": "uv", "args": [ "--directory", "/Users/username/mcp/mcp-build-toolchain", "run", "mcp-build-toolchain" ] } } ```
Published Servers Configuration ``` "mcpServers": { "mcp-build-toolchain": { "command": "uvx", "args": [ "mcp-build-toolchain" ] } } ```

克莱恩

克莱恩: %APPDATA%/Roaming\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json