-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Bug: ModelContextProtocol.McpException: Transport is not connected #11649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @hemantkathuria, it's quite difficult to tell what is going on without having the code. Please create a console app that reproduces this behavior and share it with us so we can start investigating. The first thing to look at would be the disposed McpClient that your app cached/keeps a reference to for accessing the McpServer. |
Link to the same issue in MCP C# repo - modelcontextprotocol/csharp-sdk#333 |
Hello @SergeyMenshykh `// Add Kernel string mcpServerUrl = builder.Configuration.GetSection("MCPClient").GetValue("MCPSSEServerUrl"); await AddTools(mcpServerUrl, kernelBuilder); //Add Azure Open AI builder.Services.AddTransient((sp) =>
}); // Register IStorage. For development, MemoryStorage is suitable. var app = builder.Build(); app.MapGet("/", () => "Hello Agent!"); app.UseStaticFiles(); app.UseDeveloperExceptionPage(); app.MapControllers();//.AllowAnonymous(); app.Run(); /// /// Creates an MCP client and connects it to the MCPServer server. /// /// An instance of . static Task CreateSSeMcpClientAsync(string mcpServerUrl) {
} static async Task AddTools(string mcpServerUrl, IKernelBuilder kernelBuilder)
}` |
Add Mcp Tools and keep on getting the below error randomly
fail: Microsoft.SemanticKernel.KernelFunction[0]
Function Tools-GetCropHealthParameters failed. Error: Transport is not connected
ModelContextProtocol.McpException: Transport is not connected
at ModelContextProtocol.Shared.McpSession.SendRequestAsync(JsonRpcRequest request, CancellationToken cancellationToken)
at ModelContextProtocol.McpEndpointExtensions.SendRequestAsync[TParameters,TResult](IMcpEndpoint endpoint, String method, TParameters parameters, JsonTypeInfo
1 parametersTypeInfo, JsonTypeInfo
1 resultTypeInfo, Nullable1 requestId, CancellationToken cancellationToken) at ModelContextProtocol.Client.McpClientTool.InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken) at Microsoft.SemanticKernel.ChatCompletion.AIFunctionKernelFunction.InvokeCoreAsync(Kernel kernel, KernelArguments arguments, CancellationToken cancellationToken) at Microsoft.SemanticKernel.KernelFunction.<>c__DisplayClass31_0.<<InvokeAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.SemanticKernel.Kernel.InvokeFilterOrFunctionAsync(NonNullCollection
1 functionFilters, Func2 functionCallback, FunctionInvocationContext context, Int32 index) at Microsoft.SemanticKernel.Kernel.OnFunctionInvocationAsync(KernelFunction function, KernelArguments arguments, FunctionResult functionResult, Boolean isStreaming, Func
2 functionCallback, CancellationToken cancellationToken)at Microsoft.SemanticKernel.KernelFunction.InvokeAsync(Kernel kernel, KernelArguments arguments, CancellationToken cancellationToken)
The text was updated successfully, but these errors were encountered: