C++ Builder MCP Server

C++ Builder MCP Server

site icon
2025.02.17 0
C++ DLL 编译DLL 导出分析开发效率
C++ Builder MCP Server 是一个提供 C++ DLL 编译和分析能力的 MCP 服务器。它支持使用 Visual Studio 构建工具编译具有特定导出设置的 C++ DLL,并分析 DLL 的导出内容。
View on GitHub

Overview

基本能力

产品定位

C++ Builder MCP Server 是一个专注于 C++ DLL 编译和导出分析的 MCP 服务器,旨在为开发者提供高效的 DLL 构建和分析工具。

核心功能

  • C++ DLL 编译:使用 MSBuild 编译 C++ DLL,支持自定义导出设置。
  • DLL 导出分析:使用 dumpbin 工具分析 DLL 的导出函数、序数、名称和地址等信息。
  • 配置灵活:支持不同的构建配置(Debug/Release)和目标平台(x86/x64)。
  • 详细输出:提供详细的构建日志和导出分析报告。

适用场景

  • 需要编译 C++ DLL 并控制导出函数的项目。
  • 需要分析 DLL 导出内容的开发者。
  • 使用 Visual Studio 构建工具的开发环境。

工具列表

  1. compile_dll
  2. 功能:使用 MSBuild 编译 C++ DLL,支持自定义导出设置。
  3. 参数:

    • projectPath:.vcxproj 文件路径(必需)。
    • configuration:构建配置(可选,默认为 'Release')。
    • platform:目标平台(可选,默认为 'x86')。
    • defFile:.def 文件路径(可选,用于指定导出函数)。
  4. analyze_exports

  5. 功能:使用 dumpbin 分析 DLL 的导出内容。
  6. 参数:
    • dllPath:DLL 文件路径(必需)。

常见问题解答

  • 依赖问题:确保已安装 Visual Studio 2022 Community Edition 或更高版本,以及 Visual C++ 构建工具和 Windows SDK。
  • 构建失败:检查项目路径和配置是否正确,确保 .def 文件(如有)格式正确。

使用教程

使用依赖

  1. 安装 Visual Studio 2022 Community Edition 或更高版本。
  2. 确保已安装 Visual C++ 构建工具和 Windows SDK。

安装教程

  1. 克隆仓库: bash git clone https://github.com/yourusername/cpp-builder-mcp-server.git cd cpp-builder-mcp-server
  2. 安装依赖: bash npm install
  3. 构建项目: bash npm run build

配置

在 MCP 配置文件中添加服务器:

{
  "mcpServers": {
    "cpp-builder": {
      "command": "node",
      "args": ["path/to/cpp-builder-mcp-server/dist/index.js"],
      "env": {}
    }
  }
}

调试方式

  1. 运行测试: bash npm test
  2. 重新构建项目: bash npm run build

使用示例

编译 DLL

// 基本编译
await mcp.use("cpp-builder", "compile_dll", {
  projectPath: "./src/MyLibrary.vcxproj"
});

// 带特定设置的编译
await mcp.use("cpp-builder", "compile_dll", {
  projectPath: "./src/MyLibrary.vcxproj",
  configuration: "Debug",
  platform: "x64",
  defFile: "./src/exports.def"
});

分析 DLL 导出

await mcp.use("cpp-builder", "analyze_exports", {
  dllPath: "./bin/Release/MyLibrary.dll"
});

许可证

该项目遵循 MIT 开源许可条款。