@Deprecated public static class McpServer.AsyncSpec extends Object
| Modifier and Type | Method and Description |
|---|---|
McpAsyncServer |
build()
Deprecated.
Builds an asynchronous MCP server that provides non-blocking operations.
|
McpServer.AsyncSpec |
capabilities(McpSchema.ServerCapabilities serverCapabilities)
Deprecated.
Sets the server capabilities that will be advertised to clients during
connection initialization.
|
McpServer.AsyncSpec |
prompts(List<McpServerFeatures.AsyncPromptRegistration> prompts)
Deprecated.
Registers multiple prompts with their handlers using a List.
|
McpServer.AsyncSpec |
prompts(Map<String,McpServerFeatures.AsyncPromptRegistration> prompts)
Deprecated.
Registers multiple prompts with their handlers using a Map.
|
McpServer.AsyncSpec |
prompts(McpServerFeatures.AsyncPromptRegistration... prompts)
Deprecated.
Registers multiple prompts with their handlers using varargs.
|
McpServer.AsyncSpec |
resources(List<McpServerFeatures.AsyncResourceRegistration> resourceRegsitrations)
Deprecated.
Registers multiple resources with their handlers using a List.
|
McpServer.AsyncSpec |
resources(Map<String,McpServerFeatures.AsyncResourceRegistration> resourceRegsitrations)
Deprecated.
Registers multiple resources with their handlers using a Map.
|
McpServer.AsyncSpec |
resources(McpServerFeatures.AsyncResourceRegistration... resourceRegistrations)
Deprecated.
Registers multiple resources with their handlers using varargs.
|
McpServer.AsyncSpec |
resourceTemplates(List<McpSchema.ResourceTemplate> resourceTemplates)
Deprecated.
Sets the resource templates that define patterns for dynamic resource access.
|
McpServer.AsyncSpec |
resourceTemplates(McpSchema.ResourceTemplate... resourceTemplates)
Deprecated.
Sets the resource templates using varargs for convenience.
|
McpServer.AsyncSpec |
rootsChangeConsumer(Function<List<McpSchema.Root>,reactor.core.publisher.Mono<Void>> consumer)
Deprecated.
Registers a consumer that will be notified when the list of roots changes.
|
McpServer.AsyncSpec |
rootsChangeConsumers(Function<List<McpSchema.Root>,reactor.core.publisher.Mono<Void>>... consumers)
Deprecated.
Registers multiple consumers that will be notified when the list of roots
changes using varargs.
|
McpServer.AsyncSpec |
rootsChangeConsumers(List<Function<List<McpSchema.Root>,reactor.core.publisher.Mono<Void>>> consumers)
Deprecated.
Registers multiple consumers that will be notified when the list of roots
changes.
|
McpServer.AsyncSpec |
serverInfo(McpSchema.Implementation serverInfo)
Deprecated.
Sets the server implementation information that will be shared with clients
during connection initialization.
|
McpServer.AsyncSpec |
serverInfo(String name,
String version)
Deprecated.
Sets the server implementation information using name and version strings.
|
McpServer.AsyncSpec |
tool(McpSchema.Tool tool,
Function<Map<String,Object>,reactor.core.publisher.Mono<McpSchema.CallToolResult>> handler)
Deprecated.
Adds a single tool with its implementation handler to the server.
|
McpServer.AsyncSpec |
tools(List<McpServerFeatures.AsyncToolRegistration> toolRegistrations)
Deprecated.
Adds multiple tools with their handlers to the server using a List.
|
McpServer.AsyncSpec |
tools(McpServerFeatures.AsyncToolRegistration... toolRegistrations)
Deprecated.
Adds multiple tools with their handlers to the server using varargs.
|
public McpServer.AsyncSpec serverInfo(McpSchema.Implementation serverInfo)
serverInfo - The server implementation details including name and version.
Must not be null.IllegalArgumentException - if serverInfo is nullpublic McpServer.AsyncSpec serverInfo(String name, String version)
serverInfo(McpSchema.Implementation).name - The server name. Must not be null or empty.version - The server version. Must not be null or empty.IllegalArgumentException - if name or version is null or emptyserverInfo(McpSchema.Implementation)public McpServer.AsyncSpec capabilities(McpSchema.ServerCapabilities serverCapabilities)
serverCapabilities - The server capabilities configuration. Must not be
null.IllegalArgumentException - if serverCapabilities is nullpublic McpServer.AsyncSpec tool(McpSchema.Tool tool, Function<Map<String,Object>,reactor.core.publisher.Mono<McpSchema.CallToolResult>> handler)
McpServerFeatures.AsyncToolRegistration explicitly.
Example usage:
.tool(
new Tool("calculator", "Performs calculations", schema),
args -> Mono.just(new CallToolResult("Result: " + calculate(args)))
)
tool - The tool definition including name, description, and schema. Must
not be null.handler - The function that implements the tool's logic. Must not be null.IllegalArgumentException - if tool or handler is nullpublic McpServer.AsyncSpec tools(List<McpServerFeatures.AsyncToolRegistration> toolRegistrations)
toolRegistrations - The list of tool registrations to add. Must not be
null.IllegalArgumentException - if toolRegistrations is nulltools(McpServerFeatures.AsyncToolRegistration...)public McpServer.AsyncSpec tools(McpServerFeatures.AsyncToolRegistration... toolRegistrations)
Example usage:
.tools(
new McpServerFeatures.AsyncToolRegistration(calculatorTool, calculatorHandler),
new McpServerFeatures.AsyncToolRegistration(weatherTool, weatherHandler),
new McpServerFeatures.AsyncToolRegistration(fileManagerTool, fileManagerHandler)
)
toolRegistrations - The tool registrations to add. Must not be null.IllegalArgumentException - if toolRegistrations is nulltools(List)public McpServer.AsyncSpec resources(Map<String,McpServerFeatures.AsyncResourceRegistration> resourceRegsitrations)
resourceRegsitrations - Map of resource name to registration. Must not be
null.IllegalArgumentException - if resourceRegsitrations is nullresources(McpServerFeatures.AsyncResourceRegistration...)public McpServer.AsyncSpec resources(List<McpServerFeatures.AsyncResourceRegistration> resourceRegsitrations)
resourceRegsitrations - List of resource registrations. Must not be null.IllegalArgumentException - if resourceRegsitrations is nullresources(McpServerFeatures.AsyncResourceRegistration...)public McpServer.AsyncSpec resources(McpServerFeatures.AsyncResourceRegistration... resourceRegistrations)
Example usage:
.resources(
new McpServerFeatures.AsyncResourceRegistration(fileResource, fileHandler),
new McpServerFeatures.AsyncResourceRegistration(dbResource, dbHandler),
new McpServerFeatures.AsyncResourceRegistration(apiResource, apiHandler)
)
resourceRegistrations - The resource registrations to add. Must not be
null.IllegalArgumentException - if resourceRegistrations is nullpublic McpServer.AsyncSpec resourceTemplates(List<McpSchema.ResourceTemplate> resourceTemplates)
Example usage:
.resourceTemplates(
new ResourceTemplate("file://{path}", "Access files by path"),
new ResourceTemplate("db://{table}/{id}", "Access database records")
)
resourceTemplates - List of resource templates. If null, clears existing
templates.#resourceTemplates(ResourceTemplate...)public McpServer.AsyncSpec resourceTemplates(McpSchema.ResourceTemplate... resourceTemplates)
resourceTemplates(List).resourceTemplates - The resource templates to set.resourceTemplates(List)public McpServer.AsyncSpec prompts(Map<String,McpServerFeatures.AsyncPromptRegistration> prompts)
Example usage:
.prompts(Map.of("analysis", new McpServerFeatures.AsyncPromptRegistration(
new Prompt("analysis", "Code analysis template"),
request -> Mono.just(new GetPromptResult(generateAnalysisPrompt(request)))
)));
prompts - Map of prompt name to registration. Must not be null.IllegalArgumentException - if prompts is nullpublic McpServer.AsyncSpec prompts(List<McpServerFeatures.AsyncPromptRegistration> prompts)
prompts - List of prompt registrations. Must not be null.IllegalArgumentException - if prompts is nullprompts(McpServerFeatures.AsyncPromptRegistration...)public McpServer.AsyncSpec prompts(McpServerFeatures.AsyncPromptRegistration... prompts)
Example usage:
.prompts(
new McpServerFeatures.AsyncPromptRegistration(analysisPrompt, analysisHandler),
new McpServerFeatures.AsyncPromptRegistration(summaryPrompt, summaryHandler),
new McpServerFeatures.AsyncPromptRegistration(reviewPrompt, reviewHandler)
)
prompts - The prompt registrations to add. Must not be null.IllegalArgumentException - if prompts is nullpublic McpServer.AsyncSpec rootsChangeConsumer(Function<List<McpSchema.Root>,reactor.core.publisher.Mono<Void>> consumer)
consumer - The consumer to register. Must not be null.IllegalArgumentException - if consumer is nullpublic McpServer.AsyncSpec rootsChangeConsumers(List<Function<List<McpSchema.Root>,reactor.core.publisher.Mono<Void>>> consumers)
consumers - The list of consumers to register. Must not be null.IllegalArgumentException - if consumers is nullpublic McpServer.AsyncSpec rootsChangeConsumers(Function<List<McpSchema.Root>,reactor.core.publisher.Mono<Void>>... consumers)
consumers - The consumers to register. Must not be null.IllegalArgumentException - if consumers is nullpublic McpAsyncServer build()
McpAsyncServer configured with this builder's
settingsCopyright © 2025. All rights reserved.