Skip to content

Cannot conect to stateless streamable http mcp server developed using C# SDK using VSCode mcp client #533

Open
@ananthubabu-geodis

Description

@ananthubabu-geodis

Developed and deployed a mcp server exposing majorly prompts and just one tool for testing and is getting the error :

2025-06-20 14:50:02.632 [info] Starting server from LocalProcess extension host
2025-06-20 14:50:02.663 [info] Connection state: Running
2025-06-20 14:50:03.942 [info] Discovered 0 tools
2025-06-20 14:50:04.775 [info] Connection state: Error ; will retry with new session ID

I have provided the options

            .ConfigureServices((_, services) =>
                {
                    services
                        .AddMcpServer(options =>
                        {
                            options.ServerInfo = new Implementation
                            {
                                Name = "Vite MCP Server",
                                Version = "1.0.0"
                            };
                        })
                        .WithHttpTransport(options =>
                        {
                            options.IdleTimeout = TimeSpan.FromMinutes(15);
                            options.MaxIdleSessionCount = 100;
                            options.Stateless = true;
                        })
                        .WithToolsFromAssembly()
                        .WithPromptsFromAssembly();
                });

also in Startup.cs :

            app.UseCors("CorsPolicy");
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapMcp("/mcp");
            });

It works fine in local machine using http ports but not in https.

The hosted server also returns the error.

Could this be because of any certificate issue?

VSCode is my mcp client.

Edit :

This is a certificate issue :

Error from MCP server: TypeError: fetch failed
    at node:internal/deps/undici/undici:13502:13
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async StreamableHTTPClientTransport.send (file:///C:/Users/ananthu.babu/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js:251:30) {
  [cause]: Error: unable to get local issuer certificate
      at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
      at TLSSocket.emit (node:events:518:28)
      at TLSSocket._finishInit (node:_tls_wrap:1078:8)
      at ssl.onhandshakedone (node:_tls_wrap:864:12) {
    code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
  }
}

Any fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions