Remove namespace match validation for websiteUrl and remote URL (#769)

<!-- Provide a brief summary of your changes -->

## Motivation and Context
<!-- Why is this change needed? What problem does it solve? -->

Resolve https://github.com/modelcontextprotocol/registry/issues/768 and
https://github.com/modelcontextprotocol/registry/issues/494.

Require HTTPS for remote URLs. Currently all remote URLs on the MCP
Registry are HTTPS.
Also fix a test bug when running on Windows (bad temp path).

## How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were
tested? -->

Unit tests.
Published a server.json locally with a website URL not matching the
server name.

## Breaking Changes
<!-- Will users need to update their code or configurations? -->

## 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)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [ ] ~I have added or updated documentation as needed~ N/A

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->
This commit is contained in:
Joel Verhagen 2025-11-17 06:32:59 -05:00 • committed by GitHub
commit 45bf43f9d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -454,6 +454,21 @@ func TestValidate(t *testing.T) {
},
expectedError: "websiteUrl must use https scheme: ftp://example.com/docs",
},
{
name: "server with invalid websiteUrl - required HTTPS",
serverDetail: apiv0.ServerJSON{
Schema: model.CurrentSchemaURL,
Name: "com.example/test-server",
Description: "A test server",
Repository: &model.Repository{
URL: "https://github.com/owner/repo",
Source: "github",
},
Version: "1.0.0",
WebsiteURL: "http://example.com/docs",
},
expectedError: "websiteUrl must use https scheme: http://example.com/docs",
},
{
name: "server with malformed websiteUrl",
serverDetail: apiv0.ServerJSON{
@ -512,7 +527,7 @@ func TestValidate(t *testing.T) {
Version: "1.0.0",
WebsiteURL: "https://different.com/docs",
},
expectedError: "websiteUrl https://different.com/docs does not match namespace com.example/test-server",
expectedError: "",
},
{
name: "package with spaces in name",
@ -797,7 +812,7 @@ func TestValidate_RemoteNamespaceMatch(t *testing.T) {
expectError: false,
},
{
name: "invalid - wrong domain",
name: "valid - different domain",
serverDetail: apiv0.ServerJSON{
Schema: model.CurrentSchemaURL,
Name: "com.example/test-server",
@ -808,23 +823,22 @@ func TestValidate_RemoteNamespaceMatch(t *testing.T) {
},
},
},
expectError: true,
errorMsg: "remote URL host google.com does not match publisher domain example.com",
expectError: false,
},
{
name: "invalid - different domain entirely",
name: "invalid - not HTTPS",
serverDetail: apiv0.ServerJSON{
Schema: model.CurrentSchemaURL,
Name: "com.microsoft/server",
Remotes: []model.Transport{
{
Type: "streamable-http",
URL: "https://api.github.com/endpoint",
URL: "http://api.github.com/endpoint",
},
},
},
expectError: true,
errorMsg: "remote URL host api.github.com does not match publisher domain microsoft.com",
errorMsg: "invalid remote URL: http://api.github.com/endpoint",
},
{
name: "invalid URL format",
@ -880,12 +894,12 @@ func TestValidate_RemoteNamespaceMatch(t *testing.T) {
},
{
Type: "streamable-http",
URL: "https://google.com/websocket",
URL: "http://example.com/sse",
},
},
},
expectError: true,
errorMsg: "remote URL host google.com does not match publisher domain example.com",
errorMsg: "invalid remote URL: http://example.com/sse",
},
}