MCP Registry 支持的包类型
社区译文;来源: MCP 80041ab0
包类型
MCP Registry 支持多种不同的包类型,每种包类型都有自己的验证方法。
npm 包
对于 npm 包,MCP Registry 目前仅支持 npm 公共注册表(https://registry.npmjs.org)。
npm 包在 server.json 中使用 "registryType": "npm"。例如:
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.username/email-integration-mcp",
"title": "Email Integration",
"description": "Send emails and manage email accounts",
"version": "1.0.0",
"packages": [
{
"registryType": "npm",
"identifier": "@username/email-integration-mcp",
"version": "1.0.0",
"transport": {
"type": "stdio"
}
}
]
}所有权验证
MCP Registry 通过检查 package.json 中的 mcpName 来验证 npm 包的所有权。mcpName 属性**必须(MUST)**与 server.json 中的服务器名称匹配。例如:
{
"name": "@username/email-integration-mcp",
"version": "1.0.0",
"mcpName": "io.github.username/email-integration-mcp"
}PyPI 包
对于 PyPI 包,MCP Registry 目前仅支持官方 PyPI 注册表(https://pypi.org)。
PyPI 包在 server.json 中使用 "registryType": "pypi"。例如:
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.username/database-query-mcp",
"title": "Database Query",
"description": "Execute SQL queries and manage database connections",
"version": "1.0.0",
"packages": [
{
"registryType": "pypi",
"identifier": "database-query-mcp",
"version": "1.0.0",
"transport": {
"type": "stdio"
}
}
]
}所有权验证
MCP Registry 通过检查包 README 中是否存在 mcp-name: $SERVER_NAME 字符串来验证 PyPI 包的所有权(该 README 会成为 PyPI 上的包描述)。此字符串可以隐藏在注释中,但 $SERVER_NAME 部分**必须(MUST)**与 server.json 中的服务器名称匹配。例如:
# Database Query MCP Server
This MCP server executes SQL queries and manages database connections.
<!-- mcp-name: io.github.username/database-query-mcp -->NuGet 包
对于 NuGet 包,MCP Registry 目前仅支持官方 NuGet 注册表(https://api.nuget.org/v3/index.json)。
NuGet 包在 server.json 中使用 "registryType": "nuget"。例如:
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.username/azure-devops-mcp",
"title": "Azure DevOps",
"description": "Manage Azure DevOps work items and pipelines",
"version": "1.0.0",
"packages": [
{
"registryType": "nuget",
"identifier": "Username.AzureDevOpsMcp",
"version": "1.0.0",
"transport": {
"type": "stdio"
}
}
]
}所有权验证
MCP Registry 通过检查包 README 中是否存在 mcp-name: $SERVER_NAME 字符串来验证 NuGet 包的所有权。此字符串可以隐藏在注释中,但 $SERVER_NAME 部分**必须(MUST)**与 server.json 中的服务器名称匹配。例如:
# Azure DevOps MCP Server
This MCP server manages Azure DevOps work items and pipelines.
<!-- mcp-name: io.github.username/azure-devops-mcp -->Cargo(Rust)包
对于 Cargo 包,MCP Registry 目前仅支持官方 crates.io 注册表(https://crates.io)。
Cargo 包在 server.json 中使用 "registryType": "cargo"。例如:
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.username/widget-mcp",
"title": "Widget",
"description": "Rust-native MCP server",
"version": "0.3.0",
"packages": [
{
"registryType": "cargo",
"identifier": "widget-mcp",
"version": "0.3.0",
"transport": {
"type": "stdio"
}
}
]
}运行时模型
Cargo 的运行时模型与 npm、PyPI 和 NuGet 不同。cargo install <crate> 会将编译后的二进制文件放入 PATH 中的 ~/.cargo/bin,之后 MCP 客户端直接按名称调用该二进制文件。它没有与 npx(npm)、uvx(PyPI)或 dnx(NuGet,.NET 10 SDK Preview 6 及更高版本)等效的单次调用运行器。因此,安装只需进行一次,执行时直接使用二进制文件名称。基于这一原因,上面的 Cargo 示例特意省略了 runtimeHint。
Rust MCP 作者有两种一等的分发方式:
- Cargo(
registryType: cargo):通过 crates.io 分发源代码。最终用户需要 Rust 工具链(rustup)才能运行cargo install。这种方式符合 Rust 生态系统的惯例,也与 Rust CLI 的常见发布方式一致。 - MCPB(
registryType: mcpb):通过 GitHub 或 GitLab Releases 分发预构建二进制文件。最终用户不需要工具链。如果重点是“不要求安装 Rust 工具链”,应选择这种方式。
两种方式都受支持,具体选择由作者决定。Cargo 原生支持使偏好源代码分发的 Rust 作者无需被迫采用 MCPB 二进制打包方案。
所有权验证
MCP Registry 通过检查包 README 中是否存在 mcp-name: $SERVER_NAME 字符串来验证 Cargo 包的所有权(该 README 会渲染为 HTML,并由 crates.io 的静态 CDN 提供)。$SERVER_NAME 部分**必须(MUST)**与 server.json 中的服务器名称匹配。例如:
# Widget MCP Server
A Rust-native MCP server for widget operations.
- MCP Registry name: `mcp-name: io.github.username/widget-mcp`Cargo 特有的注意事项:与 PyPI 和 NuGet 会在 README 渲染结果中保留 HTML 注释不同,crates.io 会在 Markdown 转换为 HTML 时移除 HTML 注释。适用于 PyPI 和 NuGet 的 <!-- mcp-name: ... --> 隐藏注释形式不适用于 Cargo,因为验证器检查的渲染后 HTML 中不会出现该令牌。Cargo 作者必须将 mcp-name: 令牌作为可见的 Markdown 文本。推荐的写法是在“链接”部分添加一条简单的列表项。
Docker/OCI 镜像
对于 Docker/OCI 镜像,MCP Registry 目前支持:
- Docker Hub(
docker.io) - GitHub Container Registry(
ghcr.io) - Google Artifact Registry(任意
*.pkg.dev域名) - Azure Container Registry(
*.azurecr.io) - Microsoft Container Registry(
mcr.microsoft.com)
Docker/OCI 镜像在 server.json 中使用 "registryType": "oci"。例如:
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.username/kubernetes-manager-mcp",
"title": "Kubernetes Manager",
"description": "Deploy and manage Kubernetes resources",
"version": "1.0.0",
"packages": [
{
"registryType": "oci",
"identifier": "docker.io/yourusername/kubernetes-manager-mcp:1.0.0",
"transport": {
"type": "stdio"
}
}
]
}identifier 的格式为 registry/namespace/repository:tag,例如 docker.io/user/app:1.0.0 或 ghcr.io/user/app:1.0.0。标签也可以指定为摘要。
所有权验证
MCP Registry 通过检查 io.modelcontextprotocol.server.name 注解来验证 Docker/OCI 镜像的所有权。io.modelcontextprotocol.server.name 注解的值**必须(MUST)**与 server.json 中的服务器名称匹配。例如:
LABEL io.modelcontextprotocol.server.name="io.github.username/kubernetes-manager-mcp"MCPB 包
对于 MCPB 包,MCP Registry 目前支持通过 GitHub 或 GitLab release 托管的 MCPB 制品。
MCPB 包在 server.json 中使用 "registryType": "mcpb"。例如:
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.username/image-processor-mcp",
"title": "Image Processor",
"description": "Process and transform images with various filters",
"version": "1.0.0",
"packages": [
{
"registryType": "mcpb",
"identifier": "https://github.com/username/image-processor-mcp/releases/download/v1.0.0/image-processor.mcpb",
"fileSha256": "fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce",
"transport": {
"type": "stdio"
}
}
]
}验证
MCPB 包 URL(即 server.json 中的 identifier)**必须(MUST)**包含字符串“mcp”。它可以出现在 .mcpb 文件扩展名中,也可以出现在仓库名称中。
server.json 中的包元数据**必须(MUST)**包含 fileSha256 属性,其值为 MCPB 制品的 SHA-256 哈希。可以使用 openssl 命令计算该哈希:
openssl dgst -sha256 image-processor.mcpbMCP Registry 不验证该哈希,但 MCP 客户端在安装前会验证该哈希,以确保文件完整性。下游注册表也可以实现自己的验证逻辑。