Support using WithStreamServerTransport for multiple in-process mcp servers
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start at the builder.Services.AddSingleton(new StreamServerTransport(inputStream, outputStream)) registration and inspect how StreamServerTransport is wired to an in-process MCP Server. Trace the channel and service-lifetime assumptions, then verify that multiple MCP Server classes can be declared in-process with separate channels.
Written by the indexing model from the issue text.
Description
The current implementation register the stream support as a singleton:
builder.Services.AddSingleton<ITransport>(new StreamServerTransport(inputStream, outputStream));
This prevents declaring multiple MCP Server classes in-process and using them with a separate channels.
Reasons for this choice:
- creating MCP servers in a separate class library so that they can be instantiated in-process or out-of-process depending on the app
- ability to clearly separate the tools, prompts and resources. Currently I have to mix all the in-process prompts, resources and tools in a single MCP server to be used in-process.
- avoid creating a separate process just because of the library limitation (performance reasons)
As I mentioned in a discussion, the Model Context Protocol adhere to the "transparency" principle, but the library makes it very difficult to reach. This is the reason why I tagged this as a bug.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/csharp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comment ·
-
enhancement needs confirmation P3 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comments · 3 reactions ·
All issues in modelcontextprotocol/csharp-sdk
Similar issues
-
effort:S P3 refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
C#/.NET Roslyn LSP Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
DotNetNext/SqlSugar#1458 ·