MCP Stateless Request Handler (server/McpStatelessRequestHandler.java)

java-sdk · mcp-core/src/main/java/io/modelcontextprotocol/server/McpStatelessRequestHandler.java · java · MIT
integration, ai, lang:java, tag:reactive, tag:server, tag:handler

Interface defining a handler contract for processing stateless MCP server requests, returning a reactive Mono response based on transport context and params.

// Source: https://github.com/modelcontextprotocol/java-sdk | License: MIT | Copyright 2025 the original author or authors
// Provided via justclaw.it.com; keep this notice with the code.
/*
 * Copyright 2024-2025 the original author or authors.
 */

package io.modelcontextprotocol.server;

import io.modelcontextprotocol.common.McpTransportContext;
import reactor.core.publisher.Mono;

/**
 * Handler for MCP requests in a stateless server.
 *
 * @param <R> type of the MCP response
 * @author Dariusz Jędrzejczyk
 */
public interface McpStatelessRequestHandler<R> {

	/**
	 * Handle the request and complete with a result.
	 * @param transportContext {@link McpTransportContext} associated with the transport
	 * @param params the payload of the MCP request
	 * @return Mono which completes with t

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key