modelcontextprotocol / modelcontextprotocol/csharp-sdk
Document ClientOAuthOptions.ScopeSelector usage
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Description
ClientOAuthOptions.ScopeSelector is a public API for customizing the OAuth scopes selected after the server-provided scope information has been resolved. It was added in #1596, but I couldn't find any conceptual documentation showing when or how to use it.
The XML documentation describes the API behavior, but users browsing the SDK documentation may not discover that ScopeSelector can be used to:
- filter scopes advertised by the server;
- append client-specific scopes when needed;
- return
nullor an empty sequence to omit thescopeparameter entirely.
A small conceptual example would make this behavior easier to discover, for example:
var oauthOptions = new ClientOAuthOptions
{
ScopeSelector = scopes =>
scopes?.Where(scope => scope is "mcp:tools" or "mcp:resources")
};
This would be especially useful alongside the existing OAuth guidance, where users may otherwise assume that Scopes is the only way to influence the requested scope set.
I also checked the currently open OAuth documentation work in #1801, which does not appear to cover ScopeSelector.
I'd be happy to submit a focused documentation PR for this and keep the change narrowly scoped to client-side scope selection, placing it wherever best fits the documentation structure.
[!NOTE]
This issue was prepared with AI assistance.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing OAuth guidance and the ClientOAuthOptions.ScopeSelector XML documentation, then identify the best location for a focused conceptual section. Done means documenting filtering, appending client-specific scopes, and returning null or an empty sequence to omit the scope parameter, with a small C# example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100