modelcontextprotocol / modelcontextprotocol/csharp-sdk

Document ClientOAuthOptions.ScopeSelector usage

Open Beginner friendly
#1,867 0 comments 0 reactions 0 assignees View on GitHub

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 null or an empty sequence to omit the scope parameter 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

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.