-
Notifications
You must be signed in to change notification settings - Fork 151
feat: add comprehensive icon validation to mcpb validate command #136
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
Merged
joan-anthropic
merged 2 commits into
modelcontextprotocol:main
from
bryan-anthropic:feat/icon-validation
Oct 30, 2025
Merged
feat: add comprehensive icon validation to mcpb validate command #136
joan-anthropic
merged 2 commits into
modelcontextprotocol:main
from
bryan-anthropic:feat/icon-validation
Oct 30, 2025
+532
−2
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implements icon validation to catch common issues that prevent icons from
displaying in Claude Desktop. Uses a non-blocking warning approach for
remote URLs to maintain flexibility for MCPB's evolving multi-platform
ecosystem.
## Changes
### Core Implementation (src/node/validate.ts)
- Add `isPNG()` helper to validate PNG file signatures via magic bytes
- Add `validateIcon()` function with comprehensive checks:
- **Warn** about remote URLs (non-blocking, best practice guidance)
- **Reject** ${__dirname} variable usage in icon field (doesn't work)
- **Reject** absolute paths (not portable)
- Verify icon file exists at specified path
- Verify icon file is valid PNG format
- Recommend 512×512 size for Claude Desktop
- Integrate icon validation into `validateManifest()` after schema validation
### Test Coverage
- Update `test/icon-validation.test.ts` - Remote URL test now expects warning
- Update `test/cli.test.ts` - Integration test updated for warnings
- All 109 tests passing
### Documentation Updates
- Update examples/hello-world-node/manifest.json to v0.3
## Validation Behavior
**Remote URLs (WARNING - non-blocking):**
```
Icon path uses a remote URL. Best practice for local MCP servers:
Use local files like "icon": "icon.png" for maximum compatibility.
Claude Desktop currently only supports local icon files in bundles.
```
**Result:** Validation passes, developer is informed
**Other Issues (ERROR - blocking):**
- ${__dirname} usage: Rejects (doesn't work)
- Absolute paths: Rejects (not portable)
- Missing files: Rejects (broken reference)
- Non-PNG files: Rejects (wrong format)
## Rationale
**Non-Blocking Approach:**
- Doesn't prevent valid bundles from being created
- Educates developers about best practices
- Maintains flexibility as MCPB evolves beyond Claude Desktop
- Future-proof if remote URL support is added
**Still Protective:**
- Blocks truly broken configurations (missing files, wrong formats)
- Provides actionable error messages for fixable issues
Based on real-world findings from investigating icon display issues in
Claude Desktop with production MCPB bundles.
Contributor
|
@bthompson-sys thanks so much! this looks good - could you fix the lint errors when you get a sec? https://github.com/anthropics/mcpb/actions/runs/18881116986/job/54027390353?pr=136 |
- Remove duplicate node:path import in test/icon-validation.test.ts - Replace 4 instances of 'any' type with 'unknown' in error handlers - Auto-format code with prettier (27 formatting fixes) Addresses review feedback from PR modelcontextprotocol#136 All 6 errors and 27 warnings resolved
bryan-anthropic
pushed a commit
to bryan-anthropic/mcpb
that referenced
this pull request
Oct 30, 2025
- Remove duplicate node:path import in test/icon-validation.test.ts - Replace 4 instances of 'any' type with 'unknown' in error handlers - Auto-format code with prettier (27 formatting fixes) Addresses review feedback from PR modelcontextprotocol#136 All 6 errors and 27 warnings resolved
Contributor
Author
|
@joan-anthropic Thanks for the review! I've addressed all the linting errors identified in the CI run. |
joan-anthropic
previously approved these changes
Oct 30, 2025
bryan-anthropic
pushed a commit
to bryan-anthropic/mcpb
that referenced
this pull request
Oct 30, 2025
- Remove duplicate node:path import in test/icon-validation.test.ts - Replace 4 instances of 'any' type with 'unknown' in error handlers - Auto-format code with prettier (27 formatting fixes) Addresses review feedback from PR modelcontextprotocol#136 All 6 errors and 27 warnings resolved
b2dda64 to
d3350e5
Compare
bryan-anthropic
pushed a commit
to bryan-anthropic/mcpb
that referenced
this pull request
Oct 30, 2025
- Remove duplicate node:path import in test/icon-validation.test.ts - Replace 4 instances of 'any' type with 'unknown' in error handlers - Auto-format code with prettier (27 formatting fixes) Addresses review feedback from PR modelcontextprotocol#136 All 6 errors and 27 warnings resolved
d3350e5 to
dfc05e2
Compare
joan-anthropic
approved these changes
Oct 30, 2025
bryan-anthropic
added a commit
to bryan-anthropic/mcpb
that referenced
this pull request
Oct 30, 2025
- Remove duplicate node:path import in test/icon-validation.test.ts - Replace 4 instances of 'any' type with 'unknown' in error handlers - Auto-format code with prettier (27 formatting fixes) Addresses review feedback from PR modelcontextprotocol#136 All 6 errors and 27 warnings resolved
e444da0 to
55e3c3c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Icon Validation for MCPB Validate Command
Summary
Adds comprehensive icon validation to the
mcpb validatecommand to catch common configuration issues and provide helpful guidance for developers creating MCPB bundles.Problem
While investigating why bundle icons weren't displaying in Claude Desktop, we discovered several common configuration issues:
https://URLs for icons (works in spec, but Claude Desktop currently only supports local files)${__dirname}in icon paths (doesn't work as expected)This resulted in bundles being published with non-functional icons, degrading user experience.
Solution
Enhanced the
mcpb validatecommand to perform comprehensive icon validation before bundling, catching issues early and providing helpful guidance.Validation Approach
Non-blocking warnings for best practices:
Blocking errors for truly broken configurations:
${__dirname}) - doesn't workValidation Checks
https://orhttp://icon paths with guidance to use local files${__dirname}in icon field (doesn't work)Example Output
Valid local PNG:
Remote URL (warns but doesn't block):
Invalid configuration (blocks):
Changes
Core Implementation
src/node/validate.tsisPNG()helper for PNG signature validationvalidateIcon()function with error/warning separationvalidateManifest()workflowTest Coverage
test/icon-validation.test.ts(9 test cases)test/cli.test.ts(integration tests)Documentation
examples/hello-world-node/manifest.jsonto v0.3Testing
Automated Tests
Test Coverage Includes
${__dirname}usage (blocks with error)Benefits
Design Philosophy
This implementation balances two important goals:
Real-World Impact
Based on investigating actual icon display issues in production bundles, this validation helps developers avoid common pitfalls while maintaining flexibility for future MCPB evolution.
Implementation Details
PNG Validation
Uses magic byte checking (industry standard):
Error vs Warning Logic
Note on Spec and Implementation
The MANIFEST.md specification documents that the
iconfield can be "either relative in the package or ahttps://url." However, Claude Desktop currently only supports local files in mcpb bundles - remote URLs don't display.This validation provides warnings (not errors) for remote URLs to:
Checklist
yarn test)Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com