Skip to content
Discussion options

You must be logged in to vote

You can implement a servlet that extends HTTPServlet and then in your class's service method delegate service call to one of the transport types available from MCP SDK.
Pseudocode -

class myServlet extends HTTPServlet {

private transient HttpServletStreamableServerTransportProvider transport;

 myServlet () {
     transport = HttpServletStreamableServerTransportProvider.builder().mcpEndpoint("/mcp").objectMapper(objMapper).build();

}

@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    transport.service(request, response);
}

}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@skanikdale
Comment options

Answer selected by skanikdale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants