modelcontextprotocol / modelcontextprotocol/csharp-sdk
How do I resolve an instance of `IMcpServer` when using `WithHttpTransport`?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Description
Consider this example repository, which implements an MCP server communicating over Streamable HTTP and uses Semantic Kernel.
This example draws inspiration from
When I try to implement this example of sampling from the Semantic Kernel demo, I encounter the following exception (described in Issue #564)
System.InvalidOperationException: Unable to resolve service for type 'ModelContextProtocol.Server.IMcpServer'
Question
How do I correctly resolve an instance of the IMcpServer when using WithHttpTransport? Is there a recommended pattern?
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.
Research direction
Start with Tools/ExampleTool.cs at the referenced sampling example, then compare the Semantic Kernel MCP Server and AspNetCoreMcpServer samples. Review Issue #564 alongside the sk-mcp-streamable-http-example to determine the supported IMcpServer resolution pattern with WithHttpTransport. Done means the recommended pattern is identified and documented clearly enough to resolve the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100