Class McpRootsListChangedFilter

java.lang.Object
com.xebialabs.xlrelease.mcp.config.McpRootsListChangedFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class McpRootsListChangedFilter extends Object implements jakarta.servlet.Filter
Acknowledges and discards notifications/roots/list_changed before it reaches the MCP servlet.

The SDK's handler for that notification (McpAsyncServer#asyncRootsListChangedNotificationHandler) calls exchange.listRoots() unconditionally — it substitutes a logging consumer when no roots consumers are registered, as is the case here, so the round-trip to the client goes out regardless. The servlet transport handles notifications by blocking the request thread on that result, so a client that announces roots but never answers the roots/list request pins a worker thread for the full request timeout and then logs a TimeoutException. Claude Desktop (through mcp-remote) does exactly that.

Nothing in Release consumes roots, so the notification is answered with 202 and dropped here.

  • Constructor Summary

    Constructors
    Constructor
    Description
    McpRootsListChangedFilter(tools.jackson.databind.json.JsonMapper jsonMapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jakarta.servlet.Filter

    destroy, init
  • Constructor Details

    • McpRootsListChangedFilter

      public McpRootsListChangedFilter(tools.jackson.databind.json.JsonMapper jsonMapper)
  • Method Details

    • doFilter

      public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException
      Specified by:
      doFilter in interface jakarta.servlet.Filter
      Throws:
      IOException
      jakarta.servlet.ServletException