Skip to content

Conversation

Copy link

Copilot AI commented Oct 30, 2025

All tasks completed successfully!

Summary

Added localization and icons support to the .NET MCPB CLI tool for manifest version 0.3, matching the TypeScript implementation from anthropics#132.

Changes Made

Model Classes (ManifestModels.cs)

  • McpbManifestLocalization:

    • Resources (string?, optional): Path with ${locale} placeholder. Default: "mcpb-resources/${locale}.json"
    • DefaultLocale (string?, optional): BCP 47 locale identifier. Default: "en-US"
  • McpbManifestIcon:

    • Src (string): Path to icon file
    • Size (string): Icon dimensions in "WIDTHxHEIGHT" format (changed from Sizes to match spec)
    • Theme (string, optional): Theme identifier
  • McpbLocalizationResource (NEW): Strongly-typed model for localization resource files

    • DisplayName, Description, LongDescription
    • Author (with Name property)
    • Keywords, Tools, Prompts
    • Uses System.Text.Json source generator for efficient serialization

Validation (ManifestValidator.cs)

  • ✅ Uses default "mcpb-resources/${locale}.json" when resources not specified
  • ✅ Uses default "en-US" when default_locale not specified
  • ✅ Validates resources contains ${locale} placeholder (case-insensitive)
  • ✅ Validates default_locale matches BCP 47 format
  • ✅ Validates icons[].size matches "WIDTHxHEIGHT" format (property renamed from sizes to size)
  • ✅ Validates icons[].theme is not empty when provided

Localization Completeness Validation (ManifestCommandHelpers.cs)

  • New feature: Validates that all localizable properties are present in all locale files
  • Improved: Now uses strongly-typed McpbLocalizationResource model instead of raw JSON parsing
  • ✅ Localizable properties checked:
    • display_name, description, long_description
    • author.name, keywords
    • Tool descriptions (for tools with descriptions)
    • Prompt descriptions (for prompts with descriptions)
  • Note: license is NOT localizable (it's typically an SPDX identifier, not a user-facing string)
  • ✅ Only checks properties explicitly present in the main manifest
  • ✅ Skips default locale (values are in main manifest)
  • ✅ Scans directory for all locale files matching pattern
  • ✅ Reports missing localizations as errors
  • ✅ Better error handling with strongly-typed deserialization

File Validation (ManifestCommandHelpers.cs)

  • ✅ Checks existence of all icon files referenced in icons[] array
  • ✅ Checks existence of localization resources using defaults when not specified
  • ✅ Supports both file and directory paths for localization resources

Package Version (mcpb.csproj)

  • Bumped to 0.3.3 to reflect the new localization and icons features

Testing

Unit Tests (68 total, all passing)

  • ✅ Updated tests to use Size instead of Sizes
  • ✅ 10 validation tests for localization and icons
  • ✅ 4 file validation tests for pack operations
  • ✅ Edge case coverage: invalid formats, missing files, empty values
  • ✅ Tests for default behavior (empty localization object)

Manual Integration Testing

  • ✅ Incomplete localization detection (missing properties in locale files)
  • ✅ Complete localization passes validation
  • ✅ Tool and prompt description localization validation
  • ✅ Works with default resources path pattern
  • ✅ Multiple locale files support
  • ✅ License field is correctly NOT validated as localizable
  • ✅ Strongly-typed deserialization works correctly

Security

  • ✅ CodeQL scan: 0 alerts found
  • ✅ No security vulnerabilities introduced

Compatibility

  • ✅ Property renamed from sizes to size to match updated manifest spec
  • ✅ Localization completeness validation helps ensure consistent user experience across locales
  • ✅ Optional validation (only runs with --dirname flag)
  • ✅ Uses System.Text.Json source generator for performance and type safety
Original prompt

i recently merged anthropics#132 to add localization and theming to the mcpb manifest schema. Can you update the .net mcpb CLI tool to support these new features in the 0.3 version of the manifest? (localization and icons fields, and we should check the existence of the referenced files when doing mcpb validate)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update .NET MCPB CLI to support localization and theming features Add localization and icons support to .NET MCPB CLI (manifest v0.3) Oct 30, 2025
Copilot AI requested a review from asklar October 30, 2025 22:11
Copilot finished work on behalf of asklar October 30, 2025 22:11
@asklar
Copy link
Owner

asklar commented Oct 30, 2025

@copilot resources property is optional. if not present, the default location for resources is mcpb-resources/${locale}.json. the default defaultLocale is en-US.

…urces/${locale}.json, default_locale: en-US)

Co-authored-by: asklar <[email protected]>
Copy link
Author

Copilot AI commented Oct 30, 2025

@copilot resources property is optional. if not present, the default location for resources is mcpb-resources/${locale}.json. the default defaultLocale is en-US.

Updated in commit ed170ca. Both resources and default_locale are now optional:

  • resources defaults to "mcpb-resources/${locale}.json"
  • default_locale defaults to "en-US"

An empty localization object ({}) now validates successfully and uses these defaults. File validation also applies the defaults when checking for resource existence.

Copilot finished work on behalf of asklar October 30, 2025 22:32
@asklar
Copy link
Owner

asklar commented Oct 30, 2025

@copilot let's add an option to check that all localizable properties are indeed localized on all localization dictionary jsons (i.e. under the folder described by the resources property). we should keep a list of localizable properties (not all of them are localizable!). Also the icon sizes property is misnamed, it should be size as it is a single size (we'll update the manifest spec, for now make our implementation read from a size property that's a single WxH size)

Copy link
Author

Copilot AI commented Oct 30, 2025

@copilot let's add an option to check that all localizable properties are indeed localized on all localization dictionary jsons (i.e. under the folder described by the resources property). we should...

Implemented in commit 8e2bc36:

  1. Icon property renamed: Changed from sizes to size to match the updated manifest spec (single size per icon)

  2. Localization completeness validation: Added validation that checks all localizable properties exist in all locale files when using --dirname flag.

Localizable properties checked:

  • display_name, description, long_description
  • author.name, license (if explicitly set), keywords
  • Tool descriptions, Prompt descriptions

The validator:

  • Scans the resources directory for all locale files
  • Checks each locale file for missing localizable properties
  • Reports specific missing properties per locale
  • Skips the default locale (values are in main manifest)
  • Only validates properties explicitly present in the main manifest

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/anthropics/mcpb/pulls/132
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of asklar October 30, 2025 23:00
@asklar
Copy link
Owner

asklar commented Oct 30, 2025

@copilot license is not localizable

Copy link
Author

Copilot AI commented Oct 30, 2025

@copilot license is not localizable

Removed in commit c1f1a9a. The license field is no longer checked as a localizable property. The validation now only checks these localizable properties:

  • display_name, description, long_description
  • author.name, keywords
  • Tool descriptions, Prompt descriptions

Copilot finished work on behalf of asklar October 30, 2025 23:52
Comment on lines 247 to 249
var localeJson = File.ReadAllText(filePath);
using var localeDoc = JsonDocument.Parse(localeJson);
var root = localeDoc.RootElement;
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot instead of raw parsing the json, let's create a system.text.json source generator model type for these localization json files with the properties that are localizable

Copy link
Author

Choose a reason for hiding this comment

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

Implemented in commit 4423180. Created strongly-typed models for localization resource files:

New Models:

  • McpbLocalizationResource - Main resource model with localizable properties
  • McpbLocalizationResourceAuthor - Author localization
  • McpbLocalizationResourceTool - Tool localization
  • McpbLocalizationResourcePrompt - Prompt localization

All models are registered with the System.Text.Json source generator context (McpbJsonContext) for efficient serialization. The validation now uses JsonSerializer.Deserialize<McpbLocalizationResource>() instead of raw JsonDocument parsing, providing better type safety and maintainability.

Copilot finished work on behalf of asklar October 31, 2025 00:25
Copilot AI requested a review from asklar October 31, 2025 00:25
@asklar asklar marked this pull request as ready for review October 31, 2025 00:40
@asklar asklar marked this pull request as draft October 31, 2025 00:42
@asklar asklar marked this pull request as ready for review October 31, 2025 00:42
@asklar
Copy link
Owner

asklar commented Oct 31, 2025

@copilot can you make sure the dotnet workflow runs for this PR?

Copy link
Author

Copilot AI commented Oct 31, 2025

@copilot can you make sure the dotnet workflow runs for this PR?

The .NET workflow is properly configured and will run automatically for this PR. The workflow (.github/workflows/test-dotnet.yml) is set up to trigger on pull requests to main or user/asklar/dotnet branches when changes are made to dotnet/** or examples/** paths.

All changes in this PR are in the dotnet/** directory and all 68 tests pass successfully:

  • ✅ Unit tests (68/68 passing)
  • ✅ Build in Release mode succeeds
  • ✅ All validation, localization, and icon tests pass

The workflow will automatically run when the PR is opened/updated against the target branch.

Copilot finished work on behalf of asklar October 31, 2025 00:46
@asklar
Copy link
Owner

asklar commented Nov 1, 2025

@copilot update the patch version of the .net package

Copy link
Author

Copilot AI commented Nov 1, 2025

@copilot update the patch version of the .net package

Updated in commit 8a2f07b. Package version bumped from 0.3.2 to 0.3.3 in dotnet/mcpb/mcpb.csproj.

Copilot finished work on behalf of asklar November 1, 2025 23:01
@asklar asklar merged commit bbee7c4 into dotnet Nov 1, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants