Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
98fc900
WIP
joan-anthropic Nov 1, 2025
f3ac79a
update browser exports to incl. vAny schema
joan-anthropic Nov 1, 2025
8616663
revert: undo preprocessing changes to any.ts and types.ts
joan-anthropic Nov 1, 2025
5fb25a2
add McpbManifestAny type
joan-anthropic Nov 1, 2025
2d76201
Export versioned schemas and validation utilities in browser bundle
joan-anthropic Nov 1, 2025
c137df5
Remove validate utilities from browser exports
joan-anthropic Nov 2, 2025
05187d7
Remove zod resolution and bump version to 1.2.0
joan-anthropic Nov 2, 2025
2d6dd39
Merge remote-tracking branch 'origin/main' into feat/browser-export-v…
joan-anthropic Nov 2, 2025
3538bd4
Bump version to 1.3.0
joan-anthropic Nov 2, 2025
753f27e
Revert yarn.lock to match main (zod 3.25.67)
joan-anthropic Nov 2, 2025
7f40d5b
rm McpbUserConfigValuesSchema export
joan-anthropic Nov 2, 2025
e7d6ea3
Fix type error in buildManifest return type
joan-anthropic Nov 2, 2025
d7f76fc
Fix linting issues
joan-anthropic Nov 2, 2025
30a3b8e
Remove vLatest concept and associated files
joan-anthropic Nov 3, 2025
efe9e33
Make McpbManifest point to v0.2 for backwards compatibility
joan-anthropic Nov 3, 2025
70c3615
Add LATEST_MANIFEST_VERSION export (hardcoded to 0.3)
joan-anthropic Nov 3, 2025
3fffc30
Use McpbManifestDefault derived from DEFAULT_MANIFEST_VERSION
joan-anthropic Nov 3, 2025
8018a9a
Remove latest schema reference from build script
joan-anthropic Nov 3, 2025
21c9710
Fix lint errors in types.ts and remove any casts
joan-anthropic Nov 3, 2025
3a9ee6e
Export schemas/index instead of specific version
joan-anthropic Nov 3, 2025
07b7743
Fix lint errors: sort imports and rename unused parameter
joan-anthropic Nov 4, 2025
e59797f
chore: major version bump
joan-anthropic Nov 4, 2025
08cb52b
remove localization param
joan-anthropic Nov 4, 2025
e4f1236
Fix TypeScript error: remove localization argument from buildManifest…
joan-anthropic Nov 4, 2025
5f87ea5
Comment out localization parameter in tests
joan-anthropic Nov 4, 2025
5f6b15b
remove da bad tings
MarshallOfSound Nov 4, 2025
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 package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@anthropic-ai/mcpb",
"description": "Tools for building MCP Bundles",
"version": "1.2.0",
"version": "1.3.0",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// 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";
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export * from "./cli/init.js";
export * from "./cli/pack.js";

// Include all shared exports
export * from "./schemas/latest.js";
export * from "./schemas/0.3.js";
export * from "./shared/config.js";
export * from "./shared/constants.js";
export * from "./types.js";
Expand Down
6 changes: 3 additions & 3 deletions src/cli/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { existsSync, readFileSync, writeFileSync } from "fs";
import { basename, join, resolve } from "path";

import { DEFAULT_MANIFEST_VERSION } from "../shared/constants.js";
import type { McpbManifest } from "../types.js";
import type { McpbManifestDefault } from "../types.js";

