README
🚀 C++ Builder MCP 服务器
C++ Builder MCP 服务器提供 C++ DLL 编译和分析功能。它能借助 Visual Studio 构建工具,编译带有特定导出设置的 C++ DLL,并通过 dumpbin 对 DLL 导出情况进行分析。
🚀 快速开始
要使用 C++ Builder MCP 服务器,需完成以下步骤:
- 克隆仓库:
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": {}
}
}
}
✨ 主要特性
- 使用 MSBuild 编译 C++ DLL:利用 Visual Studio 的 MSBuild 进行编译,支持不同的配置和平台,还能集成模块定义文件。
- 通过 .def 文件配置自定义导出设置:可指定导出函数及其属性,控制 DLL 中暴露的函数。
- 使用 dumpbin 分析 DLL 导出:能提供所有导出函数的列表、导出序号、函数名称和地址、导出转发信息以及详细的导出表分析。
- 可配置构建设置:支持平台和配置目标设定,还能输出详细的构建信息。
📦 安装指南
克隆仓库
git clone https://github.com/yourusername/cpp-builder-mcp-server.git
cd cpp-builder-mcp-server
安装依赖项
npm install
构建项目
npm run build
💻 使用示例
基础用法
编译 DLL
// 基本编译
await mcp.use("cpp-builder", "compile_dll", {
projectPath: "./src/MyLibrary.vcxproj"
});
分析 DLL 导出
await mcp.use("cpp-builder", "analyze_exports", {
dllPath: "./bin/Release/MyLibrary.dll"
});
高级用法
带有特定设置的编译
// 带有特定设置的编译
await mcp.use("cpp-builder", "compile_dll", {
projectPath: "./src/MyLibrary.vcxproj",
configuration: "Debug",
platform: "x64",
defFile: "./src/exports.def"
});
📚 详细文档
工具说明
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 文件路径(必填) |
该分析能提供以下信息:
- 所有导出函数的列表。
- 导出序号。
- 函数名称和地址。
- 导出转发信息。
- 详细的导出表分析。
需求
- Visual Studio 2022 社区版或更高版本。
- Visual C++ 构建工具。
- Windows SDK。
配置
将服务器添加到您的 MCP 设置文件中:
{
"mcpServers": {
"cpp-builder": {
"command": "node",
"args": ["path/to/cpp-builder-mcp-server/dist/index.js"],
"env": {}
}
}
}
开发步骤
- 对源代码进行修改。
- 运行测试:
npm test
- 构建项目:
npm run build
贡献指南
- 分叉仓库。
- 创建功能分支。
- 提交更改。
- 推送到分支。
- 创建 Pull Request。
📄 许可证
本项目采用 MIT 许可证。
Scan to join WeChat group