From 8fd01396855a1ef141edfc18abec57d11c6bb386 Mon Sep 17 00:00:00 2001 From: Mathew Goldsborough <1759329+mgoldsborough@users.noreply.github.com> Date: Fri, 26 Dec 2025 13:29:46 -1000 Subject: [PATCH] feat(model): add architecture field to Package Add optional `architecture` field to Package for specifying target OS and architecture (e.g., 'linux-amd64', 'darwin-arm64'). This allows clients to select the appropriate package for their platform without parsing identifiers. Primarily useful for MCPB packages that provide platform-specific binaries. --- docs/reference/api/openapi.yaml | 10 ++++++++++ docs/reference/server-json/server.schema.json | 12 ++++++++++++ pkg/model/constants.go | 10 ++++++++++ pkg/model/types.go | 2 ++ 4 files changed, 34 insertions(+) diff --git a/docs/reference/api/openapi.yaml b/docs/reference/api/openapi.yaml index e05c934d..e2cb4ae9 100644 --- a/docs/reference/api/openapi.yaml +++ b/docs/reference/api/openapi.yaml @@ -524,6 +524,16 @@ components: 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}$" + architecture: + type: string + description: "Target OS and architecture for the package (e.g., 'linux-amd64', 'darwin-arm64'). Allows clients to select the appropriate package for their platform without parsing identifiers." + examples: + - "linux-amd64" + - "linux-arm64" + - "darwin-amd64" + - "darwin-arm64" + - "windows-amd64" + - "windows-arm64" 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. diff --git a/docs/reference/server-json/server.schema.json b/docs/reference/server-json/server.schema.json index e25191b1..bb93a6eb 100644 --- a/docs/reference/server-json/server.schema.json +++ b/docs/reference/server-json/server.schema.json @@ -206,6 +206,18 @@ }, "Package": { "properties": { + "architecture": { + "description": "Target OS and architecture for the package (e.g., 'linux-amd64', 'darwin-arm64'). Allows clients to select the appropriate package for their platform without parsing identifiers.", + "examples": [ + "linux-amd64", + "linux-arm64", + "darwin-amd64", + "darwin-arm64", + "windows-amd64", + "windows-arm64" + ], + "type": "string" + }, "environmentVariables": { "description": "A mapping of environment variables to be set when running the package.", "items": { diff --git a/pkg/model/constants.go b/pkg/model/constants.go index e817f2a6..b51a7c62 100644 --- a/pkg/model/constants.go +++ b/pkg/model/constants.go @@ -33,6 +33,16 @@ const ( RuntimeHintDNX = "dnx" ) +// Architecture - OS and architecture combinations for packages +const ( + ArchLinuxAMD64 = "linux-amd64" + ArchLinuxARM64 = "linux-arm64" + ArchDarwinAMD64 = "darwin-amd64" + ArchDarwinARM64 = "darwin-arm64" + ArchWindowsAMD64 = "windows-amd64" + ArchWindowsARM64 = "windows-arm64" +) + // Schema versions const ( // CurrentSchemaVersion is the current supported schema version date diff --git a/pkg/model/types.go b/pkg/model/types.go index 8a7443d8..0eb23214 100644 --- a/pkg/model/types.go +++ b/pkg/model/types.go @@ -38,6 +38,8 @@ type Package struct { Version string `json:"version,omitempty" minLength:"1" doc:"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"` // FileSHA256 is the SHA-256 hash for integrity verification (required for mcpb, optional for others) FileSHA256 string `json:"fileSha256,omitempty" pattern:"^[a-f0-9]{64}$" doc:"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"` + // Architecture specifies the target OS and architecture (e.g., "linux-amd64", "darwin-arm64") + Architecture string `json:"architecture,omitempty" doc:"Target OS and architecture for the package (e.g., 'linux-amd64', 'darwin-arm64'). Allows clients to select the appropriate package for their platform without parsing identifiers." example:"linux-amd64"` // RunTimeHint suggests the appropriate runtime for the package RunTimeHint string `json:"runtimeHint,omitempty" doc:"A hint to help clients determine the appropriate runtime for the package. This field should be provided when runtimeArguments are present." example:"npx"` // Transport is required and specifies the transport protocol configuration