feat: Add support for MCP Bundles (MCPB) in registry (#295)
## Motivation and Context - Add MCPB as a new registry_name option - Add file_hashes field to package model for integrity verification - Implement URL validation restricting MCPB packages to GitHub/GitLab hosts - Require SHA-256 hash for all MCPB packages - Add example MCPB package in documentation - Update schemas and OpenAPI specification See issue #260 ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> ## Breaking Changes N/A, registry has not yet been launched ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [ ] My code follows the repository's style guidelines - [ ] New and existing tests pass locally - [ ] I have added appropriate error handling - [x] I have added or updated documentation as needed --------- Co-authored-by: Adam Jones <adamj+git@anthropic.com>
This commit is contained in:
parent
c3b72ef3a6
commit
57efb58143
2 changed files with 2014 additions and 2040 deletions
|
|
@ -59,7 +59,7 @@ type PackageValidator struct{}
|
|||
|
||||
// Validate checks if the package details are valid
|
||||
func (pv *PackageValidator) Validate(obj *model.Package) error {
|
||||
if !HasNoSpaces(obj.Name) {
|
||||
if !HasNoSpaces(obj.Identifier) {
|
||||
return ErrPackageNameHasSpaces
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ func TestObjectValidator_Validate(t *testing.T) {
|
|||
},
|
||||
Packages: []model.Package{
|
||||
{
|
||||
Name: "test-package",
|
||||
RegistryName: "npm",
|
||||
Identifier: "test-package",
|
||||
RegistryType: "npm",
|
||||
RegistryBaseURL: "https://registry.npmjs.org",
|
||||
},
|
||||
},
|
||||
Remotes: []model.Remote{
|
||||
|
|
@ -102,8 +103,9 @@ func TestObjectValidator_Validate(t *testing.T) {
|
|||
},
|
||||
Packages: []model.Package{
|
||||
{
|
||||
Name: "test package with spaces",
|
||||
RegistryName: "npm",
|
||||
Identifier: "test package with spaces",
|
||||
RegistryType: "npm",
|
||||
RegistryBaseURL: "https://registry.npmjs.org",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -123,12 +125,14 @@ func TestObjectValidator_Validate(t *testing.T) {
|
|||
},
|
||||
Packages: []model.Package{
|
||||
{
|
||||
Name: "valid-package",
|
||||
RegistryName: "npm",
|
||||
Identifier: "valid-package",
|
||||
RegistryType: "npm",
|
||||
RegistryBaseURL: "https://registry.npmjs.org",
|
||||
},
|
||||
{
|
||||
Name: "invalid package", // Has space
|
||||
RegistryName: "pip",
|
||||
Identifier: "invalid package", // Has space
|
||||
RegistryType: "pypi",
|
||||
RegistryBaseURL: "https://pypi.org",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue