Make功能服务器

MCP Server Make是一个通过Model Context Protocol提供make功能的服务器,允许LLMs安全地执行Makefile中的目标,适用于开发任务自动化。

  • by wrale
  • Python
  • 本地部署
  • 11 星标
  • 更新于
在 GitHub 查看 wrale/mcp-server-make

使用说明

MCP服务器制造商

提供make功能的模型上下文协议服务器。此服务器使LLM能够以安全、受控的方式从任何Makefile执行make目标。

概述

服务器通过模型上下文协议公开make功能,允许像Claude这样的LLM:

  • 通过输出捕获安全地运行目标
  • 了解和导航构建过程
  • 协助完成开发任务
  • 妥善处理错误
  • 尊重工作目录上下文

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的详细信息,请参阅我们的文档:

增强开发工作流程

此服务器通过让LLM直接访问功能来实现强大的开发工作流:

对于开发者

  1. 自动协助

    • 让Claude运行并解释测试结果
    • 获取构建系统建议和改进
    • 自动化重复的开发任务
  2. 项目管理

    • 让Claude处理依赖关系更新
    • 自动化发布流程
    • 保持一致的代码质量

与Make Targets合作

MCP Server Make不会自动发现Makefile中的可用目标。要有效地与Claude一起使用它:

  1. 从...开始 make help:大多数设计良好的Makefile都包含一个帮助目标

    Human: Please run make help to see what commands are available.
    
  2. 告诉克劳德你的目标:明确提及现有目标及其目的

    Human: Our project has these make targets: test, lint, format, build, and clean.
    
  3. 使用标准惯例:许多Makefile包括的常见目标:

    • make test -运行测试
    • make lint -检查代码质量
    • make format -格式代码
    • make build -构建项目
    • make clean -清理构建工件

该存储库包含一个有主见的Makefile,其中包含其他实用程序目标-请参阅 用户指南 有关这些扩展功能的详细信息或创建自己的自定义目标。

备注:克劳德不记得对话之间的可用目标。你需要在每次谈话开始时介绍他们。

集成示例

以下是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服务器做出贡献!请参阅 贡献.md 有关设置开发环境、使用项目工具和提交更改的详细说明。

许可证

MIT许可证-有关详细信息,请参阅许可证文件