Documentation
¶
Overview ¶
Package mcpbundle builds and validates the platform-specific MCP Bundles published for gograph.
Index ¶
- Constants
- Variables
- func BuildBundle(manifest Manifest, binary, license []byte) ([]byte, string, error)
- func MarshalManifest(manifest Manifest, version string, target Target) ([]byte, error)
- func ResolveCommand(manifest Manifest, target Target, bundleDir, projectDirectory string) (string, []string, error)
- func ValidateBinary(binary []byte, target Target, version string) error
- func ValidateManifest(manifest Manifest, version string, target Target) error
- func ValidateManifestSchema(raw []byte) error
- func ValidateServerJSON(raw []byte) error
- func ValidateVersion(version string) error
- type Artifact
- type Author
- type Compatibility
- type MCPConfig
- type Manifest
- type Repository
- type Server
- type SmokeResult
- type Target
- type UserConfig
- type Verification
Constants ¶
const ( // ManifestVersion is the MCPB manifest revision used by release bundles. ManifestVersion = "0.4" // ServerName is the name reported by the bundled MCP server. ServerName = "gograph" )
Variables ¶
var Targets = []Target{
{GOOS: "darwin", GOARCH: "amd64", Platform: "darwin"},
{GOOS: "darwin", GOARCH: "arm64", Platform: "darwin"},
{GOOS: "linux", GOARCH: "amd64", Platform: "linux"},
{GOOS: "linux", GOARCH: "arm64", Platform: "linux"},
{GOOS: "windows", GOARCH: "amd64", Platform: "win32"},
{GOOS: "windows", GOARCH: "arm64", Platform: "win32"},
}
Targets is the complete, deterministic release target order.
Functions ¶
func BuildBundle ¶
BuildBundle validates its inputs and returns a deterministic MCPB ZIP and the lowercase SHA-256 digest of the exact bytes returned.
func MarshalManifest ¶
MarshalManifest produces stable, human-readable JSON with a final newline.
func ResolveCommand ¶
func ResolveCommand(manifest Manifest, target Target, bundleDir, projectDirectory string) (string, []string, error)
ResolveCommand resolves only the two MCPB variables emitted by NewManifest. It returns command and argv separately; it never constructs a shell string.
func ValidateBinary ¶
ValidateBinary checks the Go executable's embedded build metadata. This is portable, so CI can validate all non-native release targets without running foreign executables.
func ValidateManifest ¶
ValidateManifest enforces both the MCPB shape and gograph's release policy.
func ValidateManifestSchema ¶
ValidateManifestSchema validates raw manifest JSON against the pinned MCPB v0.4 schema embedded in this package. It never follows a network reference.
func ValidateServerJSON ¶
ValidateServerJSON validates raw Registry metadata against the pinned 2025-12-11 official Registry schema embedded in this package. Callers should apply release-specific semantic checks after this structural validation.
func ValidateVersion ¶
ValidateVersion requires a semantic version without a leading v. This also makes it safe to pass the version as one ldflag argument during builds.
Types ¶
type Artifact ¶
Artifact describes one on-disk MCPB release asset.
func BuildAll ¶
BuildAll cross-compiles, packages, validates, and publishes to outputDir all six supported MCPB assets. It stages every artifact before changing the output directory and refuses to replace a different existing asset.
type Compatibility ¶
type Manifest ¶
type Manifest struct {
Schema string `json:"$schema"`
ManifestVersion string `json:"manifest_version"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Version string `json:"version"`
Description string `json:"description"`
LongDescription string `json:"long_description,omitempty"`
Author Author `json:"author"`
Repository Repository `json:"repository"`
Homepage string `json:"homepage"`
Documentation string `json:"documentation"`
Support string `json:"support"`
Server Server `json:"server"`
ToolsGenerated bool `json:"tools_generated"`
Keywords []string `json:"keywords"`
License string `json:"license"`
PrivacyPolicies []string `json:"privacy_policies"`
Compatibility Compatibility `json:"compatibility"`
UserConfig map[string]UserConfig `json:"user_config"`
Meta map[string]map[string]string `json:"_meta"`
}
Manifest is the strict subset of MCPB manifest v0.4 used by gograph binary bundles. Keeping this typed prevents release scripts from silently emitting misspelled or unsupported fields.
func DecodeManifest ¶
DecodeManifest strictly decodes a manifest and rejects unknown fields or trailing JSON before applying target-aware semantic validation.
type Repository ¶
type SmokeResult ¶
SmokeResult records the MCP identity and tools returned by a native bundle.
func SmokeNative ¶
func SmokeNative(ctx context.Context, inputDir, projectDir, version string) (*SmokeResult, error)
SmokeNative validates and executes only the host-native bundle, initializes MCP over stdio, and requests tools/list from the selected Go project.
type Target ¶
Target identifies one supported release operating-system and architecture pair. Platform is the MCPB/Node-style platform identifier used by manifests.
func SupportedTargets ¶
func SupportedTargets() []Target
SupportedTargets returns a copy so callers cannot change the canonical release target list accidentally.
func (Target) ArtifactName ¶
ArtifactName returns the canonical immutable release asset filename.
func (Target) ExecutableName ¶
ExecutableName is the executable filename stored in the bundle.
func (Target) InstalledCommand ¶
InstalledCommand is the MCPB command template for this target.
func (Target) InstalledExecutable ¶
InstalledExecutable resolves the executable path below an extracted bundle directory without invoking a shell.
func (Target) ServerPath ¶
ServerPath is the slash-separated executable path inside a MCPB ZIP.
type UserConfig ¶
type Verification ¶
type Verification struct {
Target Target
Manifest Manifest
SHA256 string
BinarySHA256 string
Size int64
}
Verification describes one fully validated bundle.
func VerifyBundle ¶
func VerifyBundle(bundle []byte, target Target, version, expectedSHA string) (*Verification, error)
VerifyBundle validates the digest, exact ZIP layout, manifest, license, and embedded Go executable for one target. expectedSHA may be empty when callers only need the calculated digest.