Skip to content
MCP 文档版本 2026-07-28 更新于 2026-10-14

MCP Registry 支持的包类型

NOTE

MCP Registry 目前处于预览阶段。在正式发布之前,可能会出现破坏性变更或数据重置。如果您遇到任何问题,请在 GitHub 上报告。

包类型

MCP Registry 支持多种不同的包类型,每种包类型都有各自的验证方法。

npm 包

对于 npm 包,MCP Registry 目前仅支持 npm 公共注册表(https://registry.npmjs.org)。

npm 包在 server.json 中使用 "registryType": "npm"。例如:

json
{
  "$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 中的服务端名称匹配。例如:

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"。例如:

json
{
  "$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(在 PyPI 上会成为包描述)中是否存在 mcp-name: $SERVER_NAME 字符串来验证 PyPI 包的所有权。该字符串可以隐藏在注释中,但 $SERVER_NAME 部分 MUST(必须)与 server.json 中的服务端名称匹配。例如:

markdown
# 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"。例如:

json
{
  "$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 中的服务端名称匹配。例如:

markdown
# 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"。例如:

json
{
  "$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(其被渲染为 HTML 并由 crates.io 的静态 CDN 提供)中是否存在 mcp-name: $SERVER_NAME 字符串来验证 Cargo 包的所有权。$SERVER_NAME 部分 MUST(必须)与 server.json 中的服务端名称匹配。例如:

markdown
# 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 文本包含在内。推荐的做法是在 Links 部分添加一个简单的列表项。

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"。例如:

json
{
  "$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。tag 也可以指定为 digest。

所有权验证

MCP Registry 通过检查 io.modelcontextprotocol.server.name 注解来验证 Docker/OCI 镜像的所有权。io.modelcontextprotocol.server.name 注解的值 MUST(必须)与 server.json 中的服务端名称匹配。例如:

dockerfile
LABEL io.modelcontextprotocol.server.name="io.github.username/kubernetes-manager-mcp"

MCPB 包

对于 MCPB 包,MCP Registry 目前支持通过 GitHub 或 GitLab releases 托管的 MCPB 制品。

MCPB 包在 server.json 中使用 "registryType": "mcpb"。例如:

json
{
  "$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 命令计算:

bash
openssl dgst -sha256 image-processor.mcpb

MCP Registry 不验证此哈希;但是,MCP 客户端会在安装前验证该哈希以确保文件完整性。下游注册表也可以实现自己的验证。

BytesRouter 是社区翻译站点,所有译文仅供参考,一切以官方英文原文为准。