Skip to content

feat(pack): add mcpb bundling support with cvm manifest conventions#4

Open
abhayguptas wants to merge 3 commits into
ContextVM:mainfrom
abhayguptas:feat/mcpb-bundling-support
Open

feat(pack): add mcpb bundling support with cvm manifest conventions#4
abhayguptas wants to merge 3 commits into
ContextVM:mainfrom
abhayguptas:feat/mcpb-bundling-support

Conversation

@abhayguptas

Copy link
Copy Markdown

Resolves #3

Description

This PR introduces the pack command, enabling developers to package local MCP servers into distributable .mcpb bundles. It also extends the serve command to seamlessly execute these bundles over the Nostr network.

The implementation fully adheres to Anthropic's MCPB specification while extending it with a _meta.com.contextvm namespace to carry CVM-specific metadata (relays, public mode, encryption, etc.) without breaking compatibility with other hosts.

Changes Made

  • Manifest Conventions: Added a robust Zod schema (src/pack/cvm-manifest.ts) to strictly type and validate the _meta.com.contextvm namespace inside manifest.json.
  • cvmi pack: Introduced a new subcommand that packages a project directory into an .mcpb zip archive with maximum compression.
  • Interactive Init: If a user runs cvmi pack and no manifest exists, an interactive wizard prompts them for server details and CVM-specific defaults (relays, encryption mode) to generate a valid manifest.json.
  • cvmi serve <bundle.mcpb>: Upgraded the serve command to accept an .mcpb file. It extracts the bundle into a secure temporary directory, reads the custom metadata to override gateway defaults, and runs the server over Nostr.
  • Cleanup Routine: The temporary extracted bundle directories are automatically wiped upon a graceful shutdown (e.g., Ctrl+C).
  • CLI Wiring: Registered the new command in cli.ts and updated AGENTS.md docs.

Verification

  • Tested packaging both Node and Python servers using the wizard.
  • Verified globbing ignores .git, .DS_Store, and node_modules/.cache while preserving necessary dotfiles (dot: true).
  • Validated that cvmi serve correctly extracts the bundle, parses the CVM config, applies runtime overrides via CLI flags, and successfully exposes the server.
  • Passes all existing tests, code formatting, and pnpm type-check with 0 errors.

- Add transport field (stdio/cvm) for dual-mode bundle execution
- Add env_mapping contract for native CVM server config injection
- Restructure CVM meta to use nested defaults object
- Add docker server type with image and compose_file support
- Implement CVM transport mode in serve (spawn with env vars, no Gateway)
- Update pack-init wizard with transport, docker, and env_mapping prompts
- Remove announce/pricing fields (not needed for initial scope)
- Fix duplicate --help line in serve help text
- Fix encryption enum: use 'required' instead of 'nip44' to match SDK EncryptionMode
- Make display_name optional per MCPB spec
- Add mcp_config.env support with __dirname substitution
- Add 'uv' server type for Python UV dependency management (MCPB v0.4+)
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.

Study usage of MCPB for bundling

1 participant