MCPB构建工具

一个用于使用MCPB CLI构建模型上下文协议(MCP)包的GitHub Action,支持多种包管理器和验证功能。

  • by entro314-labs
  • 本地部署
  • 更新于
在 GitHub 查看 entro314-labs/mcpb-build-action

使用说明

MCPB Build Action

A GitHub Action for building Model Context Protocol (MCP) packages using the MCPB CLI.

Features

  • Validates manifest.json before building
  • Builds .mcpb packages from your MCP server
  • Supports multiple package managers (pnpm, npm, yarn)
  • Optionally uploads built package as workflow artifact
  • Outputs package metadata (name, version, size, SHA256)
  • Marketplace-ready with branding

Usage

Basic Usage

- name: Build MCPB Package
  uses: entro314-labs/mcpb-build-action@v1

With Custom Options

- name: Build MCPB Package
  id: mcpb
  uses: entro314-labs/mcpb-build-action@v1
  with:
    manifest: 'manifest.json'
    output: 'my-mcp-server'
    package-manager: 'pnpm'
    node-version: '22'

- name: Use Build Outputs
  run: |
    echo "Package: ${{ steps.mcpb.outputs.package-name }}@${{ steps.mcpb.outputs.package-version }}"
    echo "Size: ${{ steps.mcpb.outputs.package-size }}"
    echo "SHA256: ${{ steps.mcpb.outputs.shasum }}"

Validate Only (No Build)

- name: Validate Manifest
  uses: entro314-labs/mcpb-build-action@v1
  with:
    validate-only: 'true'

Without Artifact Upload

- name: Build MCPB Package
  uses: entro314-labs/mcpb-build-action@v1
  with:
    upload-artifact: 'false'

Inputs

Input Description Required Default
manifest Path to manifest.json file No manifest.json
output Output filename for the .mcpb package (without extension) No Uses manifest name
working-directory Working directory for the build No .
validate-only Only validate the manifest without building No false
node-version Node.js version to use No 22
package-manager Package manager to use (pnpm, npm, yarn) No pnpm
upload-artifact Upload the built package as a workflow artifact No true
artifact-name Name for the uploaded artifact No mcpb-package
artifact-retention-days Number of days to retain the artifact No 30

Outputs

Output Description
package-path Absolute path to the built .mcpb package
package-name Name of the built package
package-version Version of the built package
package-size Human-readable size of the built package
shasum SHA256 checksum of the package

Example Workflows

Release with MCPB Package

name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build MCPB Package
        id: mcpb
        uses: entro314-labs/mcpb-build-action@v1
        with:
          output: 'my-package'
          upload-artifact: 'false'

      - name: Create Release
        uses: softprops/action-gh-release@v2
        with:
          files: |
            ${{ steps.mcpb.outputs.package-name }}.mcpb

CI Validation

name: CI

on:
  pull_request:

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Validate MCPB Manifest
        uses: entro314-labs/mcpb-build-action@v1
        with:
          validate-only: 'true'

Build with Different Package Managers

# Using npm
- uses: entro314-labs/mcpb-build-action@v1
  with:
    package-manager: 'npm'

# Using yarn
- uses: entro314-labs/mcpb-build-action@v1
  with:
    package-manager: 'yarn'

# Using pnpm (default)
- uses: entro314-labs/mcpb-build-action@v1
  with:
    package-manager: 'pnpm'

Requirements

  • Node.js 24.19.0+ (configurable via node-version input)
  • A valid manifest.json following the MCPB specification
  • One of: pnpm, npm, or yarn

Versioning

This action uses semantic versioning. We recommend pinning to a major version:

uses: entro314-labs/mcpb-build-action@v1  # Recommended
uses: entro314-labs/mcpb-build-action@v1.0.0  # Pin to specific version
uses: entro314-labs/mcpb-build-action@main  # Latest (not recommended for production)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details.

Related