diff --git a/internal/validators/utils.go b/internal/validators/utils.go index 035132db..d6f1ed18 100644 --- a/internal/validators/utils.go +++ b/internal/validators/utils.go @@ -11,7 +11,7 @@ var ( // These regex patterns ensure the URL is in the format of a valid GitHub or GitLab repository // For example: // - GitHub: https://github.com/user/repo githubURLRegex = regexp.MustCompile(`^https?://(www\.)?github\.com/[\w.-]+/[\w.-]+/?$`) - gitlabURLRegex = regexp.MustCompile(`^https?://(www\.)?gitlab\.com/[\w.-]+/[\w.-]+/?$`) + gitlabURLRegex = regexp.MustCompile(`^https?://(www\.)?gitlab\.com/[\w.-]+(?:/[\w.-]+)+/?$`) ) // IsValidRepositoryURL checks if the given URL is valid for the specified repository source diff --git a/internal/validators/validators_test.go b/internal/validators/validators_test.go index c3e5585b..272b15a6 100644 --- a/internal/validators/validators_test.go +++ b/internal/validators/validators_test.go @@ -323,6 +323,20 @@ func TestValidate(t *testing.T) { }, expectedError: validators.ErrInvalidRepositoryURL.Error(), }, + { + name: "server with valid GitLab URL in nested subgroup", + serverDetail: apiv0.ServerJSON{ + Schema: model.CurrentSchemaURL, + Name: "com.example/test-server", + Description: "A test server", + Repository: &model.Repository{ + URL: "https://gitlab.com/myorg/team/subgroup/my-mcp-server", + Source: "gitlab", + }, + Version: "1.0.0", + }, + expectedError: "", + }, { name: "server with valid repository subfolder", serverDetail: apiv0.ServerJSON{