End-to-end publish test using examples from docs (#199)

This commit is contained in:
Charles Lowell 2025-07-25 16:09:17 -07:00 • committed by GitHub
commit 4f5e85b510
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1041 additions and 919 deletions

38
internal/auth/no_auth.go Normal file
View file

@ -0,0 +1,38 @@
//go:build noauth
package auth
import (
"context"
"fmt"
"os"
"github.com/modelcontextprotocol/registry/internal/config"
"github.com/modelcontextprotocol/registry/internal/model"
)
func init() {
fmt.Fprintln(os.Stderr, `WARNING: "noauth" build tag has disabled authentication`)
}
// NewAuthService creates a new authentication service that does nothing. All its methods succeed unconditionally.
func NewAuthService(*config.Config) Service {
return &noAuth{}
}
type noAuth struct{}
// StartAuthFlow always returns fake flow info and a fake status token
func (*noAuth) StartAuthFlow(context.Context, model.AuthMethod, string) (map[string]string, string, error) {
return map[string]string{"fake": "info"}, "fake-status-token", nil
}
// CheckAuthStatus always returns a fake token
func (*noAuth) CheckAuthStatus(context.Context, string) (string, error) {
return "fake-token", nil
}
// ValidateAuth always returns true
func (*noAuth) ValidateAuth(context.Context, model.Authentication) (bool, error) {
return true, nil
}

View file

@ -1,3 +1,5 @@
//go:build !noauth
package auth
import (