Skip to content

.Net: Bug: MCP SSE Server and Semantic Kernel, DI, Blazor #12060

Open
@mhackermsft

Description

@mhackermsft

Describe the bug
I have a Blazor Server app where I am registering SK as a singleton so it can be easily used within my application. I configure it with AzureOpenAIChatCompletion and AzureOpenAITextEmbeddingGeneration. Running the app, this works perfectly.

I now want to add in MCPClient capabilities. I read MCPServer configuration data from my appsettings.json file. I do a foreach over all of the settings and then create an MCPClient for each and then add them to the SK Plugins collection. All of this seems to work fine.

The issue: If I have an SSE MCPServer configured, SK will only call it once properly and get results. If a user asks a question that triggers the tool / MCPServer a second time the connection the MCPServer hangs and times out.

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/mhackermsft/SKMCPDemo and deploy the MCPServerFunction to Azure Function (Linux)
  2. Clone https://github.com/mhackermsft/BlazorAIChat and configure the appsettings.json to use Azure OpenAI gpt-4o or gpt4.1 models. Configure the MCPServer section in appsettings.json to reference the MCPServer deployed to Azure Functions.
  3. Run the BlazorAIChat application, start a new chat, ask a question about the weather in Detroit. You should get a proper weather report.
  4. In the same chat session, ask about the weather in Boston. This time the application will hang until the attempted call to the MCP Server times out. The AI Assistant will mention that there was a technical issue.

Expected behavior
Multiple requests for weather information in one or more chat sessions should work without timing out.

Screenshots
n/a

Platform

  • Language: C#
  • Source: Nuget 1.49.0
  • AI model: gpt-4.1
  • IDE: Visual Studio
  • OS: Windows

Additional context
STDIO MCP Servers seem to work fine over and over. Only multiple calls to SSE servers tend to cause a timeout. The MCP Server appears to always be functional and that this is a client side problem.

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't working

Type

Projects

Status

Sprint: Planned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions