Document ClientOAuthOptions.ScopeSelector usage

Aperta Adatta ai principianti
#1,867 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
documentation

Direzione di ricerca

Inizia con la guida OAuth esistente e la documentazione XML di ClientOAuthOptions.ScopeSelector, quindi individua la posizione migliore per una sezione concettuale mirata. Il lavoro è completo quando vengono documentati il filtraggio, l’aggiunta di scopes specifici del client e la restituzione di null o di una sequenza vuota per omettere il parametro scope, con un piccolo esempio in C#.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C#
Stelle
4.5k
Fork
814
Merge medio
9g 19h
PR unite (30g)
4

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/csharp-sdk

Tutte le issue di modelcontextprotocol/csharp-sdk

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.