@Deprecated public static class McpServer.SyncSpec extends Object
| Modifier and Type | Method and Description |
|---|---|
McpSyncServer |
build()
Deprecated.
Builds a synchronous MCP server that provides blocking operations.
|
McpServer.SyncSpec |
capabilities(McpSchema.ServerCapabilities serverCapabilities)
Deprecated.
Sets the server capabilities that will be advertised to clients during
connection initialization.
|
McpServer.SyncSpec |
prompts(List<McpServerFeatures.SyncPromptRegistration> prompts)
Deprecated.
Registers multiple prompts with their handlers using a List.
|
McpServer.SyncSpec |
prompts(Map<String,McpServerFeatures.SyncPromptRegistration> prompts)
Deprecated.
Registers multiple prompts with their handlers using a Map.
|
McpServer.SyncSpec |
prompts(McpServerFeatures.SyncPromptRegistration... prompts)
Deprecated.
Registers multiple prompts with their handlers using varargs.
|
McpServer.SyncSpec |
resources(List<McpServerFeatures.SyncResourceRegistration> resourceRegsitrations)
Deprecated.
Registers multiple resources with their handlers using a List.
|
McpServer.SyncSpec |
resources(Map<String,McpServerFeatures.SyncResourceRegistration> resourceRegsitrations)
Deprecated.
Registers multiple resources with their handlers using a Map.
|
McpServer.SyncSpec |
resources(McpServerFeatures.SyncResourceRegistration... resourceRegistrations)
Deprecated.
Registers multiple resources with their handlers using varargs.
|
McpServer.SyncSpec |
resourceTemplates(List<McpSchema.ResourceTemplate> resourceTemplates)
Deprecated.
Sets the resource templates that define patterns for dynamic resource access.
|
McpServer.SyncSpec |
resourceTemplates(McpSchema.ResourceTemplate... resourceTemplates)
Deprecated.
Sets the resource templates using varargs for convenience.
|
McpServer.SyncSpec |
rootsChangeConsumer(Consumer<List<McpSchema.Root>> consumer)
Deprecated.
Registers a consumer that will be notified when the list of roots changes.
|
McpServer.SyncSpec |
rootsChangeConsumers(Consumer<List<McpSchema.Root>>... consumers)
Deprecated.
Registers multiple consumers that will be notified when the list of roots
changes using varargs.
|
McpServer.SyncSpec |
rootsChangeConsumers(List<Consumer<List<McpSchema.Root>>> consumers)
Deprecated.
Registers multiple consumers that will be notified when the list of roots
changes.
|
McpServer.SyncSpec |
serverInfo(McpSchema.Implementation serverInfo)
Deprecated.
Sets the server implementation information that will be shared with clients
during connection initialization.
|
McpServer.SyncSpec |
serverInfo(String name,
String version)
Deprecated.
Sets the server implementation information using name and version strings.
|
McpServer.SyncSpec |
tool(McpSchema.Tool tool,
Function<Map<String,Object>,McpSchema.CallToolResult> handler)
Deprecated.
Adds a single tool with its implementation handler to the server.
|
McpServer.SyncSpec |
tools(List<McpServerFeatures.SyncToolRegistration> toolRegistrations)
Deprecated.
Adds multiple tools with their handlers to the server using a List.
|
McpServer.SyncSpec |
tools(McpServerFeatures.SyncToolRegistration... toolRegistrations)
Deprecated.
Adds multiple tools with their handlers to the server using varargs.
|
public McpServer.SyncSpec serverInfo(McpSchema.Implementation serverInfo)
serverInfo - The server implementation details including name and version.
Must not be null.IllegalArgumentException - if serverInfo is nullpublic McpServer.SyncSpec 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.SyncSpec capabilities(McpSchema.ServerCapabilities serverCapabilities)
serverCapabilities - The server capabilities configuration. Must not be
null.IllegalArgumentException - if serverCapabilities is nullpublic McpServer.SyncSpec tool(McpSchema.Tool tool, Function<Map<String,Object>,McpSchema.CallToolResult> handler)
McpServerFeatures.SyncToolRegistration explicitly.
Example usage:
.tool(
new Tool("calculator", "Performs calculations", schema),
args -> 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.SyncSpec tools(List<McpServerFeatures.SyncToolRegistration> toolRegistrations)
toolRegistrations - The list of tool registrations to add. Must not be
null.IllegalArgumentException - if toolRegistrations is nulltools(McpServerFeatures.SyncToolRegistration...)public McpServer.SyncSpec tools(McpServerFeatures.SyncToolRegistration... toolRegistrations)
Example usage:
.tools(
new ToolRegistration(calculatorTool, calculatorHandler),
new ToolRegistration(weatherTool, weatherHandler),
new ToolRegistration(fileManagerTool, fileManagerHandler)
)
toolRegistrations - The tool registrations to add. Must not be null.IllegalArgumentException - if toolRegistrations is nulltools(List)public McpServer.SyncSpec resources(Map<String,McpServerFeatures.SyncResourceRegistration> resourceRegsitrations)
resourceRegsitrations - Map of resource name to registration. Must not be
null.IllegalArgumentException - if resourceRegsitrations is nullresources(McpServerFeatures.SyncResourceRegistration...)public McpServer.SyncSpec resources(List<McpServerFeatures.SyncResourceRegistration> resourceRegsitrations)
resourceRegsitrations - List of resource registrations. Must not be null.IllegalArgumentException - if resourceRegsitrations is nullresources(McpServerFeatures.SyncResourceRegistration...)public McpServer.SyncSpec resources(McpServerFeatures.SyncResourceRegistration... resourceRegistrations)
Example usage:
.resources(
new ResourceRegistration(fileResource, fileHandler),
new ResourceRegistration(dbResource, dbHandler),
new ResourceRegistration(apiResource, apiHandler)
)
resourceRegistrations - The resource registrations to add. Must not be
null.IllegalArgumentException - if resourceRegistrations is nullpublic McpServer.SyncSpec 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.SyncSpec resourceTemplates(McpSchema.ResourceTemplate... resourceTemplates)
resourceTemplates(List).resourceTemplates - The resource templates to set.resourceTemplates(List)public McpServer.SyncSpec prompts(Map<String,McpServerFeatures.SyncPromptRegistration> prompts)
Example usage:
Map<String, PromptRegistration> prompts = new HashMap<>();
prompts.put("analysis", new PromptRegistration(
new Prompt("analysis", "Code analysis template"),
request -> new GetPromptResult(generateAnalysisPrompt(request))
));
.prompts(prompts)
prompts - Map of prompt name to registration. Must not be null.IllegalArgumentException - if prompts is nullpublic McpServer.SyncSpec prompts(List<McpServerFeatures.SyncPromptRegistration> prompts)
prompts - List of prompt registrations. Must not be null.IllegalArgumentException - if prompts is nullprompts(McpServerFeatures.SyncPromptRegistration...)public McpServer.SyncSpec prompts(McpServerFeatures.SyncPromptRegistration... prompts)
Example usage:
.prompts(
new PromptRegistration(analysisPrompt, analysisHandler),
new PromptRegistration(summaryPrompt, summaryHandler),
new PromptRegistration(reviewPrompt, reviewHandler)
)
prompts - The prompt registrations to add. Must not be null.IllegalArgumentException - if prompts is nullpublic McpServer.SyncSpec rootsChangeConsumer(Consumer<List<McpSchema.Root>> consumer)
consumer - The consumer to register. Must not be null.IllegalArgumentException - if consumer is nullpublic McpServer.SyncSpec rootsChangeConsumers(List<Consumer<List<McpSchema.Root>>> consumers)
consumers - The list of consumers to register. Must not be null.IllegalArgumentException - if consumers is nullpublic McpServer.SyncSpec rootsChangeConsumers(Consumer<List<McpSchema.Root>>... consumers)
consumers - The consumers to register. Must not be null.IllegalArgumentException - if consumers is nullpublic McpSyncServer build()
McpSyncServer configured with this builder's
settingsCopyright © 2025. All rights reserved.