diff --git a/.vscode/settings.json b/.vscode/settings.json index 14ac857..73dc7c2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,6 @@ "eslint.validate": ["typescript"], "[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" - } + }, + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/package.json b/package.json index 92a270e..6a81a79 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@anthropic-ai/mcpb", "description": "Tools for building MCP Bundles", - "version": "1.2.0", + "version": "2.0.0", "type": "module", "main": "dist/index.js", "module": "dist/index.js", @@ -99,4 +99,4 @@ "@babel/parser": "7.27.3" }, "packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f" -} +} \ No newline at end of file diff --git a/scripts/build-mcpb-schema.js b/scripts/build-mcpb-schema.js index a62fcdb..6d884e1 100644 --- a/scripts/build-mcpb-schema.js +++ b/scripts/build-mcpb-schema.js @@ -1,10 +1,7 @@ -import { - McpbManifestSchema as McpbManifestSchemaLatest, - McpbSignatureInfoSchema, -} from "../dist/schemas/latest.js"; import { McpbManifestSchema as McpbManifestSchema_v0_1 } from "../dist/schemas/0.1.js"; import { McpbManifestSchema as McpbManifestSchema_v0_2 } from "../dist/schemas/0.2.js"; import { McpbManifestSchema as McpbManifestSchema_v0_3 } from "../dist/schemas/0.3.js"; +import { McpbSignatureInfoSchema } from "../dist/shared/common.js"; import { zodToJsonSchema } from "zod-to-json-schema"; import fs from "node:fs/promises"; import path from "node:path"; @@ -17,7 +14,6 @@ const versionedManifestSchemas = { "mcpb-manifest-v0.1": McpbManifestSchema_v0_1, "mcpb-manifest-v0.2": McpbManifestSchema_v0_2, "mcpb-manifest-v0.3": McpbManifestSchema_v0_3, - "mcpb-manifest-latest": McpbManifestSchemaLatest, }; // Other schemas diff --git a/src/browser.ts b/src/browser.ts index d3f0598..b8d3fa9 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -1,5 +1,4 @@ // Browser-compatible exports -export * from "./schemas/latest.js"; +export * from "./schemas/index.js"; export * from "./shared/config.js"; export * from "./shared/constants.js"; -export * from "./types.js"; diff --git a/src/cli.ts b/src/cli.ts index 5dc861c..c5266d4 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -3,10 +3,9 @@ export * from "./cli/init.js"; export * from "./cli/pack.js"; // Include all shared exports -export * from "./schemas/latest.js"; +export * from "./schemas/index.js"; export * from "./shared/config.js"; export * from "./shared/constants.js"; -export * from "./types.js"; // Include node exports since CLI needs them export * from "./node/files.js"; diff --git a/src/cli/init.ts b/src/cli/init.ts index 7682e0f..9e62777 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -1,9 +1,12 @@ import { confirm, input, select } from "@inquirer/prompts"; import { existsSync, readFileSync, writeFileSync } from "fs"; import { basename, join, resolve } from "path"; +import type { z } from "zod"; +// Import the schema for DEFAULT_MANIFEST_VERSION +// TODO: Allow dynamic manifest version choice +import type { McpbManifestSchema } from "../schemas/0.2.js"; import { DEFAULT_MANIFEST_VERSION } from "../shared/constants.js"; -import type { McpbManifest } from "../types.js"; interface PackageJson { name?: string; @@ -874,11 +877,11 @@ export function buildManifest( license: string; repository?: { type: string; url: string }; }, - localization?: { - resources: string; - default_locale: string; - }, -): McpbManifest { + // localization?: { + // resources: string; + // default_locale: string; + // }, +): z.infer { const { name, displayName, version, description, authorName } = basicInfo; const { authorEmail, authorUrl } = authorInfo; const { serverType, entryPoint, mcp_config } = serverConfig; @@ -906,7 +909,7 @@ export function buildManifest( ...(visualAssets.screenshots.length > 0 ? { screenshots: visualAssets.screenshots } : {}), - ...(localization ? { localization } : {}), + // ...(localization ? { localization } : {}), server: { type: serverType, entry_point: entryPoint, @@ -991,9 +994,9 @@ export async function initExtension( const visualAssets = nonInteractive ? { icon: "", icons: [], screenshots: [] } : await promptVisualAssets(); - const localization = nonInteractive - ? undefined - : await promptLocalization(); + // const localization = nonInteractive + // ? undefined + // : await promptLocalization(); const serverConfig = nonInteractive ? getDefaultServerConfig(packageData) : await promptServerConfig(packageData); @@ -1026,7 +1029,6 @@ export async function initExtension( compatibility, userConfig, optionalFields, - localization, ); // Write manifest diff --git a/src/index.ts b/src/index.ts index 62ada47..58387f8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,6 @@ export * from "./cli/unpack.js"; export * from "./node/files.js"; export * from "./node/sign.js"; export * from "./node/validate.js"; -export * from "./schemas/latest.js"; +export * from "./schemas/index.js"; export * from "./shared/config.js"; export * from "./shared/constants.js"; -export * from "./types.js"; diff --git a/src/node.ts b/src/node.ts index 12a7edb..f7f48a0 100644 --- a/src/node.ts +++ b/src/node.ts @@ -4,7 +4,6 @@ export * from "./node/sign.js"; export * from "./node/validate.js"; // Include all shared exports -export * from "./schemas/latest.js"; +export * from "./schemas/index.js"; export * from "./shared/config.js"; export * from "./shared/constants.js"; -export * from "./types.js"; diff --git a/src/node/sign.ts b/src/node/sign.ts index bb83389..e0ed5ce 100644 --- a/src/node/sign.ts +++ b/src/node/sign.ts @@ -5,8 +5,9 @@ import forge from "node-forge"; import { tmpdir } from "os"; import { join } from "path"; import { promisify } from "util"; +import type { z } from "zod"; -import type { McpbSignatureInfo } from "../types.js"; +import type { McpbSignatureInfoSchema } from "../shared/common.js"; // Signature block markers const SIGNATURE_HEADER = "MCPB_SIG_V1"; @@ -101,7 +102,7 @@ export function signMcpbFile( */ export async function verifyMcpbFile( mcpbPath: string, -): Promise { +): Promise> { try { const fileContent = readFileSync(mcpbPath); diff --git a/src/schemas/0.1.ts b/src/schemas/0.1.ts index 4d77ccc..e41d69c 100644 --- a/src/schemas/0.1.ts +++ b/src/schemas/0.1.ts @@ -71,11 +71,6 @@ export const McpbUserConfigurationOptionSchema = z.strictObject({ max: z.number().optional(), }); -export const McpbUserConfigValuesSchema = z.record( - z.string(), - z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]), -); - export const McpbManifestSchema = z .strictObject({ $schema: z.string().optional(), @@ -113,12 +108,3 @@ export const McpbManifestSchema = z message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided", }); - -export const McpbSignatureInfoSchema = z.strictObject({ - status: z.enum(["signed", "unsigned", "self-signed"]), - publisher: z.string().optional(), - issuer: z.string().optional(), - valid_from: z.string().optional(), - valid_to: z.string().optional(), - fingerprint: z.string().optional(), -}); diff --git a/src/schemas/0.2.ts b/src/schemas/0.2.ts index f5d4d03..bb1de16 100644 --- a/src/schemas/0.2.ts +++ b/src/schemas/0.2.ts @@ -71,11 +71,6 @@ export const McpbUserConfigurationOptionSchema = z.strictObject({ max: z.number().optional(), }); -export const McpbUserConfigValuesSchema = z.record( - z.string(), - z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]), -); - export const McpbManifestSchema = z .strictObject({ $schema: z.string().optional(), @@ -113,12 +108,3 @@ export const McpbManifestSchema = z message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided", }); - -export const McpbSignatureInfoSchema = z.strictObject({ - status: z.enum(["signed", "unsigned", "self-signed"]), - publisher: z.string().optional(), - issuer: z.string().optional(), - valid_from: z.string().optional(), - valid_to: z.string().optional(), - fingerprint: z.string().optional(), -}); diff --git a/src/schemas/0.3.ts b/src/schemas/0.3.ts index 2bdc946..2ca0206 100644 --- a/src/schemas/0.3.ts +++ b/src/schemas/0.3.ts @@ -76,11 +76,6 @@ export const McpbUserConfigurationOptionSchema = z.strictObject({ max: z.number().optional(), }); -export const McpbUserConfigValuesSchema = z.record( - z.string(), - z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]), -); - export const McpbManifestLocalizationSchema = z.strictObject({ resources: z .string() @@ -147,12 +142,3 @@ export const McpbManifestSchema = z message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided", }); - -export const McpbSignatureInfoSchema = z.strictObject({ - status: z.enum(["signed", "unsigned", "self-signed"]), - publisher: z.string().optional(), - issuer: z.string().optional(), - valid_from: z.string().optional(), - valid_to: z.string().optional(), - fingerprint: z.string().optional(), -}); diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 3729f0e..897b95b 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -1,9 +1,17 @@ +import { McpbManifestSchema as ManifestSchemaV0_1 } from "./0.1.js"; +import { McpbManifestSchema as ManifestSchemaV0_2 } from "./0.2.js"; +import { McpbManifestSchema as ManifestSchemaV0_3 } from "./0.3.js"; + 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 any from "./any.js"; -export * as latest from "./latest.js"; -export { - MANIFEST_VERSION as LATEST_MANIFEST_VERSION, - McpbManifestSchema, -} from "./latest.js"; +export * as vAny from "./any.js"; + +/** + * Map of manifest versions to their strict schemas + */ +export const VERSIONED_MANIFEST_SCHEMAS = { + "0.1": ManifestSchemaV0_1, + "0.2": ManifestSchemaV0_2, + "0.3": ManifestSchemaV0_3, +} as const; diff --git a/src/schemas/latest.ts b/src/schemas/latest.ts deleted file mode 100644 index e79a613..0000000 --- a/src/schemas/latest.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./0.3.js"; diff --git a/src/schemas_loose/0.1.ts b/src/schemas_loose/0.1.ts index 2ab5e56..406d6c1 100644 --- a/src/schemas_loose/0.1.ts +++ b/src/schemas_loose/0.1.ts @@ -73,11 +73,6 @@ export const McpbUserConfigurationOptionSchema = z.object({ max: z.number().optional(), }); -export const McpbUserConfigValuesSchema = z.record( - z.string(), - z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]), -); - export const McpbManifestSchema = z .object({ $schema: z.string().optional(), @@ -115,12 +110,3 @@ export const McpbManifestSchema = z message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided", }); - -export const McpbSignatureInfoSchema = z.object({ - status: z.enum(["signed", "unsigned", "self-signed"]), - publisher: z.string().optional(), - issuer: z.string().optional(), - valid_from: z.string().optional(), - valid_to: z.string().optional(), - fingerprint: z.string().optional(), -}); diff --git a/src/schemas_loose/0.2.ts b/src/schemas_loose/0.2.ts index 7cdbc1a..bc177d2 100644 --- a/src/schemas_loose/0.2.ts +++ b/src/schemas_loose/0.2.ts @@ -73,11 +73,6 @@ export const McpbUserConfigurationOptionSchema = z.object({ max: z.number().optional(), }); -export const McpbUserConfigValuesSchema = z.record( - z.string(), - z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]), -); - export const McpbManifestSchema = z .object({ $schema: z.string().optional(), @@ -116,12 +111,3 @@ export const McpbManifestSchema = z message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided", }); - -export const McpbSignatureInfoSchema = z.object({ - status: z.enum(["signed", "unsigned", "self-signed"]), - publisher: z.string().optional(), - issuer: z.string().optional(), - valid_from: z.string().optional(), - valid_to: z.string().optional(), - fingerprint: z.string().optional(), -}); diff --git a/src/schemas_loose/0.3.ts b/src/schemas_loose/0.3.ts index 87ac125..a96894b 100644 --- a/src/schemas_loose/0.3.ts +++ b/src/schemas_loose/0.3.ts @@ -77,11 +77,6 @@ export const McpbUserConfigurationOptionSchema = z.object({ max: z.number().optional(), }); -export const McpbUserConfigValuesSchema = z.record( - z.string(), - z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]), -); - export const McpbManifestLocalizationSchema = z .object({ resources: z @@ -153,12 +148,3 @@ export const McpbManifestSchema = z message: "Either 'dxt_version' (deprecated) or 'manifest_version' must be provided", }); - -export const McpbSignatureInfoSchema = z.object({ - status: z.enum(["signed", "unsigned", "self-signed"]), - publisher: z.string().optional(), - issuer: z.string().optional(), - valid_from: z.string().optional(), - valid_to: z.string().optional(), - fingerprint: z.string().optional(), -}); diff --git a/src/schemas_loose/index.ts b/src/schemas_loose/index.ts index 3548b1d..f84f84c 100644 --- a/src/schemas_loose/index.ts +++ b/src/schemas_loose/index.ts @@ -1,4 +1,3 @@ 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"; diff --git a/src/schemas_loose/latest.ts b/src/schemas_loose/latest.ts deleted file mode 100644 index e79a613..0000000 --- a/src/schemas_loose/latest.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./0.3.js"; diff --git a/src/shared/common.ts b/src/shared/common.ts new file mode 100644 index 0000000..9449ee7 --- /dev/null +++ b/src/shared/common.ts @@ -0,0 +1,15 @@ +import { z } from "zod"; + +export const McpbUserConfigValuesSchema = z.record( + z.string(), + z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]), +); + +export const McpbSignatureInfoSchema = z.strictObject({ + status: z.enum(["signed", "unsigned", "self-signed"]), + publisher: z.string().optional(), + issuer: z.string().optional(), + valid_from: z.string().optional(), + valid_to: z.string().optional(), + fingerprint: z.string().optional(), +}); diff --git a/src/shared/config.ts b/src/shared/config.ts index 20e4262..b4638bc 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -1,9 +1,7 @@ -import type { - Logger, - McpbManifest, - McpbUserConfigValues, - McpServerConfig, -} from "../types.js"; +import type { z } from "zod"; + +import type { Logger, McpbManifestAny } from "../types.js"; +import type { McpbUserConfigValuesSchema } from "./common.js"; /** * This file contains utility functions for handling MCPB configuration, @@ -85,17 +83,17 @@ export function replaceVariables( } interface GetMcpConfigForManifestOptions { - manifest: McpbManifest; + manifest: McpbManifestAny; extensionPath: string; systemDirs: Record; - userConfig: McpbUserConfigValues; + userConfig: z.infer; pathSeparator: string; logger?: Logger; } export async function getMcpConfigForManifest( options: GetMcpConfigForManifestOptions, -): Promise { +): Promise { const { manifest, extensionPath, @@ -109,7 +107,7 @@ export async function getMcpConfigForManifest( return undefined; } - let result: McpServerConfig = { + let result: McpbManifestAny["server"]["mcp_config"] = { ...baseConfig, }; @@ -173,14 +171,17 @@ export async function getMcpConfigForManifest( } // Replace all variables in the config - result = replaceVariables(result, variables) as McpServerConfig; + result = replaceVariables( + result, + variables, + ) as McpbManifestAny["server"]["mcp_config"]; return result; } interface HasRequiredConfigMissingOptions { - manifest: McpbManifest; - userConfig?: McpbUserConfigValues; + manifest: McpbManifestAny; + userConfig?: z.infer; } function isInvalidSingleValue(value: unknown): boolean { diff --git a/src/shared/constants.ts b/src/shared/constants.ts index 6d16f5d..53b08ed 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -1,15 +1,12 @@ import { McpbManifestSchema as ManifestSchemaV0_1 } from "../schemas/0.1.js"; import { McpbManifestSchema as ManifestSchemaV0_2 } from "../schemas/0.2.js"; import { McpbManifestSchema as ManifestSchemaV0_3 } from "../schemas/0.3.js"; -import { McpbManifestSchema as CurrentManifestSchema } from "../schemas/latest.js"; import { McpbManifestSchema as LooseManifestSchemaV0_1 } from "../schemas_loose/0.1.js"; import { McpbManifestSchema as LooseManifestSchemaV0_2 } from "../schemas_loose/0.2.js"; import { McpbManifestSchema as LooseManifestSchemaV0_3 } from "../schemas_loose/0.3.js"; -import { McpbManifestSchema as CurrentLooseManifestSchema } from "../schemas_loose/latest.js"; /** - * Latest manifest version - the version that new manifests should use - * @deprecated + * Latest manifest version - indicates the maximum supported version by vAny schema */ export const LATEST_MANIFEST_VERSION = "0.3" as const; @@ -35,15 +32,3 @@ export const MANIFEST_SCHEMAS_LOOSE = { "0.2": LooseManifestSchemaV0_2, "0.3": LooseManifestSchemaV0_3, } as const; - -/** - * Get the latest manifest schema based on LATEST_MANIFEST_VERSION - * @deprecated - */ -export const LATEST_MANIFEST_SCHEMA = CurrentManifestSchema; - -/** - * Get the latest loose manifest schema based on LATEST_MANIFEST_VERSION - * @deprecated - */ -export const LATEST_MANIFEST_SCHEMA_LOOSE = CurrentLooseManifestSchema; diff --git a/src/types.ts b/src/types.ts index 9fb510f..655bffa 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,68 +1,11 @@ import type * as z from "zod"; import type { McpbManifestSchema as McpbManifestSchemaAny } from "./schemas/any.js"; -import type { - McpbManifestAuthorSchema, - McpbManifestCompatibilitySchema, - McpbManifestMcpConfigSchema, - McpbManifestPlatformOverrideSchema, - McpbManifestPromptSchema, - McpbManifestRepositorySchema, - McpbManifestSchema, - McpbManifestServerSchema, - McpbManifestToolSchema, - McpbSignatureInfoSchema, - McpbUserConfigurationOptionSchema, - McpbUserConfigValuesSchema, - McpServerConfigSchema, -} from "./schemas/latest.js"; - -export type McpServerConfig = z.infer; - -export type McpbManifestAuthor = z.infer; - -export type McpbManifestRepository = z.infer< - typeof McpbManifestRepositorySchema ->; - -export type McpbManifestPlatformOverride = z.infer< - typeof McpbManifestPlatformOverrideSchema ->; - -export type McpbManifestMcpConfig = z.infer; - -export type McpbManifestServer = z.infer; - -export type McpbManifestCompatibility = z.infer< - typeof McpbManifestCompatibilitySchema ->; - -export type McpbManifestTool = z.infer; - -export type McpbManifestPrompt = z.infer; - -export type McpbUserConfigurationOption = z.infer< - typeof McpbUserConfigurationOptionSchema ->; - -export type McpbUserConfigValues = z.infer; - -/** - * McpbManifest type that accepts any supported manifest version - * This is the default manifest type that should be used for maximum compatibility. - */ -export type McpbManifest = z.infer; - -/** - * McpbManifest type for the latest manifest version only - * Use this when you specifically need the latest version. - */ -export type McpbManifestLatest = z.infer; /** - * Information about a MCPB package signature + * McpbManifest type representing the union of all manifest versions */ -export type McpbSignatureInfo = z.infer; +export type McpbManifestAny = z.infer; export interface Logger { log: (...args: unknown[]) => void; diff --git a/test/config.test.ts b/test/config.test.ts index f7a0eb8..1c34faf 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, McpbManifestAny } from "../src/types"; describe("replaceVariables", () => { it("should replace variables in strings", () => { @@ -89,8 +89,8 @@ describe("getMcpConfigForManifest", () => { data: "/data", }; - const baseManifest: McpbManifest = { - manifest_version: "0.3", + const baseManifest: McpbManifestAny = { + manifest_version: "0.2", name: "test-extension", version: "1.0.0", description: "Test extension", @@ -114,7 +114,7 @@ describe("getMcpConfigForManifest", () => { const manifest = { ...baseManifest, server: undefined, - } as unknown as McpbManifest; + } as unknown as McpbManifestAny; 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: McpbManifestAny = { ...baseManifest, user_config: { apiKey: { @@ -171,7 +171,7 @@ describe("getMcpConfigForManifest", () => { }); it("should apply platform overrides", async () => { - const manifest: McpbManifest = { + const manifest: McpbManifestAny = { ...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: McpbManifestAny = { ...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: McpbManifestAny = { ...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: McpbManifestAny = { ...baseManifest, user_config: { verbose: { @@ -304,8 +304,8 @@ describe("getMcpConfigForManifest", () => { }); describe("hasRequiredConfigMissing", () => { - const baseManifest: McpbManifest = { - manifest_version: "0.3", + const baseManifest: McpbManifestAny = { + manifest_version: "0.2", name: "test-extension", version: "1.0.0", description: "Test extension", @@ -329,7 +329,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return false when no config fields are required", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestAny = { ...baseManifest, user_config: { port: { @@ -349,7 +349,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return false when required config is provided", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestAny = { ...baseManifest, user_config: { apiKey: { @@ -369,7 +369,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should return true when required config is undefined", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestAny = { ...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: McpbManifestAny = { ...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: McpbManifestAny = { ...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: McpbManifestAny = { ...baseManifest, user_config: { paths: { @@ -459,7 +459,7 @@ describe("hasRequiredConfigMissing", () => { }); it("should handle multiple required config fields", () => { - const manifest: McpbManifest = { + const manifest: McpbManifestAny = { ...baseManifest, user_config: { apiKey: { diff --git a/test/init.test.ts b/test/init.test.ts index a9b9bf4..7acd57a 100644 --- a/test/init.test.ts +++ b/test/init.test.ts @@ -216,7 +216,7 @@ describe("init functions", () => { keywords: "", license: "", }, - undefined, + // undefined, // localization ); expect(manifest).toEqual({ @@ -315,10 +315,10 @@ describe("init functions", () => { license: "MIT", repository: { type: "git", url: "https://github.com/user/repo" }, }, - { - resources: "resources/${locale}.json", - default_locale: "en-US", - }, + // { // localization + // resources: "resources/${locale}.json", + // default_locale: "en-US", + // }, ); expect(manifest).toEqual({ @@ -351,10 +351,6 @@ describe("init functions", () => { }, ], screenshots: ["screen1.png", "screen2.png"], - localization: { - resources: "resources/${locale}.json", - default_locale: "en-US", - }, server: { type: "python", entry_point: "server/main.py", diff --git a/test/schemas.test.ts b/test/schemas.test.ts index 70f181f..52943e0 100644 --- a/test/schemas.test.ts +++ b/test/schemas.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from "fs"; import { join } from "path"; -import { McpbManifestSchema, v0_2, v0_3 } from "../src/schemas/index.js"; +import { v0_2, v0_3 } from "../src/schemas/index.js"; describe("McpbManifestSchema", () => { it("should validate a valid manifest", () => { @@ -9,7 +9,7 @@ describe("McpbManifestSchema", () => { const manifestContent = readFileSync(manifestPath, "utf-8"); const manifestData = JSON.parse(manifestContent); - const result = McpbManifestSchema.safeParse(manifestData); + const result = v0_3.McpbManifestSchema.safeParse(manifestData); expect(result.success).toBe(true); if (result.success) { @@ -23,7 +23,7 @@ describe("McpbManifestSchema", () => { const manifestContent = readFileSync(manifestPath, "utf-8"); const manifestData = JSON.parse(manifestContent); - const result = McpbManifestSchema.safeParse(manifestData); + const result = v0_3.McpbManifestSchema.safeParse(manifestData); expect(result.success).toBe(false); if (!result.success) { @@ -134,7 +134,7 @@ describe("McpbManifestSchema", () => { }, }; - const result = McpbManifestSchema.safeParse(fullManifest); + const result = v0_3.McpbManifestSchema.safeParse(fullManifest); expect(result.success).toBe(true); if (result.success) { @@ -167,7 +167,7 @@ describe("McpbManifestSchema", () => { }, }; - const result = McpbManifestSchema.safeParse(manifest); + const result = v0_3.McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(true); }); }); @@ -270,7 +270,7 @@ describe("McpbManifestSchema", () => { default_locale: "en-US", }, }; - const result = McpbManifestSchema.safeParse(manifest); + const result = v0_3.McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(false); if (!result.success) { const messages = result.error.issues.map((issue) => issue.message); @@ -286,7 +286,7 @@ describe("McpbManifestSchema", () => { default_locale: "en_us", }, }; - const result = McpbManifestSchema.safeParse(manifest); + const result = v0_3.McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(false); }); @@ -298,7 +298,7 @@ describe("McpbManifestSchema", () => { default_locale: "en-US", }, }; - const result = McpbManifestSchema.safeParse(manifest); + const result = v0_3.McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(true); }); }); @@ -322,7 +322,7 @@ describe("McpbManifestSchema", () => { ...base, icons: [{ src: "assets/icon.png", size: "16", theme: "light" }], }; - const result = McpbManifestSchema.safeParse(manifest); + const result = v0_3.McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(false); }); @@ -331,7 +331,7 @@ describe("McpbManifestSchema", () => { ...base, icons: [{ src: "assets/icon.png", size: "128x128" }], }; - const result = McpbManifestSchema.safeParse(manifest); + const result = v0_3.McpbManifestSchema.safeParse(manifest); expect(result.success).toBe(true); }); });