interface PackageJson {
name?: string;
Expand Down Expand Up @@ -878,7 +878,7 @@ export function buildManifest(
resources: string;
default_locale: string;
},
): McpbManifest {
): McpbManifestDefault {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make return type more resilient to changes to default

const { name, displayName, version, description, authorName } = basicInfo;
const { authorEmail, authorUrl } = authorInfo;
const { serverType, entryPoint, mcp_config } = serverConfig;
Expand Down Expand Up @@ -906,7 +906,7 @@ export function buildManifest(
...(visualAssets.screenshots.length > 0
? { screenshots: visualAssets.screenshots }
: {}),
...(localization ? { localization } : {}),
// ...(localization ? { localization } : {}),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove localization from init for now, this is a v0.3 field

server: {
type: serverType,
entry_point: entryPoint,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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/0.3.js";
export * from "./shared/config.js";
export * from "./shared/constants.js";
export * from "./types.js";
2 changes: 1 addition & 1 deletion src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export * from "./node/sign.js";
export * from "./node/validate.js";

// Include all shared exports
export * from "./schemas/latest.js";
export * from "./schemas/0.3.js";
export * from "./shared/config.js";
export * from "./shared/constants.js";
export * from "./types.js";
20 changes: 14 additions & 6 deletions src/schemas/index.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 0 additions & 1 deletion src/schemas/latest.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/schemas_loose/index.ts
Original file line number Diff line number Diff line change
@@ -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";
1 change: 0 additions & 1 deletion src/schemas_loose/latest.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/shared/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {
Logger,
McpbManifest,
McpbManifestAny,
McpbUserConfigValues,
McpServerConfig,
} from "../types.js";
Expand Down Expand Up @@ -85,7 +85,7 @@ export function replaceVariables(
}

interface GetMcpConfigForManifestOptions {
manifest: McpbManifest;
manifest: McpbManifestAny;
extensionPath: string;
systemDirs: Record<string, string>;
userConfig: McpbUserConfigValues;
Expand Down Expand Up @@ -179,7 +179,7 @@ export async function getMcpConfigForManifest(
}

interface HasRequiredConfigMissingOptions {
manifest: McpbManifest;
manifest: McpbManifestAny;
userConfig?: McpbUserConfigValues;
}

Expand Down
17 changes: 1 addition & 16 deletions src/shared/constants.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
24 changes: 16 additions & 8 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import type * as z from "zod";

import type { McpbManifestSchema as McpbManifestSchemaAny } from "./schemas/any.js";
import { VERSIONED_MANIFEST_SCHEMAS } from "./schemas/index.js";
// Import schema types from the version matching DEFAULT_MANIFEST_VERSION
import type {
McpbManifestAuthorSchema,
McpbManifestCompatibilitySchema,
McpbManifestMcpConfigSchema,
McpbManifestPlatformOverrideSchema,
McpbManifestPromptSchema,
McpbManifestRepositorySchema,
McpbManifestSchema,
McpbManifestServerSchema,
McpbManifestToolSchema,
McpbSignatureInfoSchema,
McpbUserConfigurationOptionSchema,
McpbUserConfigValuesSchema,
McpServerConfigSchema,
} from "./schemas/latest.js";
} from "./schemas/0.2.js";
import { DEFAULT_MANIFEST_VERSION } from "./shared/constants.js";

export type McpServerConfig = z.infer<typeof McpServerConfigSchema>;

Expand Down Expand Up @@ -48,16 +50,22 @@ export type McpbUserConfigurationOption = z.infer<
export type McpbUserConfigValues = z.infer<typeof McpbUserConfigValuesSchema>;

/**
* McpbManifest type that accepts any supported manifest version
* This is the default manifest type that should be used for maximum compatibility.
* McpbManifest type representing the union of all manifest versions
*/
export type McpbManifest = z.infer<typeof McpbManifestSchemaAny>;
export type McpbManifestAny = z.infer<typeof McpbManifestSchemaAny>;

/**
* McpbManifest type for the latest manifest version only
* Use this when you specifically need the latest version.
* McpbManifest type for the DEFAULT_MANIFEST_VERSION
* Use this for creating new manifests with the default version.
*/
export type McpbManifestLatest = z.infer<typeof McpbManifestSchema>;
export type McpbManifestDefault = z.infer<
(typeof VERSIONED_MANIFEST_SCHEMAS)[typeof DEFAULT_MANIFEST_VERSION]
>;

/**
* @deprecated Use McpbManifestAny instead to support all manifest versions, or McpbManifestDefault for the default version.
*/
export type McpbManifest = McpbManifestDefault;

/**
* Information about a MCPB package signature
Expand Down
4 changes: 2 additions & 2 deletions test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("getMcpConfigForManifest", () => {
};

const baseManifest: McpbManifest = {
manifest_version: "0.3",
manifest_version: "0.2",
name: "test-extension",
version: "1.0.0",
description: "Test extension",
Expand Down Expand Up @@ -305,7 +305,7 @@ describe("getMcpConfigForManifest", () => {

describe("hasRequiredConfigMissing", () => {
const baseManifest: McpbManifest = {
manifest_version: "0.3",
manifest_version: "0.2",
name: "test-extension",
version: "1.0.0",
description: "Test extension",
Expand Down
4 changes: 0 additions & 4 deletions test/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 12 additions & 12 deletions test/schemas.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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", () => {
const manifestPath = join(__dirname, "valid-manifest.json");
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) {
Expand All @@ -23,11 +23,11 @@ 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) {
const errors = result.error.issues.map((issue) => issue.path.join("."));
const errors = result.error.issues.map((issue: any) => issue.path.join("."));
expect(errors).toContain("author.name");
expect(errors).toContain("author.email");
expect(errors).toContain("server.type");
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -167,7 +167,7 @@ describe("McpbManifestSchema", () => {
},
};

const result = McpbManifestSchema.safeParse(manifest);
const result = v0_3.McpbManifestSchema.safeParse(manifest);
expect(result.success).toBe(true);
});
});
Expand Down Expand Up @@ -270,10 +270,10 @@ 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);
const messages = result.error.issues.map((issue: any) => issue.message);
expect(messages.join(" ")).toContain("${locale}");
}
});
Expand All @@ -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);
});

Expand All @@ -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);
});
});
Expand All @@ -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);
});

Expand All @@ -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);
});
});
Expand Down
Loading