AI Make 自动化
一个模型上下文协议服务器,使大型语言模型能够安全地执行Makefile中的目标,允许人工智能助手通过自然语言交互运行测试、格式化代码和自动化各种开发任务。
可用工具 (1 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
make 1 个参数 需填 1 项
Run a make target from the Makefile
必填参数:target
服务介绍
MCP Server Make
一个提供 make 功能的 Model Context Protocol 服务器。该服务器允许 LLMs 以安全、可控的方式执行任何 Makefile 中的 make 目标。
概述
该服务器通过 Model Context Protocol 提供 make 功能,使得像 Claude 这样的 LLMs 可以:
- 安全地运行 make 目标并捕获输出
- 理解和导航构建过程
- 帮助完成开发任务
- 适当处理错误
- 尊重工作目录上下文
MCP Server Make 可与任何有效的 Makefile 一起使用 - 您可以使用包含的意见化 Makefile 或您自己的自定义构建脚本。
快速开始
安装
使用 uv(推荐):
uv pip install mcp-server-make
使用 pip:
pip install mcp-server-make
基本用法
# Run with default Makefile in current directory
uvx mcp-server-make
# Run with specific Makefile and working directory
uvx mcp-server-make --make-path /path/to/Makefile --working-dir /path/to/working/dir
MCP 客户端配置
要与 Claude Desktop 一起使用,请将以下内容添加到您的 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"
]
}
}
}
文档
有关使用 MCP Server Make 的详细信息,请参阅我们的文档:
- 用户指南 - 完整的安装、配置和使用指南
- 自定义 Makefiles - 创建适用于 MCP Server Make 的有效 Makefiles
增强开发工作流程
通过让 LLMs 直接访问 make 功能,该服务器能够实现强大的开发工作流程:
对于开发者
-
自动化协助
- 让 Claude 运行并解释测试结果
- 获取构建系统建议和改进
- 自动化重复的开发任务
-
项目管理
- 让 Claude 处理依赖更新
- 自动化发布流程
- 维护一致的代码质量
使用 Make 目标
MCP Server Make 不会自动发现您的 Makefile 中可用的目标。为了与 Claude 有效配合使用:
-
从
make help开始:大多数设计良好的 Makefiles 都包含一个帮助目标Human: 请运行 make help 来查看可用的命令。 -
告诉 Claude 您的目标:明确提及可用的目标及其用途
Human: 我们的项目有这些 make 目标:test, lint, format, build 和 clean。 -
使用标准约定:许多 Makefiles 包含的常见目标:
make test- 运行测试make lint- 检查代码质量make format- 格式化代码make build- 构建项目make clean- 清理构建产物
仓库包含了一个具有额外实用目标的意见化 Makefile - 有关这些扩展功能的详细信息或创建自定义目标的方法,请参阅用户指南。
注意:Claude 在对话之间不会记住可用的目标。您需要在每次对话开始时重新介绍它们。
示例集成
以下是 Claude 如何帮助开发任务:
Human: Can you run our test suite and format any code that needs it?
Claude: I'll help run the tests and format the code:
1. First, let's format the code:
[Calling make tool with args {"target": "format"}]
2 files reformatted, 3 files left unchanged
2. Now let's run the tests:
[Calling make tool with args {"target": "test"}]
Running tests...
4 passed, 0 failed
All formatting and tests completed successfully. The code is now properly formatted and all tests are passing.
可用工具
服务器公开了以下单个工具:
make- 从 Makefile 中运行一个 make 目标target(字符串, 必需): 要执行的目标名称
贡献
我们欢迎贡献以改进 mcp-server-make!请参阅 CONTRIBUTING.md,了解设置开发环境、使用项目工具以及提交更改的详细说明。
许可证
MIT 许可证 - 详情请见 LICENSE 文件