modelcontextprotocol / modelcontextprotocol/csharp-sdk
Access to HttpContext within handler delegates like ListToolsHandler for authentication-aware logic
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 4.5k
- Fork
- 814
- Merge medio
- 9g 19h
- PR unite (30g)
- 4
Descrizione
Is your feature request related to a problem? Please describe.
I'm currently working with the Model Context Protocol in .NET and would like to dynamically filter the tools returned by the ListToolsHandler based on the current user's authentication context. However, it doesn't seem possible to access the current HTTP context inside the ListToolsHandler or similar delegate handlers. This limits the ability to tailor tool availability based on user identity or permissions.
Describe the solution you'd like
I would like to be able to access the current HttpContext (or any equivalent user context) from within handlers like ListToolsHandler, CallToolHandler, etc. This would allow implementing features like per-user tool availability or custom authorization logic.
Describe alternatives you've considered
I haven't found a clear alternative to accessing the HTTP context directly from these handlers. Most approaches seem like workarounds and don't offer a clean or reliable way to integrate authentication data.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando come vengono invocati ListToolsHandler e CallToolHandler nel C# SDK e dove è disponibile il contesto della richiesta corrente. Confronta l’HttpContext richiesto, o un contesto utente equivalente, con l’API degli handler esistente. L’implementazione dovrebbe stabilire un modo documentato e affidabile per consentire agli handler di applicare una logica di autenticazione o autorizzazione per utente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- api, authentication
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100