帮助开发者把本地 MCP 服务打包成自带运行时的 .mcpb 安装包。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "build-mcpb" 技能: 1. 下载 https://raw.githubusercontent.com/anthropics/claude-plugins-official/main/plugins/mcp-server-dev/skills/build-mcpb/SKILL.md 2. 保存为 ~/.claude/skills/build-mcpb/SKILL.md 3. 装好后重载技能,告诉我可以用了
请把我的本地 stdio MCP 文件服务整理成 MCPB 打包方案,包含 manifest.json 所需字段、user_config 的目录选择配置,以及 Node 入口命令示例。
给出适用于本地文件访问场景的 MCPB 清单结构、配置项和打包说明。
我有一个需要在用户电脑上调用桌面应用的 MCP 服务。请说明为什么应使用 MCPB,并生成一个适合分发的 bundle 结构与 manifest 示例。
说明本地运行的适用性,并产出可安装的 MCPB 目录与 manifest 示例。
请帮助我把一个 Python 本地 MCP 服务打包为 .mcpb,重点说明 mcp_config 的 command、args、env 应如何写,以及如何让用户无需预装 Python。
输出面向 Python 本地服务的 MCPB 配置建议与运行时打包要点。
开发者在服务需要读取本地文件、访问 localhost 服务或调用操作系统 API 时,可以用它把本地 stdio MCP 服务打包为可安装的 .mcpb 文件。这样用户无需自行准备 Node、Python 或其他工具链。
如果 MCP 服务需要在用户电脑上驱动桌面应用或与本机软件集成,这个技能适合生成带运行时的分发方案。它尤其适用于必须在本地执行、不能仅靠远程 HTTP 服务完成的场景。
当开发者需要在安装时让用户选择目录或填写敏感配置时,可以借助它梳理 manifest 中的 user_config 字段。这样配置会在宿主界面中展示,并映射到服务启动命令的环境变量。
文档介绍如何把本地 MCP 服务打包为自带运行时的 MCPB 文件,便于用户在未安装 Node、Python 或工具链的情况下直接安装运行。内容重点包括何时应选择 MCPB 而非远程服务、bundle 的目录结构、manifest.json 的关键字段,以及如何通过 mcp_config 和 user_config 定义启动命令、环境变量与安装时配置。
MCPB is a local MCP server packaged with its runtime. The user installs one file; it runs without needing Node, Python, or any toolchain on their machine. It's the sanctioned way to distribute local MCP servers.
MCPB is the secondary distribution path. Anthropic recommends remote MCP servers for directory listing — see https://claude.com/docs/connectors/building/what-to-build.
Use MCPB when the server must run on the user's machine — reading local files, driving a desktop app, talking to localhost services, OS-level APIs. If your server only hits cloud APIs, you almost certainly want a remote HTTP server instead (see build-mcp-server). Don't pay the MCPB packaging tax for something that could be a URL.
my-server.mcpb (zip archive)
├── manifest.json ← identity, entry point, config schema, compatibility
├── server/ ← your MCP server code
│ ├── index.js
│ └── node_modules/ ← bundled dependencies (or vendored)
└── icon.png
The host reads manifest.json, launches server.mcp_config.command as a stdio MCP server, and pipes messages. From your code's perspective it's identical to a local stdio server — the only difference is packaging.
{
"$schema": "https://raw.githubusercontent.com/anthropics/mcpb/main/schemas/mcpb-manifest-v0.4.schema.json",
"manifest_version": "0.4",
"name": "local-files",
"version": "0.1.0",
"description": "Read, search, and watch files on the local filesystem.",
"author": { "name": "Your Name" },
"server": {
"type": "node",
"entry_point": "server/index.js",
"mcp_config": {
"command": "node",
"args": ["${__dirname}/server/index.js"],
"env": {
"ROOT_DIR": "${user_config.rootDir}"
}
}
},
"user_config": {
"rootDir": {
"type": "directory",
"title": "Root directory",
"description": "Directory to expose. Defaults to ~/Documents.",
"default": "${HOME}/Documents",
"required": true
}
},
"compatibility": {
"claude_desktop": ">=1.0.0",
"platforms": ["darwin", "win32", "linux"]
}
}
server.type — node, python, or binary. Informational; the actual launch comes from mcp_config.
server.mcp_config — the literal command/args/env to spawn. Use ${__dirname} for bundle-relative paths and ${user_config.<key>} to substitute install-time config. There's no auto-prefix — the env var names your server reads are exactly what you put in env.
user_config — install-time settings surfaced in the host's UI. type: "directory" renders a native folder picker. sensitive: true stores in OS keychain. See references/manifest-schema.md for all fields.
The server itself is a standard stdio MCP server. Nothing MCPB-specific in the tool logic.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { readFile, readdir } from "node:fs/promises";
import { join } from "node:path";
import { homedir } from "node:os";
// ROOT_DIR comes from what you put in manifest's server.mcp_config.env — no auto-prefix
const ROOT = (process.env.ROOT_DIR ?? join(homedir(), "Documents"));
const server = new McpServer({ name: "local-files", version: "0.1.0" });
server.registerTool(
"list_files",
{
description: "List files in a directory under the configured root.",
inputSchema: { path: z.string().default(".") },
annotations: { readOnlyHint: true },
},
async ({ path }) => {
const entries = await readdir(join(ROOT, path), { withFileTypes: true });
const list = entries.map(e => ({ name: e.name, dir: e.isDirectory() }));
return { content: [{ type: "text", text: JSON.stringify(list, null, 2) }] };
},
);
…
MCPB 是一种把本地 MCP 服务连同运行时一起打包的分发形式,用户安装一个文件即可运行。文档说明它适用于本地 stdio MCP 服务的安装与分发。
当服务必须运行在用户机器上,例如读取本地文件、驱动桌面应用、访问 localhost 服务或调用操作系统 API 时,应考虑 MCPB。若服务只调用云 API,文档建议通常更适合远程 HTTP 服务。
文档中的 manifest 示例显示 server.type 可为 node、python 或 binary,但实际启动方式由 mcp_config 的 command、args、env 决定。user_config 可定义安装时配置,例如目录选择器;更多字段见源码仓库。
帮助开发者为 Claude Code 设计、编写和组织斜杠命令。
浏览 Anthropic 官方精选的 Claude Code 插件目录并快速发现可用工具
帮助开发者为 Claude Code 插件创建事件驱动 Hook,并校验工具调用与自动化流程。
帮助开发者梳理需求并规划合适的 MCP 服务器构建方案
生成可视化交互式单文件 HTML playground,便于探索配置并复制提示词
Audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates. Also use when the user mentions "CLAUDE.md maintenance" or "project memory optimization".
通过 MCP 协议与 REST 接口统一发布、编写和复用 AI 工具与技能。
通过终端命令、Python执行与文件操作,帮助用户完成本地开发与自动化任务。
在 macOS 上安全检索文件、运行快捷指令并管理本地工具与模型
帮助用户在桌面端发现、浏览并安装各类 MCP 服务器工具。
让 AI 在本地安全地读写文件、搜索内容并执行终端命令。
用自然语言搭建本地 MCP 服务器与 AI 工具,并连接主流兼容助手