googleapis/mcp-toolbox · error

invalid toolbox-url %q: must be a valid absolute URL with sc

Error message

invalid toolbox-url %q: must be a valid absolute URL with scheme and host

What it means

Error "invalid toolbox-url %q: must be a valid absolute URL with scheme and host" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/server/prm.go:93

}

// getPRMURL returns the full URL to advertise in WWW-Authenticate headers.
func (s *Server) getPRMURL() string {
	return s.prmURL
}

// parsePRMURL returns the full URL to advertise in WWW-Authenticate headers from a toolbox URL.
func parsePRMURL(toolboxUrl string) (string, error) {
	if toolboxUrl == "" {
		return "/.well-known/oauth-protected-resource", nil
	}
	u, err := url.Parse(toolboxUrl)
	if err != nil {
		return "", fmt.Errorf("invalid toolbox-url %q: %w", toolboxUrl, err)
	}
	if u.Scheme != "" || u.Host != "" {
		if u.Scheme == "" || u.Host == "" {
			return "", fmt.Errorf("invalid toolbox-url %q: must be a valid absolute URL with scheme and host", toolboxUrl)
		}
		path := strings.TrimSuffix(u.Path, "/")
		return u.Scheme + "://" + u.Host + "/.well-known/oauth-protected-resource" + path, nil
	}
	path := strings.TrimSuffix(u.Path, "/")
	if !strings.HasPrefix(path, "/") {
		path = "/" + path
	}
	if path == "/" {
		return "/.well-known/oauth-protected-resource", nil
	}
	return "/.well-known/oauth-protected-resource" + path, nil
}

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/server/prm.go:93 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/296d4dc1b00c34db. Report an issue: GitHub.