modelcontextprotocol / modelcontextprotocol/csharp-sdk

How do I resolve an instance of `IMcpServer` when using `WithHttpTransport`?

Open
#768 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs confirmation question
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.