Skip to content

Commit 5ab6739

Browse files
authored
Update MCPM URL (#88)
1 parent 5119e15 commit 5ab6739

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

internal/cmd/basecmd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ func (c *BaseCmd) Build() (registry.PackageProvider, error) {
7777
opts := runtime.WithSupportedRuntimes(supportedRuntimes...)
7878
l := logger.Named("registry")
7979

80-
// TODO: Should we be using a hardcoded URL
81-
mcpm, err := mcpm.NewRegistry(l, "https://getmcp.io/api/servers.json", opts)
80+
mcpm, err := mcpm.NewRegistry(l, mcpm.ManifestURL, opts)
8281
if err != nil {
8382
// TODO: Handle tolerating some failed registries, as long as we can meet a minimum requirement.
8483
return nil, err

internal/provider/mcpm/registry.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ import (
1515
"github.com/mozilla-ai/mcpd/v2/internal/runtime"
1616
)
1717

18-
const registryName = "mcpm"
18+
const (
19+
// RegistryName is the name of this registry that will appear as the Package.Source, and in logs/errors.
20+
RegistryName = "mcpm"
21+
22+
// ManifestURL is the URL at which the servers JSON file for the registry can be found for MCPM.
23+
ManifestURL = "https://mcpm.sh/api/servers.json"
24+
)
1925

2026
// Ensure Registry implements PackageProvider
2127
var _ registry.PackageProvider = (*Registry)(nil)
@@ -53,14 +59,14 @@ func NewRegistry(logger hclog.Logger, url string, opt ...runtime.Option) (*Regis
5359
}
5460

5561
// Handle retrieving the JSON data to bootstrap the registry.
56-
servers, err := runtime.LoadFromURL[MCPServers](url, registryName)
62+
servers, err := runtime.LoadFromURL[MCPServers](url, RegistryName)
5763
if err != nil {
5864
return nil, err
5965
}
6066

6167
// Configure 'standard' filtering options that should always be included.
6268
// e.g. for unsupported 'version'.
63-
l := logger.Named(registryName)
69+
l := logger.Named(RegistryName)
6470
filterOpts := []options.Option{
6571
options.WithUnsupportedKeys(options.FilterKeyVersion),
6672
options.WithLogFunc(func(key, val string) {
@@ -85,7 +91,7 @@ func registrySupportedRuntimes() []runtime.Runtime {
8591
}
8692

8793
func (r *Registry) ID() string {
88-
return registryName
94+
return RegistryName
8995
}
9096

9197
// Resolve implements the PackageGetter interface for Registry.
@@ -245,7 +251,7 @@ func (r *Registry) buildPackageResult(pkgKey string) (packages.Package, bool) {
245251
arguments := extractArgumentMetadata(sd, r.supportedRuntimes)
246252

247253
return packages.Package{
248-
Source: registryName,
254+
Source: RegistryName,
249255
ID: pkgKey,
250256
Name: pkgKey,
251257
DisplayName: sd.DisplayName,

0 commit comments

Comments
 (0)