-
Couldn't load subscription status.
- Fork 548
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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!
| public static IMcpServerBuilder WithHttpListenerSseServerTransport(this IMcpServerBuilder builder) |
csharp-sdk/src/ModelContextProtocol/Protocol/Transport/HttpListenerSseServerTransport.cs
Line 46 in 330e526
| public HttpListenerSseServerTransport(string serverName, int port, ILoggerFactory loggerFactory) |
yanshudan
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working