feat: replace manifest_version with $schema field

- Replace manifest_version with $schema field pointing to official schema URL
- Support backward compatibility with legacy dxt_version field
- Update all examples and tests to use new $schema field
- Mark dxt_version as deprecated but still functional
- Require either $schema or dxt_version (at least one must be present)
This commit is contained in:
Joan Xie 2025-08-27 10:38:57 -07:00
commit 7997e72758
No known key found for this signature in database
3 changed files with 94 additions and 30 deletions

View file

@ -773,7 +773,7 @@ export function buildManifest(
const { keywords, license, repository } = optionalFields;
return {
manifest_version: "0.1",
$schema: "https://static.modelcontextprotocol.io/schemas/2025-08-26/mcpb.manifest.schema.json",
name,
...(displayName && displayName !== name
? { display_name: displayName }

View file

@ -79,8 +79,7 @@ export const McpbUserConfigValuesSchema = z.record(
export const McpbManifestSchema = z
.object({
$schema: z.string().optional(),
dxt_version: z.string().optional().describe("@deprecated Use manifest_version instead"),
manifest_version: z.string().optional(),
dxt_version: z.string().optional().describe("@deprecated - Use $schema instead"),
name: z.string(),
display_name: z.string().optional(),
version: z.string(),
@ -106,9 +105,9 @@ export const McpbManifestSchema = z
.optional(),
})
.refine(
(data) => !!(data.dxt_version || data.manifest_version),
(data) => !!(data.$schema || data.dxt_version),
{
message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided",
message: "Either '$schema' or 'dxt_version' (deprecated) must be provided",
}
);

View file

@ -79,8 +79,7 @@ export const McpbUserConfigValuesSchema = z.record(
export const McpbManifestSchema = z
.strictObject({
$schema: z.string().optional(),
dxt_version: z.string().optional().describe("@deprecated Use manifest_version instead"),
manifest_version: z.string().optional(),
dxt_version: z.string().optional().describe("@deprecated - Use $schema instead"),
name: z.string(),
display_name: z.string().optional(),
version: z.string(),
@ -106,9 +105,9 @@ export const McpbManifestSchema = z
.optional(),
})
.refine(
(data) => !!(data.dxt_version || data.manifest_version),
(data) => !!(data.$schema || data.dxt_version),
{
message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided",
message: "Either '$schema' or 'dxt_version' (deprecated) must be provided",
}
);