You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Cannot run an HttpListenerSseServerTransport server
System.InvalidOperationException: No constructor for type 'ModelContextProtocol.Protocol.Transport.HttpListenerSseServerTransport' can be instantiated using services from the service container and default values.
The extension method attempts to register a Singleton, but the constructor requires server and port
To Reproduce
Steps to reproduce the behavior:
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddMcpServer()
.WithHttpListenerSseServerTransport()
.WithToolsFromAssembly();
Expected behavior
The HTTP SSE server should run.
Logs
Mcp.Server[0]
Host terminated unexpectedly
System.InvalidOperationException: No constructor for type 'ModelContextProtocol.Protocol.Transport.HttpListenerSseServerTransport' can be instantiated using services from the service container and default values.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, ServiceIdentifier serviceIdentifier, Type implementationType, CallSiteChain cal
Additional context
I'm really new to MCP- it's awesome, thanks for all the hard work - great to have a c# SDK so early. I'll probably get the source down and see if I can fix it - I'll submit a PR if I can. Cheers!
shoshin-labs
changed the title
Error when using: builder.Services.AddMcpServer().WithHttpListenerSseServerTransport()
Error when using: .WithHttpListenerSseServerTransport()
Mar 31, 2025
Describe the bug
Cannot run an HttpListenerSseServerTransport server
The extension method attempts to register a Singleton, but the constructor requires server and port
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The HTTP SSE server should run.
Logs
Additional context
I'm really new to MCP- it's awesome, thanks for all the hard work - great to have a c# SDK so early. I'll probably get the source down and see if I can fix it - I'll submit a PR if I can. Cheers!
csharp-sdk/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs
Line 358 in 330e526
csharp-sdk/src/ModelContextProtocol/Protocol/Transport/HttpListenerSseServerTransport.cs
Line 46 in 330e526
The text was updated successfully, but these errors were encountered: