First of all, you should create a servlet and register the MCP server's HTTP handler. The SDK provides a servlet class for this purpose. Add this to your web application:
@WebServlet("/msg/*")
public class McpServlet extends HttpServlet {
private final McpSyncServer server = MyMcpServer.create();
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) {
server.handleRequest(req, resp);
}
}
If you're not using @WebServlet annotation, register it in your web.xml:
<servlet>
<servlet-name>mcpServlet</servlet-name>
<servlet-class>com.yourpackage.McpServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mcpServlet</servlet-name>
<url-pattern>/msg/*</url-pattern>
</servlet-mapping>
The main thing is that HttpServletSseServerTransportProvider creates a transport that needs to be hooked into your servlet container's request handling pipeline. I am sure it should work perfectly now. Let me know in comments if you face same issue, I will guide you furthermore