Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/schemas/0.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const McpbManifestSchema = z
screenshots: z.array(z.string()).optional(),
server: McpbManifestServerSchema,
tools: z.array(McpbManifestToolSchema).optional(),
tools_generated: z.boolean().optional(),
tools_generated: z.boolean().optional(),
prompts: z.array(McpbManifestPromptSchema).optional(),
prompts_generated: z.boolean().optional(),
keywords: z.array(z.string()).optional(),
Expand Down
1 change: 0 additions & 1 deletion src/schemas/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * as v0_1 from "./0.1.js";
export * as v0_2 from "./0.2.js";
export * as v0_3 from "./0.3.js";
export * as latest from "./latest.js";
export {
MANIFEST_VERSION as LATEST_MANIFEST_VERSION,
Expand Down
69 changes: 30 additions & 39 deletions src/schemas/0.3.ts → src/schemas/vNext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// WIP: This schema is under development and not yet finalized
import * as z from "zod";

export const MANIFEST_VERSION = "0.3";
export const MANIFEST_VERSION = "vNext";

export const McpServerConfigSchema = z.strictObject({
command: z.string(),
Expand Down Expand Up @@ -77,44 +77,35 @@ export const McpbUserConfigValuesSchema = z.record(
z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]),
);

export const McpbManifestSchema = z
.strictObject({
$schema: z.string().optional(),
dxt_version: z
.literal(MANIFEST_VERSION)
.optional()
.describe("@deprecated Use manifest_version instead"),
manifest_version: z.literal(MANIFEST_VERSION).optional(),
name: z.string(),
display_name: z.string().optional(),
version: z.string(),
description: z.string(),
long_description: z.string().optional(),
author: McpbManifestAuthorSchema,
repository: McpbManifestRepositorySchema.optional(),
homepage: z.string().url().optional(),
documentation: z.string().url().optional(),
support: z.string().url().optional(),
icon: z.string().optional(),
screenshots: z.array(z.string()).optional(),
server: McpbManifestServerSchema,
tools: z.array(McpbManifestToolSchema).optional(),
tools_generated: z.boolean().optional(),
prompts: z.array(McpbManifestPromptSchema).optional(),
prompts_generated: z.boolean().optional(),
keywords: z.array(z.string()).optional(),
license: z.string().optional(),
privacy_policies: z.array(z.string().url()).optional(),
compatibility: McpbManifestCompatibilitySchema.optional(),
user_config: z
.record(z.string(), McpbUserConfigurationOptionSchema)
.optional(),
_meta: z.record(z.string(), z.record(z.string(), z.any())).optional(),
})
.refine((data) => !!(data.dxt_version || data.manifest_version), {
message:
"Either 'dxt_version' (deprecated) or 'manifest_version' must be provided",
});
export const McpbManifestSchema = z.strictObject({
$schema: z.string().optional(),
manifest_version: z.literal(MANIFEST_VERSION).optional(),
name: z.string(),
display_name: z.string().optional(),
version: z.string(),
description: z.string(),
long_description: z.string().optional(),
author: McpbManifestAuthorSchema,
repository: McpbManifestRepositorySchema.optional(),
homepage: z.string().url().optional(),
documentation: z.string().url().optional(),
support: z.string().url().optional(),
icon: z.string().optional(),
screenshots: z.array(z.string()).optional(),
server: McpbManifestServerSchema,
tools: z.array(McpbManifestToolSchema).optional(),
tools_generated: z.boolean().optional(),
prompts: z.array(McpbManifestPromptSchema).optional(),
prompts_generated: z.boolean().optional(),
keywords: z.array(z.string()).optional(),
license: z.string().optional(),
privacy_policies: z.array(z.string().url()).optional(),
compatibility: McpbManifestCompatibilitySchema.optional(),
user_config: z
.record(z.string(), McpbUserConfigurationOptionSchema)
.optional(),
_meta: z.record(z.string(), z.record(z.string(), z.any())).optional(),
});

export const McpbSignatureInfoSchema = z.strictObject({
status: z.enum(["signed", "unsigned", "self-signed"]),
Expand Down
15 changes: 7 additions & 8 deletions test/schemas.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFileSync } from "fs";
import { join } from "path";

import { McpbManifestSchema, v0_3 } from "../src/schemas/index.js";
import { McpbManifestSchema, vNext } from "../src/schemas/index.js";

describe("McpbManifestSchema", () => {
it("should validate a valid manifest", () => {
Expand Down Expand Up @@ -139,7 +139,7 @@ describe("McpbManifestSchema", () => {

describe("_meta", () => {
const base = {
manifest_version: "0.3",
manifest_version: "vNext",
name: "client-ext-test",
version: "1.0.0",
description: "Test manifest",
Expand All @@ -162,7 +162,7 @@ describe("McpbManifestSchema", () => {
"com.apple.darwin": { bundle_id: "com.example.app", notarized: true },
},
};
const result = v0_3.McpbManifestSchema.safeParse(manifest);
const result = vNext.McpbManifestSchema.safeParse(manifest);
expect(result.success).toBe(true);
});

Expand All @@ -176,7 +176,7 @@ describe("McpbManifestSchema", () => {
>,
},
};
const result = v0_3.McpbManifestSchema.safeParse(manifest);
const result = vNext.McpbManifestSchema.safeParse(manifest);
expect(result.success).toBe(false);
if (!result.success) {
const messages = result.error.issues.map((i) => i.message).join("\n");
Expand All @@ -191,7 +191,7 @@ describe("McpbManifestSchema", () => {
"com.apple.darwin": [] as unknown as Record<string, unknown>,
},
};
const result = v0_3.McpbManifestSchema.safeParse(manifest);
const result = vNext.McpbManifestSchema.safeParse(manifest);
expect(result.success).toBe(false);
});

Expand All @@ -202,15 +202,14 @@ describe("McpbManifestSchema", () => {
custom: null as unknown as Record<string, unknown>,
},
};
const result = v0_3.McpbManifestSchema.safeParse(manifest);
const result = vNext.McpbManifestSchema.safeParse(manifest);
expect(result.success).toBe(false);
});

it("allows empty object for _meta", () => {
const manifest = { ...base, _meta: {} };
const result = v0_3.McpbManifestSchema.safeParse(manifest);
const result = vNext.McpbManifestSchema.safeParse(manifest);
expect(result.success).toBe(true);
});
});

});
Loading