Interface McpServer
- All Superinterfaces:
AutoCloseable
Contract for MCP server implementations that are designed to be managed by a
Soklet instance.- Author:
- Mark Allen
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Creates a default MCP server bound to the given port.Provides the MCP CORS authorizer.Provides the MCP handler resolver.Provides the generator used for MCP session IDs.Provides the request admission policy.Provides the request interceptor.Provides the response marshaler used for tool structured content.Provides the session store.voidinitialize(@NonNull SokletConfig sokletConfig, @NonNull McpServer.RequestHandler requestHandler) Initializes the server with Soklet-owned infrastructure.Indicates whether the server has been started.voidstart()Starts the MCP server.voidstop()Stops the MCP server.static @NonNull McpServer.BuilderAcquires a builder configured with the given port.
-
Method Details
-
start
void start()Starts the MCP server. -
stop
void stop()Stops the MCP server. -
isStarted
-
initialize
void initialize(@NonNull SokletConfig sokletConfig, @NonNull McpServer.RequestHandler requestHandler) Initializes the server with Soklet-owned infrastructure.- Parameters:
sokletConfig- the owning Soklet configurationrequestHandler- the request handler callback Soklet will invoke for MCP requests
-
getHandlerResolver
Provides the MCP handler resolver.- Returns:
- the handler resolver
-
getRequestAdmissionPolicy
Provides the request admission policy.- Returns:
- the request admission policy
-
getRequestInterceptor
Provides the request interceptor.- Returns:
- the request interceptor
-
getResponseMarshaler
Provides the response marshaler used for tool structured content.- Returns:
- the response marshaler
-
getCorsAuthorizer
Provides the MCP CORS authorizer.- Returns:
- the CORS authorizer
-
getSessionStore
-
getIdGenerator
Provides the generator used for MCP session IDs.- Returns:
- the session ID generator
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
withPort
Acquires a builder configured with the given port.- Parameters:
port- the port to bind- Returns:
- a new MCP server builder
-
fromPort
-