README
🚀 C++ Builder MCP 服务器
C++ Builder MCP 服务器提供 C++ DLL 编译和分析功能。它支持使用 Visual Studio 构建工具编译带有特定导出设置的 C++ DLL,并能通过 dumpbin 对 DLL 的导出情况进行分析。
🚀 快速开始
C++ Builder MCP 服务器可帮助你轻松实现 C++ DLL 的编译与分析。你只需按照以下步骤操作,就能快速使用该服务器。
✨ 主要特性
- 使用 MSBuild 编译 C++ DLL:借助 MSBuild 完成 C++ DLL 的编译工作。
- 通过 .def 文件自定义导出设置:可利用 .def 文件对导出设置进行自定义。
- 使用 dumpbin 分析 DLL 导出:使用 dumpbin 工具分析已编译 DLL 的导出情况。
- 可配置构建设置:支持对构建设置进行灵活配置。
- 平台和配置目标:能针对不同平台和配置进行设置。
- 详细的构建输出:提供详细的构建输出信息。
🛠️ 工具
DLL 编译
compile_dll
此工具用于使用 MSBuild 编译带有特定导出设置的 C++ DLL。 | 属性 | 详情 | |------|------| | projectPath | .vcxproj 文件路径(必需) | | configuration | 构建配置(可选),取值为 'Debug' 或 'Release',默认值为 'Release' | | platform | 目标平台(可选),取值为 'x86' 或 'x64',默认值为 'x86' | | defFile | .def 文件路径(可选),可指定导出函数及其属性,控制 DLL 中暴露的函数 |
该工具使用 Visual Studio 的 MSBuild 进行编译,具备以下特点:
- 提供完整的构建输出,包含警告和错误信息。
- 支持不同的配置和平台。
- 集成模块定义文件。
- 输出详细的构建日志。
导出分析
analyze_exports
该工具使用 dumpbin 分析已编译 DLL 的导出情况。 | 属性 | 详情 | |------|------| | dllPath | DLL 文件路径(必需) |
此分析能提供以下内容:
- 所有导出函数的列表。
- 导出序号。
- 函数名称和地址。
- 导出转发信息。
- 详细的导出表分析。
📦 安装指南
- 克隆仓库:
git clone https://github.com/yourusername/cpp-builder-mcp-server.git
cd cpp-builder-mcp-server
- 安装依赖项:
npm install
- 构建项目:
npm run build
⚙️ 配置
将服务器添加到 MCP 设置文件中:
{
"mcpServers": {
"cpp-builder": {
"command": "node",
"args": ["path/to/cpp-builder-mcp-server/dist/index.js"],
"env": {}
}
}
}
💻 使用示例
基础用法
编译 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"
});
👨💻 开发
- 修改源代码。
- 运行测试:
npm test
- 构建项目:
npm run build
🤝 贡献
- 叉分仓库。
- 创建功能分支。
- 提交更改。
- 推送到分支。
- 创建 Pull Request。
📄 许可证
本项目采用 MIT 许可证。
微信扫一扫