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

发布远程服务端

NOTE

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

MCP Registry 通过 server.json 中的 remotes 属性支持远程 MCP 服务端:

json
{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "com.example/acme-analytics",
  "title": "ACME Analytics",
  "description": "Real-time business intelligence and reporting platform",
  "version": "2.0.0",
  "remotes": [
    {
      "type": "streamable-http",
      "url": "https://analytics.example.com/mcp"
    }
  ]
}

远程服务端 MUST(必须)在其指定的 URL 上可公开访问。

传输类型

远程服务端应使用 Streamable HTTP 传输。SSE 传输已被弃用,因此仅当需要支持现有客户端时才发布 "sse" 远程服务端。远程服务端也可以在不同 URL 上同时支持两种传输。

通过将 remotes 条目的 type 属性设置为 "streamable-http" 或 "sse" 来指定传输:

json
{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "com.example/acme-analytics",
  "title": "ACME Analytics",
  "description": "Real-time business intelligence and reporting platform",
  "version": "2.0.0",
  "remotes": [
    {
      "type": "streamable-http",
      "url": "https://analytics.example.com/mcp"
    },
    {
      "type": "sse",
      "url": "https://analytics.example.com/sse"
    }
  ]
}

URL 模板变量

远程服务端可以使用 {curly_braces} 记法定义 URL 模板变量。这支持多租户部署,即单个服务端定义可以通过可配置的值支持多个端点:

json
{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "com.example/acme-analytics",
  "title": "ACME Analytics",
  "description": "Real-time business intelligence and reporting platform",
  "version": "2.0.0",
  "remotes": [
    {
      "type": "streamable-http",
      "url": "https://{tenant_id}.analytics.example.com/mcp",
      "variables": {
        "tenant_id": {
          "description": "Your tenant identifier (e.g., 'us-cell1', 'emea-cell1')",
          "isRequired": true
        }
      }
    }
  ]
}

在配置此服务端时,用户提供其 tenant_id 值,URL 模板会被解析为相应的端点(例如 https://us-cell1.analytics.example.com/mcp)。

变量支持 default、choices 和 isSecret 等附加属性:

json
{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "com.example/multi-region-mcp",
  "title": "Multi-Region MCP",
  "description": "MCP server with regional endpoints",
  "version": "1.0.0",
  "remotes": [
    {
      "type": "streamable-http",
      "url": "https://api.example.com/{region}/mcp",
      "variables": {
        "region": {
          "description": "Deployment region",
          "isRequired": true,
          "choices": [
            "us-east-1",
            "eu-west-1",
            "ap-southeast-1"
          ],
          "default": "us-east-1"
        }
      }
    }
  ]
}

HTTP 头

通过向 remotes 条目添加 headers 属性,可以指示 MCP 客户端发送特定的 HTTP 头:

json
{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "com.example/acme-analytics",
  "title": "ACME Analytics",
  "description": "Real-time business intelligence and reporting platform",
  "version": "2.0.0",
  "remotes": [
    {
      "type": "streamable-http",
      "url": "https://analytics.example.com/mcp",
      "headers": [
        {
          "name": "X-API-Key",
          "description": "API key for authentication",
          "isRequired": true,
          "isSecret": true
        }
      ]
    }
  ]
}

同时支持远程与非远程安装

remotes 属性可以与 server.json 中的 packages 属性共存,以便让 MCP 宿主应用选择首选的安装方式。

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",
  "remotes": [
    {
      "type": "streamable-http",
      "url": "https://email.example.com/mcp"
    }
  ],
  "packages": [
    {
      "registryType": "npm",
      "identifier": "@example/email-integration-mcp",
      "version": "1.0.0",
      "transport": {
        "type": "stdio"
      }
    }
  ]
}

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