-
Notifications
You must be signed in to change notification settings - Fork 159
feat: export versioned zod schemas in mcpb/browser, remove vLatest artifacts #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reverts the preprocessing logic and type name changes to restore the simpler union schema approach. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update browser.ts to export validation utilities - Export McpbManifestSchema for backwards compatibility - Update config.ts to accept McpbManifestAny for broader manifest version support - Add validate.ts with version-aware validation functions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This removes the validateManifest utilities that were added to the browser bundle. These functions are not needed for the browser export. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
90974d0 to
c137df5
Compare
- Removed zod version resolution from package.json - Bumped version from 1.1.5 to 1.2.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changed return type to use the specific v0.2 manifest schema type since the function returns a manifest with DEFAULT_MANIFEST_VERSION (0.2). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2ad6761 to
e7d6ea3
Compare
- Remove unused McpbManifest import from config.ts - Auto-fix formatting and import sorting 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
src/cli/init.ts
Outdated
| @@ -878,7 +879,7 @@ export function buildManifest( | |||
| resources: string; | |||
| default_locale: string; | |||
| }, | |||
| ): McpbManifest { | |||
| ): z.infer<typeof McpbManifestSchemaV0_2> { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be 0.2 specifically instead of the "any" schema type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just because we haven't yet merged #146, the CLI commands should technically only be producing 0.2 artifacts.
I could be doing this more robustly, but since this is a transitional state before we allow manifest version flexibility into our CLI tools - mostly just want to unblock versioned schema validation in claude desktop as quickly as possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I guess my thing was the ManifestAny type worked here, was there a reason for this change I'm missing other than just semantic correctness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
McpbManifest is was actually an alias to "latest" for backwards compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, updated init to non-include v0.3 fields (ie localization) for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't init just start a 0.3 manifest? the new fields are optional anyway so they can be left out from init (but user can add them later if they want)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asklar The issue here is this package should never produce a MCPB that can't be run on major clients. As such the release pattern should look like
- Release version with new schema
- Let clients adopt schema
- At some point in the future change default schema to the newer schema version
Otherwise people will try to use this package and promptly get stuck because their generated MCPB is Wrong ™️
We have a fast-follow for allowing init to take a --schema-version flag or something so that you can opt into 0.3 for init ahead of time if you want to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're trying to decouple + stagger updates to manifest schemas (consumed by MCPB clients) from updates to mcpb build tooling (consumed by developers) so that we give clients a window to support vLatest before we get vLatest mcpb submissions - we're getting feedback from developers who are frustrated that they're unable to upload v0.3 mcpbs to claude desktop.
@MarshallOfSound 's PR here: #145 effectively downgrades our CLI tooling to generate 0.2-versioned manifests, but the contents still reflect v0.3 - it's important that they be in-sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JYFI there's a PR open here to allow developers to specify the manifest version they build with that will follow this work - just want to make sure the declared manifest version actually matches the manifest content for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry - just caught @MarshallOfSound 's comment, ditto everything he's saying
Remove the concept of "vLatest" throughout the codebase to encourage use of McpbManifestAny which supports all manifest versions. Changes include: - Delete src/schemas/latest.ts and src/schemas_loose/latest.ts - Remove vLatest and latest-related exports from schema index files - Remove McpbManifestLatest type, replace McpbManifest to point to McpbManifestAny - Remove LATEST_MANIFEST_VERSION, LATEST_MANIFEST_SCHEMA constants - Update all main export files (index.ts, cli.ts, node.ts) to export from 0.3.js instead of latest.js - Update tests to use v0_3.McpbManifestSchema explicitly - Add @deprecated annotation to McpbManifest directing users to McpbManifestAny This encourages better version compatibility by using the union type that supports all manifest versions rather than assuming a single "latest" version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Change McpbManifest type to point to v0.2 schema instead of McpbManifestAny - Add DEFAULT_MANIFEST_VERSION export to browser.ts - Update test fixtures to use manifest_version "0.2" when using McpbManifest type - Keep @deprecated annotation directing users to McpbManifestAny for multi-version support This maintains backwards compatibility for existing code using McpbManifest while encouraging new code to use McpbManifestAny for broader version support. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Export LATEST_MANIFEST_VERSION to indicate the maximum supported manifest version by the vAny schema. This allows clients to know what the highest version is that they can use. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changes: - Create McpbManifestDefault type derived from VERSIONED_MANIFEST_SCHEMAS[DEFAULT_MANIFEST_VERSION] - Update init.ts to use McpbManifestDefault instead of hardcoded v0.2 schema - Import schema types from version matching DEFAULT_MANIFEST_VERSION (0.2) - Update test to match commented-out localization field - Make McpbManifest (deprecated) point to McpbManifestDefault This makes the codebase more maintainable by deriving types from DEFAULT_MANIFEST_VERSION instead of hardcoding version references. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| ? { screenshots: visualAssets.screenshots } | ||
| : {}), | ||
| ...(localization ? { localization } : {}), | ||
| // ...(localization ? { localization } : {}), |
There was a problem hiding this comment.
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
src/cli/init.ts
Outdated
| default_locale: string; | ||
| }, | ||
| ): McpbManifest { | ||
| ): McpbManifestDefault { |
There was a problem hiding this comment.
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
The build script was still importing from the deleted schemas/latest.js file. Updated to import McpbSignatureInfoSchema from 0.3.js and removed the mcpb-manifest-latest entry from versionedManifestSchemas.
- Use import type for VERSIONED_MANIFEST_SCHEMAS and DEFAULT_MANIFEST_VERSION - Remove unnecessary any type annotations from test file
Changed all entry points (index.ts, cli.ts, node.ts) to export from schemas/index.js instead of schemas/0.3.js. This provides access to all versioned schemas (v0_1, v0_2, v0_3, vAny) and VERSIONED_MANIFEST_SCHEMAS without exposing a specific version.
- Reorganize imports in types.ts to satisfy simple-import-sort - Rename unused localization parameter to _localization in init.ts
… call The buildManifest function signature has the localization parameter commented out (expecting 13 params), but the function call was still passing it as the 14th argument, causing a type error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The localization parameter is commented out in the buildManifest function signature, so it should also be commented out in the test calls. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
Exports versioned manifest schemas and the
VERSIONED_MANIFEST_SCHEMASmap in the browser bundle to enable runtime manifest validation across all supported versions (0.1, 0.2, 0.3).Changes
VERSIONED_MANIFEST_SCHEMASmap fromsrc/schemas/index.tssrc/browser.tsfor browser bundleMcpbManifestAnytype to represent union of all manifest versionsMcpbManifestto aliasMcpbManifestLatestfor claritygetMcpConfigForManifestto acceptMcpbManifestAnytypebuildManifestreturn type to use v0.2 schema (matchesDEFAULT_MANIFEST_VERSION)Use Case
This enables browser-based tools to validate manifests of any version