Class McpErrorBodyFilter
java.lang.Object
com.mcpdbwizard.pub.McpErrorBodyFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
A filter for a generated server's
/mcp/* that rewrites the SDK's transport error bodies --
which carry a full Java stack trace -- into plain JSON-RPC errors. See McpErrorBodies.
Only a response whose status is already 400 or above when its body is first written is buffered; the SDK sets the status before it writes. Everything else, including every successful reply and every SSE stream, goes straight through unbuffered, so streaming is unaffected.
Loaded only by a generated server's HTTP branch, so a stdio deployment never needs the servlet API on its classpath. Copyright 2003-2026 ATB Consultancy Services Ltd (formerly Orinda Software Ltd, Dublin, Ireland)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoFilter(jakarta.servlet.ServletRequest theRequest, jakarta.servlet.ServletResponse theResponse, jakarta.servlet.FilterChain theChain) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.Filter
destroy, init
-
Constructor Details
-
McpErrorBodyFilter
public McpErrorBodyFilter()
-
-
Method Details
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest theRequest, jakarta.servlet.ServletResponse theResponse, jakarta.servlet.FilterChain theChain) throws IOException, jakarta.servlet.ServletException - Specified by:
doFilterin interfacejakarta.servlet.Filter- Throws:
IOExceptionjakarta.servlet.ServletException
-