MCP Server Make
镜像
简介
MCP-Server-Make 是一个为大型语言模型(LLMs)如 Claude 提供安全构建功能的服务器,让模型能够执行 Makefile 目标并获取输出。
快速安装
# 使用 uv (推荐)
uvx pip install mcp-server-make
# 或使用标准 pip
pip install mcp-server-make
基本用法
# 使用当前目录下的默认 Makefile
uvx mcp-server-make
# 使用指定的 Makefile 和工作目录
uvx mcp-server-make --make-path /path/to/Makefile --working-dir /path/to/working/dir
与 Claude 集成
在 claude_desktop_config.json
中添加:
{
"mcpServers": {
"make": {
"command": "uvx",
"args": [
"mcp-server-make",
"--make-path", "/absolute/path/to/Makefile",
"--working-dir", "/absolute/path/to/working/dir"
]
}
}
}
主要功能
- 构建自动化:运行
make test
,make lint
,make format
等 - 项目管理:自动化依赖更新和发布流程
- 自验证能力:让 LLMs 验证自己的代码修改
- 项目理解:帮助 LLMs 了解项目结构和上下文
示例对话
人类: 你能运行我们的测试套件并格式化需要格式化的代码吗?
Claude: 我会帮你运行测试并格式化代码:
1. 首先,让我们格式化代码:
[调用 make 工具参数 {"target": "format"}]
2 个文件被重新格式化,3 个文件保持不变
2. 现在我们来运行测试:
[调用 make 工具参数 {"target": "test"}]
正在运行测试...
4 项通过,0 项失败
所有格式化和测试已完成。代码现在已正确格式化,并且所有测试均已通过。
故障排除
- 找不到 Makefile:检查
--make-path
指向有效文件 - 工作目录错误:确保
--working-dir
存在且可访问 - 执行失败:验证目标是否存在且命令能正确执行
- 权限问题:检查文件和目录权限
更多信息
完整文档和源码请访问 GitHub 仓库。