Skip to content

Cache authorization policy lookups for IMcpServerPrimitives #762

@halter73

Description

@halter73

The authorization filters added by #733 looks up policies for IMcpServerPrimitives every request. This used to also be done by the authorization middleware, but .NET 7 introduced IAuthorizationPolicyProvider.AllowsCachingPolicies which makes it possible to cache at least some authorization policy. We could add an Items dictionary to IMcpServerPrimitives to track the cached policy similar to the Items dictionary #733 adds to the RequestContext<TParams>, or we could use a ConditionalWeakTable<IMcpServerPrimitive, AuthorizationPolicy?>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions