This PR simplifies the seed data import configuration based on maintainer feedback by removing command line flags and using a clearer environment variable name. ## Key Changes ### Configuration Simplification - **Renamed**: `MCP_REGISTRY_SEED_FILE_PATH` → `MCP_REGISTRY_SEED_FROM` - **Removed**: `--seed-file-path` command line flag to eliminate configuration complexity ### Improved User Experience Users now configure seed data import using a single, clear environment variable: ```bash # Before (multiple ways to configure) MCP_REGISTRY_SEED_FILE_PATH=data/seed.json ./registry ./registry --seed-file-path=data/seed.json # After (simplified single method) MCP_REGISTRY_SEED_FROM=data/seed.json ./registry ``` ### Registry Composability The composability workflow is now simplified while maintaining all functionality: ```bash # Start first registry with seed data MCP_REGISTRY_SEED_FROM=data/seed.json ./registry # Start second registry importing from first via pagination MCP_REGISTRY_SEED_FROM=http://localhost:8080 ./registry ``` ## Technical Implementation - Maintains full backward compatibility for import functionality - All existing seed data sources continue to work (local files, HTTP URLs, registry URLs) - Automatic pagination through `/v0/servers` endpoint remains unchanged - Configurable delays between requests preserved ## Benefits - **Reduced complexity**: Single configuration method instead of multiple - **Clearer naming**: `SEED_FROM` better describes the source of seed data - **Easier maintenance**: Fewer configuration paths to test and document - **Consistent patterns**: Aligns with other environment-variable-only configuration All existing functionality is preserved while providing a cleaner, more maintainable configuration interface. <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to start the survey. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Avinash Sridhar <sridharavinash@users.noreply.github.com> Co-authored-by: Toby Padilla <toby@toby.sh> Co-authored-by: toby <83556+toby@users.noreply.github.com>
50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
package v0_test
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/modelcontextprotocol/registry/internal/model"
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// MockRegistryService is a mock implementation of the RegistryService interface
|
|
type MockRegistryService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (m *MockRegistryService) List(cursor string, limit int) ([]model.Server, string, error) {
|
|
args := m.Called(cursor, limit)
|
|
return args.Get(0).([]model.Server), args.String(1), args.Error(2)
|
|
}
|
|
|
|
func (m *MockRegistryService) GetByID(id string) (*model.ServerDetail, error) {
|
|
args := m.Called(id)
|
|
return args.Get(0).(*model.ServerDetail), args.Error(1)
|
|
}
|
|
|
|
func (m *MockRegistryService) Publish(serverDetail *model.ServerDetail) error {
|
|
args := m.Called(serverDetail)
|
|
return args.Error(0)
|
|
}
|
|
|
|
// MockAuthService is a mock implementation of the auth.Service interface
|
|
type MockAuthService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (m *MockAuthService) StartAuthFlow(
|
|
ctx context.Context, method model.AuthMethod, repoRef string,
|
|
) (map[string]string, string, error) {
|
|
args := m.Called(ctx, method, repoRef)
|
|
return args.Get(0).(map[string]string), args.String(1), args.Error(2)
|
|
}
|
|
|
|
func (m *MockAuthService) CheckAuthStatus(ctx context.Context, statusToken string) (string, error) {
|
|
args := m.Called(ctx, statusToken)
|
|
return args.String(0), args.Error(1)
|
|
}
|
|
|
|
func (m *MockAuthService) ValidateAuth(ctx context.Context, authentication model.Authentication) (bool, error) {
|
|
args := m.Called(ctx, authentication)
|
|
return args.Bool(0), args.Error(1)
|
|
}
|