Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeResourceID ¶
NormalizeResourceID validates and normalizes a resource identifier as defined by RFC 8707 section 2 and the MCP canonical server URI rules, returning an error when the value cannot be one.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry implements the registry for registered protected resources.
func NewRegistry ¶
func NewRegistry(ctx context.Context, registrationConfFilepath string, logger logrus.FieldLogger) (*Registry, error)
NewRegistry creates a new resource Registry with the provided parameters. An empty registrationConfFilepath yields an empty registry.
func (*Registry) Get ¶
Get returns the registered resource for the provided resource identifier, which is normalized before lookup.
func (*Registry) ScopesSupported ¶
ScopesSupported returns the union of the scopes, implicit ones included, of all registered resources.
func (*Registry) ValidateScopes ¶
ValidateScopes returns an error when a registered resource names a scope which is not in the provided list of supported scopes. An undeclared scope would be dropped when authorizing a request, so a resource asking for one is a configuration error.
type RegistryData ¶
type RegistryData struct {
Resources []*Resource `yaml:"resources,flow"`
}
RegistryData is the base structure of the resources section of our client registry configuration file. All other sections of that file are parsed by their own registry and are ignored here.
type Resource ¶
type Resource struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Scopes []string `yaml:"scopes,flow"`
// ImplicitScopes are granted for this resource whether a client asked for
// them or not. They are meant for the scopes which are not a permission of
// the resource but change what a token carries, and a client has no reason
// to know about.
ImplicitScopes []string `yaml:"implicit_scopes,flow"`
// contains filtered or unexported fields
}
Resource is one protected resource, an MCP server, as registered in the resources section of the client registration configuration file.
func (*Resource) AllowsScope ¶
AllowsScope returns true when the provided scope is one the resource accepts.
func (*Resource) ApplyImplicitScopes ¶
ApplyImplicitScopes adds the implicit scopes of the associated resource to the provided scopes.