Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Cache authorization policy lookups for IMcpServerPrimitives

Open
#762 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp
Domain
authorization

Research direction

Start at the authorization filters added by #733 and inspect IMcpServerPrimitives, RequestContext, and IAuthorizationPolicyProvider.AllowsCachingPolicies. Compare the proposed Items dictionary and ConditionalWeakTable approaches, then verify that eligible authorization policies are reused across requests without changing authorization behavior.

Written by the indexing model from the issue text.

Description

enhancement needs confirmation

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?>.

Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/csharp-sdk

All issues in modelcontextprotocol/csharp-sdk

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.