modelcontextprotocol / modelcontextprotocol/csharp-sdk

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

Open Beginner friendly
#515 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs confirmation P3 ready for work
Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Description

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.

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 in src/ModelContextProtocol.Core/Client/SseClientTransportOptions.cs, especially the setter linked in the issue, and trace how SseClientTransport uses HttpClient and Endpoint. Done means an HttpClient can provide the service-discovered endpoint without requiring a separate Endpoint value, while existing validation still behaves correctly; check the related tests if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.