-
Notifications
You must be signed in to change notification settings - Fork 442
Refactor package types to use dedicated schema types per package type (NPM, PyPI, NuGet, OCI, MCPB) #634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor package types to use dedicated schema types per package type (NPM, PyPI, NuGet, OCI, MCPB) #634
Changes from 21 commits
d97db44
90a363c
e7159e6
3923da9
00554ea
8209174
46d10ef
6534597
803b35c
4636b97
252714b
89b8bad
9004288
7bf9672
5123d11
26e31d9
b6f12cb
1c81e60
b6a47f7
7c0bbf2
fe2cdf5
dd2a68a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,6 +137,8 @@ paths: | |
| registryBaseUrl: "https://registry.npmjs.org" | ||
| identifier: "@modelcontextprotocol/server-filesystem" | ||
| version: "1.0.2" | ||
| transport: | ||
| type: "stdio" | ||
| _meta: | ||
| io.modelcontextprotocol.registry/publisher-provided: | ||
| tool: "publisher-cli" | ||
|
|
@@ -159,6 +161,8 @@ paths: | |
| registryBaseUrl: "https://registry.npmjs.org" | ||
| identifier: "@example/mcp-demo-server" | ||
| version: "1.0.0" | ||
| transport: | ||
| type: "stdio" | ||
| _meta: | ||
| io.modelcontextprotocol.registry/publisher-provided: | ||
| contactEmail: "[email protected]" | ||
|
|
@@ -266,51 +270,28 @@ components: | |
| example: 30 | ||
|
|
||
| Package: | ||
| description: "Package types grouped by structural similarity. The 'registryType' field determines package behavior and which fields are expected. Packages should match at least one of the structural patterns below." | ||
| anyOf: | ||
| - $ref: '#/components/schemas/RegistryPackage' | ||
| - $ref: '#/components/schemas/ImagePackage' | ||
| - $ref: '#/components/schemas/BinaryPackage' | ||
|
|
||
| PackageBase: | ||
| type: object | ||
| description: "Common fields shared across all package types" | ||
| required: | ||
| - registryType | ||
| - identifier | ||
| - version | ||
| - transport | ||
| properties: | ||
| registryType: | ||
| type: string | ||
| description: Registry type indicating how to download packages (e.g., 'npm', 'pypi', 'oci', 'nuget', 'mcpb') | ||
| examples: | ||
| - "npm" | ||
| - "pypi" | ||
| - "oci" | ||
| - "nuget" | ||
| - "mcpb" | ||
| registryBaseUrl: | ||
| type: string | ||
| format: uri | ||
| description: Base URL of the package registry | ||
| description: "Package type discriminator. Common values include npm, pypi, nuget (registry-based), oci (container images), and mcpb (direct binaries)." | ||
| examples: | ||
| - "https://registry.npmjs.org" | ||
| - "https://pypi.org" | ||
| - "https://docker.io" | ||
| - "https://api.nuget.org" | ||
| - "https://github.com" | ||
| - "https://gitlab.com" | ||
| identifier: | ||
| type: string | ||
| description: Package identifier - either a package name (for registries) or URL (for direct downloads) | ||
| examples: | ||
| - "@modelcontextprotocol/server-brave-search" | ||
| - "https://github.com/example/releases/download/v1.0.0/package.mcpb" | ||
| version: | ||
| type: string | ||
| description: "Package version. Must be a specific version. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3', '>=1.2.3', '1.x', '1.*')." | ||
| example: "1.0.2" | ||
| minLength: 1 | ||
| not: | ||
| const: "latest" | ||
| fileSha256: | ||
| type: string | ||
| description: "SHA-256 hash of the package file for integrity verification. Required for MCPB packages and optional for other package types. Authors are responsible for generating correct SHA-256 hashes when creating server.json. If present, MCP clients must validate the downloaded file matches the hash before running packages to ensure file integrity." | ||
| example: "fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce" | ||
| pattern: "^[a-f0-9]{64}$" | ||
| - npm | ||
| - pypi | ||
| - nuget | ||
| - oci | ||
| - mcpb | ||
| runtimeHint: | ||
| type: string | ||
| description: A hint to help clients determine the appropriate runtime for the package. This field should be provided when `runtimeArguments` are present. | ||
|
|
@@ -337,6 +318,118 @@ components: | |
| items: | ||
| $ref: '#/components/schemas/KeyValueInput' | ||
|
|
||
| RegistryPackage: | ||
|
||
| description: | | ||
| Registry-based packages (npm, pypi, nuget, and others). | ||
| These packages use a registry to store and distribute packages, identified by package name + version. | ||
| The registryBaseUrl can be customized or defaults to the standard registry for each type: | ||
| - npm: https://registry.npmjs.org | ||
| - pypi: https://pypi.org | ||
| - nuget: https://api.nuget.org/v3/index.json | ||
| allOf: | ||
| - $ref: '#/components/schemas/PackageBase' | ||
| - type: object | ||
| required: | ||
| - identifier | ||
| - version | ||
| properties: | ||
| registryType: | ||
| type: string | ||
| description: "Type of package registry" | ||
| examples: | ||
| - npm | ||
| - pypi | ||
| - nuget | ||
| identifier: | ||
| type: string | ||
| description: | | ||
| Package name or identifier in the registry. | ||
| - npm: Package name with or without @scope (e.g., "@modelcontextprotocol/server-filesystem", "express") | ||
| - pypi: Package name (e.g., "mcp-server-time", "flask") | ||
| - nuget: Package ID (e.g., "ModelContextProtocol.Server", "Newtonsoft.Json") | ||
| examples: | ||
| - "@modelcontextprotocol/server-filesystem" | ||
| - "mcp-server-time" | ||
| - "ModelContextProtocol.Server" | ||
| minLength: 1 | ||
| version: | ||
| type: string | ||
| description: "Package version. Must be a specific version. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3', '>=1.2.3', '1.x', '1.*', 'latest')." | ||
| example: "1.0.2" | ||
| minLength: 1 | ||
| not: | ||
| const: "latest" | ||
| registryBaseUrl: | ||
| type: string | ||
| format: uri | ||
| description: | | ||
| Registry base URL. Optional, with type-specific defaults: | ||
| - npm: https://registry.npmjs.org | ||
| - pypi: https://pypi.org | ||
| - nuget: https://api.nuget.org/v3/index.json | ||
| examples: | ||
| - "https://registry.npmjs.org" | ||
| - "https://pypi.org" | ||
| - "https://api.nuget.org/v3/index.json" | ||
|
|
||
| ImagePackage: | ||
| description: | | ||
| OCI container image packages. | ||
| Uses a single canonical reference that includes registry, namespace, image, and tag/digest. | ||
| Format: [registry/]namespace/image[:tag][@digest] | ||
| Registry defaults to docker.io if not specified. | ||
| Examples: 'ghcr.io/owner/repo:v1.0.0', 'docker.io/library/postgres:16', 'owner/repo:latest' | ||
| allOf: | ||
| - $ref: '#/components/schemas/PackageBase' | ||
| - type: object | ||
| required: | ||
| - identifier | ||
| properties: | ||
| registryType: | ||
| type: string | ||
| const: oci | ||
| identifier: | ||
| type: string | ||
| description: | | ||
| Full OCI image reference including registry, namespace, image, and tag/digest. | ||
| Registry defaults to docker.io if not specified. Must include at least a tag or digest. | ||
| examples: | ||
| - "ghcr.io/modelcontextprotocol/server-example:v1.0.0" | ||
| - "docker.io/library/postgres:16" | ||
| - "owner/repo:latest" | ||
| - "ghcr.io/owner/repo@sha256:abc123..." | ||
| - "owner/repo:v1.0.0@sha256:abc123..." | ||
| minLength: 1 | ||
|
|
||
| BinaryPackage: | ||
| description: | | ||
| Direct binary download packages (MCPB format). | ||
| Uses a direct HTTPS download URL with SHA-256 hash for integrity verification. | ||
| Currently supports GitHub and GitLab release assets. | ||
| allOf: | ||
| - $ref: '#/components/schemas/PackageBase' | ||
| - type: object | ||
| required: | ||
| - identifier | ||
| - fileSha256 | ||
| properties: | ||
| registryType: | ||
| type: string | ||
| const: mcpb | ||
|
||
| identifier: | ||
| type: string | ||
| format: uri | ||
| description: "Direct HTTPS download URL to the MCPB binary. Must be from GitHub or GitLab release assets." | ||
| examples: | ||
| - "https://github.com/owner/repo/releases/download/v1.0.0/server-macos-arm64.mcpb" | ||
| - "https://gitlab.com/owner/repo/-/releases/v1.0.0/downloads/server.mcpb" | ||
| minLength: 1 | ||
| fileSha256: | ||
| type: string | ||
| description: "SHA-256 hash of the file for integrity verification. Required for MCPB packages. MCP clients must validate the downloaded file matches this hash before execution." | ||
| example: "fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce" | ||
| pattern: "^[a-f0-9]{64}$" | ||
|
|
||
| Input: | ||
| type: object | ||
| properties: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[can be a follow up PR if you agree] I feel like we should use the "flavors" of Package types internally, and just map each of them to a "list of supported registry types" that can be expanded over time as support is added for more registry types. Instead of bespoke recreating each of the flavors on a per-type basis from Package in this switch statement.