Skip to content

MCPServer Redeployment causes this behavior "Error sending message: 404" in MCPClient #2785

Open
@dilipsundarraj1

Description

@dilipsundarraj1

Bug Report

Bug description

I have a MCP Server and the MCP client built. First, I spin up the MCP Server and then the MCP client. My client app interacts with the MCP server and works fine.
However, when I restart or redeploy the MCP Server, the client app interacts with the MCP server, and I observe the following error:

2025-04-17T11:02:40.637-05:00 ERROR 14929 --- [onPool-worker-3] i.m.c.t.HttpClientSseClientTransport : Error sending message: 404 

Detailed Error

2025-04-17T11:02:39.088-05:00 INFO 14929 --- [nio-8086-exec-4] com.llm.controller.ChatsController : userInput message : UserInput(prompt=Find me all the phones ?) 2025-04-17T11:02:39.088-05:00 INFO 14929 --- [nio-8086-exec-4]  

com.llm.controller.ChatsController : requestSpec : org.springframework.ai.chat.client.DefaultChatClient$DefaultChatClientRequestSpec@2f15ab7e 2025-04-17T11:02:39.088-05:00 INFO 14929 --- [nio-8086-exec-4] com.llm.controller.ChatsController : responseSpec1 : org.springframework.ai.chat.client.DefaultChatClient$DefaultCallResponseSpec@21d250ec 2025-04-17T11:02:40.132-05:00 DEBUG 14929 --- [nio-8086-exec-4] o.s.a.m.tool.DefaultToolCallingManager : Executing tool call: spring_ai_mcp_client_person_mcp_server_getAllProducts 

2025-04-17T11:02:40.637-05:00 ERROR 14929 --- [onPool-worker-3] i.m.c.t.HttpClientSseClientTransport : Error sending message: 404 

2025-04-17T11:06:40.155-05:00 ERROR 14929 --- [nio-8086-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: reactor.core.Exceptions$ReactiveException: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 240000ms in 'source(MonoCreate)' (and no fallback has been configured)] with root cause


Environment

  • Spring AI version: 1.0.0-M7
  • Java version: 21
  • Vector Store: [Provide details if used, or leave blank]

Steps to reproduce

  1. Spin up the MCP Server.
  2. Spin up the MCP client and interact with the MCP Server (this works fine).
  3. Restart or redeploy the MCP Server.
  4. Have the MCP client interact with the MCP server again.
  5. Observe the error.

Expected behavior

I expected the MCP client to interact with the MCP server successfully after the server restart, without any errors.

Minimal Complete Reproducible example

You can view the complete example in my GitHub repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions