prefab-mcp
prefab-mcp
一个面向 Prefab 的 MCP 服务器,让智能体可以查看你的模板并为你部署一个。
"Set up a new client folder for Northwind, autumn campaign, on my Desktop"它提供什么
工具 | 作用 |
| 每个模板,以及它会创建什么、会要求什么 |
| 完整描述一个模板:结构、占位符、动作 |
| 一次部署会创建什么,以及哪些值还缺失。不创建任何内容 |
| 创建文件夹,并填入给定的值 |
| Prefab 正在监视的文件夹,以及这些文件夹上的规则 |
| 资料库级的占位符、动作和值预设 |
Related MCP server: macOS Companion MCP Server
安装配置
任何能通过 stdio 使用 MCP 的客户端都可以使用。
作为捆绑包 - 从发布页面下载 prefab.mcpb 并双击。能够安装 MCP 捆绑包的客户端,包括 Claude Desktop 等,都自带 Node,所以无需再安装任何东西。
从命令行使用(Claude Code,以及其他类似思路的客户端):
claude mcp add prefab -- npx -y prefab-mcp在配置文件中使用 - Cursor、Zed 以及大多数其他客户端:
{
"mcpServers": {
"prefab": { "command": "npx", "args": ["-y", "prefab-mcp"] }
}
}然后在 Prefab 的 Settings ▸ Permissions 中打开 Let agents and scripts control Prefab 开关。它默认是关闭的;没有开启时,读取模板没有问题,但创建和部署则不行。
这个开关从 Prefab 1.1.6 开始提供。在更早的版本上,读取类工具可以正常工作,其余工具会明确说明这一点。
需要 macOS,Prefab 已安装并打开过一次,以及 Node 18+(使用 .mcpb 方式时除外)。
工作原理
Prefab 处于沙盒中且没有网络访问权限,因此无法托管任何东西。这个服务器改为在它旁边运行:直接从应用组(~/Library/Group Containers/group.VFDG327T66.prefab)读取资料库,并通过 Finder 扩展使用的同一个 prefab:// URL 请求应用部署。有两点结果值得了解:
部署时 Prefab 必须正在运行。读取则两种情况下都可以。
目标必须是 Prefab 已被授予访问权限的文件夹。macOS 会让沙盒应用无法访问你的文件夹,直到你明确授权。
preview_deploy和deploy_template都会先检查并说明情况,而不是把智能体无法回答的权限对话框留在屏幕上。请在 Prefab 的 Settings ▸ Permissions 中授予文件夹。
这里没有任何内容会写入 Prefab 的资料库。这些文件属于应用所有,如果你在它不知情的情况下修改,下次它保存时会被覆盖。
开发
npm test # checks placeholder resolution matches the app's Swift, case for case
npm run try '[["list_templates",{}]]' # call a tool the way a client doessrc/resolve.js 是 RenamePattern.swift 有意为之的重复副本。如果改动其中一个,请同步改动另一个——npm test 会编译 Swift 并比较两者的结果。
This server cannot be deployed
Maintenance
Related MCP Connectors
Read and write Mission Control state via MCP — projects, tasks, subtasks, templates, status updates.
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
Create App Store screenshots, icons, ASO copy, localization, and revisions via hosted MCP.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables file operations, npm package management, and configuration checking through MCP.1011 npm1MIT
- AlicenseBqualityAmaintenanceEnables AI agents to directly access native macOS services, media, system health, and administration tools through a local MCP server.4013 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP agents to control macOS natively with shell, PTY, background Chrome automation, and Accessibility-based desktop control.1MIT
- AlicenseNot gradedqualityCmaintenanceIt enables MCP integrations to safely access a chosen project folder with path-boundary enforcement, read and search files, and perform confirmed writes over a bounded local Unix-socket transport.1MIT