diff --git a/src/shared/config.ts b/src/shared/config.ts index 20e4262..ab8e096 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -1,6 +1,6 @@ import type { Logger, - McpbManifest, + McpbManifestLatest, McpbUserConfigValues, McpServerConfig, } from "../types.js"; @@ -85,7 +85,7 @@ export function replaceVariables( } interface GetMcpConfigForManifestOptions { - manifest: McpbManifest; + manifest: McpbManifestLatest; extensionPath: string; systemDirs: Record; userConfig: McpbUserConfigValues; @@ -179,7 +179,7 @@ export async function getMcpConfigForManifest( } interface HasRequiredConfigMissingOptions { - manifest: McpbManifest; + manifest: McpbManifestLatest; userConfig?: McpbUserConfigValues; } diff --git a/src/types.ts b/src/types.ts index 0b6b2a3..a620b0d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -15,6 +15,7 @@ import type { McpbUserConfigValuesSchema, McpServerConfigSchema, } from "./schemas/latest.js"; +import type { McpbManifestSchema as McpbManifestSchemaAny } from "./schemas/any.js"; export type McpServerConfig = z.infer; @@ -46,7 +47,22 @@ export type McpbUserConfigurationOption = z.infer< export type McpbUserConfigValues = z.infer; -export type McpbManifest = z.infer; +/** + * McpbManifest type that accepts any supported manifest version (0.1, 0.2, 0.3). + * This is the default manifest type that should be used for maximum compatibility. + */ +export type McpbManifest = z.infer; + +/** + * @deprecated Use McpbManifest instead. This alias is kept for backward compatibility. + */ +export type McpbManifestAny = z.infer; + +/** + * McpbManifest type for the latest manifest version only (0.3). + * Use this when you specifically need the latest version. + */ +export type McpbManifestLatest = z.infer; /** * Information about a MCPB package signature diff --git a/test/config.test.ts b/test/config.test.ts index f7a0eb8..4701890 100644 --- a/test/config.test.ts +++ b/test/config.test.ts @@ -3,7 +3,7 @@ import { hasRequiredConfigMissing, replaceVariables, } from "../src/shared/config"; -import type { Logger, McpbManifest } from "../src/types"; +import type { Logger, McpbManifestLatest } from "../src/types"; describe("replaceVariables", () => { it("should replace variables in strings", () => { @@ -89,7 +89,7 @@ describe("getMcpConfigForManifest", () => { data: "/data", }; - const baseManifest: McpbManifest = { + const baseManifest: McpbManifestLatest = { manifest_version: "0.3", name: "test-extension", version: "1.0.0", @@ -114,7 +114,7 @@ describe("getMcpConfigForManifest", () => { const manifest = { ...baseManifest, server: undefined, - } as unknown as McpbManifest; + } as unknown as McpbManifestLatest; const result = await getMcpConfigForManifest({ manifest, @@ -129,7 +129,7 @@ describe("getMcpConfigForManifest", () => { }); it("should return undefined when required config is missing", async () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { apiKey: { @@ -171,7 +171,7 @@ describe("getMcpConfigForManifest", () => { }); it("should apply platform overrides", async () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, server: { type: "node", @@ -203,7 +203,7 @@ describe("getMcpConfigForManifest", () => { }); it("should handle user config variable replacement with defaults", async () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { port: { @@ -236,7 +236,7 @@ describe("getMcpConfigForManifest", () => { }); it("should handle user config variable replacement with user values", async () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { paths: { @@ -270,7 +270,7 @@ describe("getMcpConfigForManifest", () => { }); it("should convert boolean user config values to strings", async () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { verbose: { @@ -304,7 +304,7 @@ describe("getMcpConfigForManifest", () => { }); describe("hasRequiredConfigMissing", () => { - const baseManifest: McpbManifest = { + const baseManifest: McpbManifestLatest = { manifest_version: "0.3", name: "test-extension", version: "1.0.0", @@ -329,7 +329,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return false when no config fields are required", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { port: { @@ -349,7 +349,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return false when required config is provided", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { apiKey: { @@ -369,7 +369,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return true when required config is undefined", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { apiKey: { @@ -389,7 +389,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return true when required config is empty string", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { apiKey: { @@ -409,7 +409,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return true when required config is array with invalid values", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { paths: { @@ -430,7 +430,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return true when required config is empty array", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { paths: { @@ -459,7 +459,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should handle multiple required config fields", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestLatest = { ...baseManifest, user_config: { apiKey: {