Commit graph mcpb/test
Author SHA1 Message Date
Bryan Thompson
a2c331b513
Merge pull request #208 from modelcontextprotocol/feat/pack-manifest-flag
feat: add --manifest flag to pack command
2026-04-14 07:42:57 -05:00
Bryan Thompson
a3bd97131e
Merge pull request #209 from modelcontextprotocol/feat/enhanced-validate
feat: enhanced structural validation for validate command
2026-04-14 07:42:50 -05:00
Bryan Thompson
122ef0e9e9
fix: enforce executable permissions on binary entry points during pack
When server.type is "binary", mcpb pack now ensures the entry_point
file has execute bits (|0o111) in the ZIP external_attr, regardless
of the source filesystem permissions. This prevents EACCES failures
when Claude Desktop extracts Windows-built binary MCPBs (which store
644 because Windows has no Unix execute bit).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 09:18:30 -05:00
Bryan Thompson
cb052a20e5
fix: merge platform_overrides env with base env instead of replacing
platform_overrides.*.env was replacing the entire mcp_config.env object
instead of merging, causing base env vars (including ${user_config.*}
references) to be silently dropped when platform overrides defined any
env vars.

Fixes #217

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 08:23:18 -05:00
Bryan Thompson
f14863bcdc
feat: enhanced structural validation for mcpb validate (#57)
Add three pre-pack validators to catch common runtime failures early:

- validateEntryPoint: checks file exists, extension matches server type,
  binary has executable bit (Unix)
- validateCommandVariables: scans mcp_config for unrecognized ${...}
  variables against the runtime allowlist
- validateSensitiveFiles: warns about credentials.json, *.pem, *.key,
  .ssh/, etc. that would be bundled

validateManifest() now accepts optional { projectDir } to separate the
manifest directory from the source file directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 06:56:55 -05:00
Bryan Thompson
f4671638a2
feat: add --manifest flag to pack command (#87)
Allow specifying an external manifest file path with `mcpb pack --manifest <path>`.
The manifest resolves relative to CWD, is validated, injected into the bundle,
and errors immediately if the specified file is not found.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 06:54:22 -05:00
Bryan Thompson
bb676eb17d
fix: update ZIP EOCD comment_length when signing MCPB files (#194)
The signMcpbFile function appended a signature block to the ZIP file but
did not update the EOCD comment_length field. Strict ZIP parsers (like
Claude Desktop's) rejected these files because the declared comment
length didn't account for the appended signature data.

Now scans backwards for the EOCD magic bytes, reads the current
comment_length, and adds the signature block length before concatenating.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-12 08:59:13 -05:00
Samuel Attard
5f6b15bc81
remove da bad tings 2025-11-04 10:33:16 -08:00
Joan Xie
5f87ea58d6
Comment out localization parameter in tests
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>
2025-11-03 16:37:27 -08:00
Joan Xie
21c9710584
Fix lint errors in types.ts and remove any casts
- Use import type for VERSIONED_MANIFEST_SCHEMAS and DEFAULT_MANIFEST_VERSION
- Remove unnecessary any type annotations from test file
2025-11-03 15:57:20 -08:00
Joan Xie
3fffc30560
Use McpbManifestDefault derived from DEFAULT_MANIFEST_VERSION
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>
2025-11-03 15:47:05 -08:00
Joan Xie
efe9e3345d
Make McpbManifest point to v0.2 for backwards compatibility
- 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>
2025-11-03 15:33:31 -08:00
Joan Xie
30a3b8e779
Remove vLatest concept and associated files
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>
2025-11-03 15:30:03 -08:00
Samuel Attard
98126b777e
feat: use 0.2 as the default schema (#145) 2025-11-01 12:31:25 -07:00
Alexander Sklar
257af30812
fix: update icon size property from 'sizes' to 'size' in manifest and schema files 2025-10-30 16:43:54 -07:00
Bryan Thompson
55e3c3cfd8
fix: resolve linting errors
- 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 #136
All 6 errors and 27 warnings resolved
2025-10-30 07:53:06 -05:00
Bryan Thompson
ccf9470979
feat: add comprehensive icon validation to mcpb validate command
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.
2025-10-28 09:14:12 -05:00
Joan Xie
e7282946b6
fix: lint errors - remove unused import and format files
- Remove unused McpbManifestSchema import from types.ts
- Run prettier on modified files
2025-10-29 16:51:27 -07:00
Alexander Sklar
55154fa6fb
fix linting 2025-10-27 14:06:11 -07:00
Alexander Sklar
1640adefe8
Add localization/theming feature to 0.3 version 2025-10-24 15:48:46 -07:00
Joan Xie
f7efd3a444
add WIP 0.3 2025-10-20 17:07:44 -07:00
Joan Xie
143aa9a63c
test: skip _meta tests for v0.3 2025-10-20 17:07:44 -07:00
Joan Xie
e2d6836622
Merge branch 'main' into feat/versioned-schemas 2025-10-17 16:05:16 -07:00
Alexander Sklar
443d849420
Refactor manifest schema to replace static_responses and client_extensions with _meta for improved organization 2025-10-10 16:43:33 -07:00
Alexander Sklar
90c18ca9fb
Add static_responses and client_extensions to manifest schema and tests 2025-10-10 16:43:03 -07:00
Joan Xie
6c05338904
refactor: remove schemas.ts re-export, use explicit imports in tests
- Remove src/schemas.ts file
- Update tests to import directly from src/schemas/index.js
2025-09-24 14:28:06 -07:00
Joan Xie
4c100e26da
refactor: rename CURRENT_MANIFEST_VERSION to LATEST_MANIFEST_VERSION
- Rename CURRENT_MANIFEST_VERSION to LATEST_MANIFEST_VERSION
- Rename CURRENT_MANIFEST_SCHEMA to LATEST_MANIFEST_SCHEMA
- Rename CURRENT_MANIFEST_SCHEMA_LOOSE to LATEST_MANIFEST_SCHEMA_LOOSE
- Update all references throughout codebase and tests
2025-09-24 14:26:55 -07:00
Joan Xie
fefd9e1d21
fix: add schemas re-export file and update tests to use correct manifest version
- Create src/schemas.ts to re-export from schemas/index.ts for test imports
- Update test manifests to use manifest_version "0.2" instead of "1.0" or "1.0.0"
- Fix import sorting and formatting issues in schema files
- Export McpbManifestSchema from schemas/index.ts
2025-09-24 14:12:10 -07:00
Joan Xie
e772ed753d
fix: update test to match new validation message
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 15:28:42 -07:00
Joan Xie
f92fe4ab69
feat: validate manifest version during pack command
Add validation to ensure the manifest_version matches the current expected
version (0.2) during the mcpb pack command. This prevents users from
packing extensions with outdated or incorrect manifest versions.

Changes:
- Add CURRENT_MANIFEST_VERSION constant to centralize version management
- Validate manifest version in pack command before creating bundle
- Update init command to use version constant
- Update tests to use version constant
- Fix prettier formatting issues
2025-09-22 14:43:28 -07:00
Joan Xie
5a46a05108
Revert "feat: replace manifest_version with $schema field"
This reverts commit 7997e72758.
2025-08-27 11:24:18 -07:00
Joan Xie
7997e72758
feat: replace manifest_version with $schema field
- Replace manifest_version with $schema field pointing to official schema URL
- Support backward compatibility with legacy dxt_version field
- Update all examples and tests to use new $schema field
- Mark dxt_version as deprecated but still functional
- Require either $schema or dxt_version (at least one must be present)
2025-08-27 10:38:57 -07:00
Joan Xie
76949836e0
fix: update schema to reflect manifest_version 2025-08-25 21:09:45 -07:00
Joan Xie
0b2658f5b0
lint 2025-08-21 15:28:01 -07:00
Joan Xie
e1938b9933
rename dxt -> mcpb 2025-08-21 14:56:54 -07:00
Jacob
b062c0efad
fix: missing extension directory prefix in 'mcp_config' of python (#80) 2025-07-23 09:55:54 -07:00
Felix Rieseberg
7c9d61d9e6
chore: A round of "yarn fix" for everyone (#75) 2025-07-18 10:09:52 -07:00
Samuel Attard
9523b5af19
fix: strictly validate manifests (#66)
* fix: strictly validate manifests

* spec: align tests with strict schema
2025-07-11 14:36:52 -07:00
Samuel Attard
2dcc7efe6f
fix: handle invalid values in arrays (#61) 2025-07-10 16:10:48 -07:00
Erik Brakke
83b5a773ae
fix: preserve file permissions during unpack operation (#43)
- Parse ZIP central directory to extract Unix file permissions
- Restore executable permissions using chmodSync after unpacking files
- Skip permission restoration on Windows (Unix-only feature)
- Add comprehensive test to verify executable and regular file permissions are preserved
- Fix test setup to use npm instead of yarn for consistent build process

Fixes issue where executable files lose their execute permissions after being packed and unpacked, which is critical for extensions containing binary executables or shell scripts.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-10 09:09:07 -07:00
Alex Yang
ac2df7c157
chore: update tsconfig (#51) 2025-07-08 15:49:07 -07:00
Samuel Attard
85de8638db
build: test/build in CI (#49) 2025-07-06 21:01:37 -07:00
Samuel Attard
9ce2d6fd0e
fix: move to standard ignore implementation (#50) 2025-07-06 16:35:24 -07:00
Suyog Sonwalkar
2c1d058085
Adding unpack as cli command and exposing via index.ts for typescript usage. (#5) 2025-06-28 16:41:53 -07:00
Felix Rieseberg
e192e488c3
feat: Negation patterns (#24) 2025-06-28 16:11:32 -07:00
Felix Rieseberg
0172c07623
🚀 Hello World 2025-06-26 08:38:59 -07:00