modelcontextprotocol / modelcontextprotocol/csharp-sdk

`SseClientTransport.Endpoint` should be nullable when `HttpClient` is provided

Offen Anfängerfreundlich
#515 6 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement needs confirmation P3 ready for work
Vorherrschende Sprache
C#
Sterne
4.5k
Forks
814
Ø Merge
9 T. 19 Std.
Gemergte PRs (30 T.)
4

Beschreibung

Is your feature request related to a problem? Please describe.
I'm looking at how to integrate with .NET Aspire, where I have an MCP server on HTTP and then I want to consume that from an application using McpClient.

Aspire allows me to pass through the endpoint using service discovery on the HttpClient, so I can have an endpoint like https+http://mcp, but this endpoint can't be set to SseClientTransport.Endpoint due to this validation on the setter: https://github.com/modelcontextprotocol/csharp-sdk/blob/1e8fb040377b9ac9ac94c97e4b1f1438170bc0ea/src/ModelContextProtocol.Core/Client/SseClientTransportOptions.cs#L24-L27

Describe the solution you'd like
I want to be able to provide a HttpClient instance to the SseClientTransport without also having to provide the endpoint, since the HttpClient has the endpoint known (and it's resolved via service discovery).

Describe alternatives you've considered
My only solution is that I have to manually configure the endpoint, which defeats some of the value of using .NET Aspire here.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in src/ModelContextProtocol.Core/Client/SseClientTransportOptions.cs, insbesondere mit dem im Issue verlinkten Setter, und verfolge, wie SseClientTransport HttpClient und Endpoint verwendet. Die Aufgabe ist erledigt, wenn ein HttpClient den per Service Discovery ermittelten Endpoint bereitstellen kann, ohne einen separaten Endpoint-Wert zu erfordern, während die bestehende Validierung weiterhin korrekt funktioniert; prüfe die zugehörigen Tests, falls vorhanden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
api
Issue-Typ
Feature
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.