
Makefile MCP
io.github.ai-ronin-systems由 GitHub 账号 ai-ronin-systems 发布v0.3.0更新于 Oct 25, 2026
Expose trusted GNU Make targets as governed MCP tools without a generic shell.
概览
把现有 GNU Makefile 转成带类型的 MCP 工具,让助手只能运行获准的 make 目标,而不是拿到通用 shell。
- 可以做什么
- 列出并查看仓库 Makefile 中发现的 Make 目标
- 以 MCP 工具运行已暴露的目标,可为每个目标生成独立工具,或通过通用的列出、描述、运行调用
- 在治理模式下仅允许运行白名单中的上下文与目标组合,并校验带类型的输入
- 对标记为危险的任务要求人工批准,并写入带哈希链的审计记录
- 用 GNU Make 试运行预览目标,并用 doctor 命令检查配置
- 适用场景
- 适合希望让 AI 助手通过 Make 运行仓库已有的测试、检查、构建或部署目标,而不给它任意 shell 的场景。尤其适合已把自动化放在 Makefile 中、并希望对智能体可执行内容做显式暴露、审批与审计的团队。
- 运行要求
- 在 Linux 或 macOS 上作为本地进程运行(不支持 Windows),需要 Python 3.11+ 和 GNU Make,可通过 uvx 或 pipx 启动。未声明任何认证或环境变量。治理模式需要 .makefile-mcp.yaml 策略文件,修改策略后需重启。
安装
在 SourceWeft 中
- 打开 控制台中的 Makefile MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Makefile MCP
[PyPI] [Python] [CI] [License]
Expose trusted GNU Make targets to AI agents — without exposing a generic shell or replacing Make with another workflow system.
Makefile MCP turns an existing Makefile into typed MCP tools. It is zero-config and run-safe by default, and deny-by-default when governed.
Threat model
Design for a compromised agent: any text it reads can carry a prompt injection. Makefile MCP keeps the worst case short. A hijacked agent can run only the targets you listed, with values you typed, and a human approves the risky ones. Read the threat model for the threats, controls, tests that prove them, and limits.
Details: threat model, SECURITY.md, and security model.
Quick start
Given:
Makefile MCP exposes make_test and make_lint as MCP tools. Other targets are listed but not runnable until you govern them.
One-shot use: uvx makefile-mcp serve.
Why Makefile MCP
Makefile MCP is intentionally narrow: the repository's Makefile remains the executable source of truth, while Makefile MCP supplies a governed agent-facing capability boundary.
See Design rationale for the full capability/property map and the alternatives deliberately left out.
Architecture
One catalog. One execution path. Thin CLI and MCP adapters.
See Architecture.
Governed mode
Without .makefile-mcp.yaml, Makefile MCP runs in auto mode: every conservatively discovered root target is listed, but only test, lint, check, and fmt can run, with no caller-controlled Make variables. --legacy-auto-run restores the old run-everything behavior (deprecated).
Add .makefile-mcp.yaml to switch to explicit governance:
Only enabled (context, target) pairs are callable. dangerous tasks additionally need human approval (defaults.require_approval), and audit writes one JSON line per call. See Governed mode, Configuration, and Contexts and capabilities.
MCP presentations
Makefile MCP supports three MCP presentations over the same callable catalog. Choose the presentation that best fits your requirements.
See MCP presentations and client setup.
Security
Makefile MCP assumes the repository, Makefiles, included Make code, wrapper scripts, and provisioned tools are trusted operator-controlled code. The security boundary is the invocation: an MCP/CLI caller chooses an exposed task/context and, in governed mode, supplies declared values. Makefile MCP authorizes and validates that request; it does not sandbox hostile Makefiles.
Runtime bounds, cancellation/process-group cleanup, stdin isolation, and locking are primarily execution-correctness properties. They limit failure modes around trusted automation rather than turning Make into a sandbox. The built-in MCP server is stdio-only: no HTTP listener, remote-auth layer, TLS, tenancy, or network-service lifecycle is hidden inside the product.
See SECURITY.md for the security policy, reporting process, trust boundary, and limitations. Detailed implementation notes are in docs/security.md.
Intentional scope limits
- GNU Make on Linux/macOS; Windows is not currently supported.
- Trusted repository assumption: Makefiles, includes, scripts, and provisioned tools are operator-controlled code.
- Static discovery is deliberately conservative, not a complete GNU Make parser.
- Preview is GNU Make dry-run, not sandboxing; Make evaluation can still have side effects.
- Direct tool inventory is registered at startup; generic catalog calls can observe supported Makefile changes.
.makefile-mcp.yamlis startup policy; changes require restart and fail closed until then.- Foreground/bounded tasks only; deliberately detached daemons are outside Makefile MCP's process-group containment model.
- No HTTP server, auth stack, scheduler, job queue, workflow persistence, plugin execution framework, or arbitrary shell tool.
- Reload behavior:
.makefile-mcp.yamlis startup policy. Restart Makefile MCP after adding, removing, or editing it.- Makefile discovery refreshes when the conventional
Makefileor tracked literal includes change. - Generic calls see the refreshed catalog immediately.
- Direct tool inventory is a startup snapshot: adding or removing direct tools requires a restart. Existing direct tools still re-check the live catalog when invoked.
Requirements
Python 3.11+ · GNU Make · Linux or macOS
Documentation
- Threat model — why agents should not get a shell, threats and controls, the policy and audit log, guarantees and limits. Start here.
- Architecture — runtime flow, responsibilities, lifecycle, invariants, and dependency rules.
- Design rationale — key tradeoffs, full product-property map, and deliberately rejected alternatives.
- CLI reference — commands, options, result model, root detection, and exit codes.
- Configuration — authoritative
.makefile-mcp.yamlfields, defaults, approval, audit log, and precedence. - Static Make discovery — supported syntax, fail-closed behavior, includes, limitations, and cache semantics.
- Governed mode — explicit exposure, typed inputs, risk metadata, human approval, and operating model.
- MCP presentations —
direct,generic,both, schemas, result/error semantics, naming, and lifecycle. - Contexts and capabilities — monorepo scoping,
(context, target)authorization, and semantic mappings. - MCP client setup — Codex, Claude Code, LangChain/LangGraph, Cursor, VS Code, and
uvxexamples. - Security — trust boundary, Make input safety, arbitrary strings, discovery, environment/path controls, and execution bounds.
- Development — contributor workflows, code ownership, regression expectations, and Definition of Done.
- Deployment — Docker/stdio deployment, production checklist, and provisioning custom tools plus Makefiles.
- Releasing — version/tag contract, clean-package smoke test, PyPI Trusted Publishing, provenance, GitHub Releases, and MCP Registry metadata.
Security reporting: SECURITY.md. Contributing: CONTRIBUTING.md.
来源:README.md,提交 f08160c
工具
0版本历史
2- v0.3.0最新Oct 25, 2026
- v0.2.2Oct 15, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分