Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/service/registry_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ func (s *registryServiceImpl) validateNoDuplicateRemoteURLs(ctx context.Context,

// Check if any conflicting server has a different name
for _, conflictingServer := range conflictingServers {
if conflictingServer.Meta.Official != nil && conflictingServer.Meta.Official.Status != model.StatusActive {
continue
}
if conflictingServer.Server.Name != serverDetail.Name {
return fmt.Errorf("remote URL %s is already used by server %s", remote.URL, conflictingServer.Server.Name)
}
Expand Down
26 changes: 26 additions & 0 deletions internal/service/registry_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ func TestValidateNoDuplicateRemoteURLs(t *testing.T) {
_, err := service.CreateServer(ctx, server)
require.NoError(t, err, "failed to create server: %v", err)
}
deprecatedServer := &apiv0.ServerJSON{
Schema: model.CurrentSchemaURL,
Name: "com.example/deprecated-server",
Description: "A deprecated server",
Version: "1.0.0",
Remotes: []model.Transport{
{Type: "streamable-http", URL: "https://old.example.com/mcp"},
},
}
_, err := service.CreateServer(ctx, deprecatedServer)
require.NoError(t, err)
_, err = service.UpdateServerStatus(ctx, deprecatedServer.Name, deprecatedServer.Version, &StatusChangeRequest{NewStatus: model.StatusDeprecated})
require.NoError(t, err)

tests := []struct {
name string
Expand Down Expand Up @@ -97,6 +110,19 @@ func TestValidateNoDuplicateRemoteURLs(t *testing.T) {
expectError: true,
errorMsg: "remote URL https://api.example.com/mcp is already used by server com.example/existing-server",
},
{
name: "duplicate remote URL on deprecated server - should pass",
serverDetail: apiv0.ServerJSON{
Schema: model.CurrentSchemaURL,
Name: "com.example/replacement-server",
Description: "A replacement server",
Version: "1.0.0",
Remotes: []model.Transport{
{Type: "streamable-http", URL: "https://old.example.com/mcp"},
},
},
expectError: false,
},
{
name: "updating same server with same URLs - should pass",
serverDetail: apiv0.ServerJSON{
Expand Down
Loading