|
| | Server (ServerOptions options) |
| | Constructs a server from explicit options.
|
| |
|
| ~Server () |
| | Stops transports and task workers before owned registries vanish.
|
| |
|
| Server (const Server &)=delete |
| |
|
Server & | operator= (const Server &)=delete |
| |
|
| Server (Server &&) noexcept |
| |
|
Server & | operator= (Server &&) noexcept |
| |
|
ServerInfo | get_info () const |
| | Returns server metadata advertised during initialization.
|
| |
|
const protocol::ServerCapabilities & | capabilities () const noexcept |
| | Returns the capabilities advertised to clients.
|
| |
|
ToolRegistry & | tools () noexcept |
| | Returns the mutable tool registry.
|
| |
|
const ToolRegistry & | tools () const noexcept |
| | Returns the tool registry.
|
| |
|
std::vector< protocol::ToolDefinition > | list_tools () const |
| | Lists registered tool definitions.
|
| |
|
core::Result< protocol::ToolsListResult > | list_tools (const protocol::PaginatedRequestParams ¶ms, const SessionContext &context) const |
| | Handles a paginated tools/list request.
|
| |
|
core::Result< protocol::ToolDefinition > | get_tool (std::string_view name) const |
| | Gets a registered tool definition by name.
|
| |
| core::Result< protocol::ToolResult > | call_tool (std::string_view name, protocol::Json arguments=protocol::Json::object(), const std::string &session_id={}) const |
| | Invokes a registered tool.
|
| |
|
core::Result< protocol::ToolResult > | call_tool (std::string_view name, protocol::Json arguments, const SessionContext &context, CancellationToken cancellation=CancellationToken::none()) const |
| |
|
Server & | use_task_manager (TaskOperationProcessorOptions options={}) |
| | Enables the built-in SDK task processor.
|
| |
|
Server & | use_task_manager (std::shared_ptr< TaskOperationProcessor > processor) |
| | Installs a caller-owned task processor shared with this server.
|
| |
|
std::shared_ptr< TaskOperationProcessor > | task_manager () const noexcept |
| | Returns the installed task processor, if any.
|
| |
|
PromptRegistry & | prompts () noexcept |
| | Returns the mutable prompt registry.
|
| |
|
const PromptRegistry & | prompts () const noexcept |
| | Returns the prompt registry.
|
| |
|
std::vector< protocol::Prompt > | list_prompts () const |
| | Lists registered prompts.
|
| |
|
core::Result< protocol::PromptsListResult > | list_prompts (const protocol::PaginatedRequestParams ¶ms, const SessionContext &context) const |
| | Handles a paginated prompts/list request.
|
| |
| core::Result< protocol::PromptsGetResult > | get_prompt (std::string_view name, protocol::Json arguments=protocol::Json::object(), const std::string &session_id={}) const |
| | Gets a registered prompt result.
|
| |
|
core::Result< protocol::PromptsGetResult > | get_prompt (std::string_view name, protocol::Json arguments, const SessionContext &context, CancellationToken cancellation=CancellationToken::none()) const |
| |
|
ResourceRegistry & | resources () noexcept |
| | Returns the mutable resource registry.
|
| |
|
const ResourceRegistry & | resources () const noexcept |
| | Returns the resource registry.
|
| |
|
std::vector< protocol::Resource > | list_resources () const |
| | Lists registered resources.
|
| |
|
core::Result< protocol::ResourcesListResult > | list_resources (const protocol::PaginatedRequestParams ¶ms, const SessionContext &context) const |
| | Handles a paginated resources/list request.
|
| |
| core::Result< protocol::ResourcesReadResult > | read_resource (std::string_view uri, protocol::Json params=protocol::Json::object(), const std::string &session_id={}) const |
| | Reads a registered resource.
|
| |
|
core::Result< protocol::ResourcesReadResult > | read_resource (std::string_view uri, protocol::Json params, const SessionContext &context, CancellationToken cancellation=CancellationToken::none()) const |
| |
|
ResourceTemplateRegistry & | resource_templates () noexcept |
| | Returns the mutable resource-template registry.
|
| |
|
const ResourceTemplateRegistry & | resource_templates () const noexcept |
| | Returns the resource-template registry.
|
| |
|
std::vector< protocol::ResourceTemplate > | list_resource_templates () const |
| | Lists registered resource templates.
|
| |
|
core::Result< protocol::ResourceTemplatesListResult > | list_resource_templates (const protocol::PaginatedRequestParams ¶ms, const SessionContext &context) const |
| | Handles a paginated resources/templates/list request.
|
| |
|
core::Result< protocol::Json > | initialize () |
| | Builds the JSON result for an initialize request.
|
| |
| core::Result< protocol::Json > | ping (const SessionContext &context={}) |
| | Handles a ping request.
|
| |
| core::Result< protocol::JsonRpcResponse > | handle_request (const protocol::JsonRpcRequest &request, const SessionContext &context) |
| | Dispatches an inbound JSON-RPC request from a transport.
|
| |
| core::Result< SessionContext > | authenticate_context (const SessionContext &context) |
| | Applies the configured AuthProvider to a session context.
|
| |
|
core::Result< core::Unit > | handle_notification (const protocol::JsonRpcNotification ¬ification, const SessionContext &context) |
| | Dispatches an inbound JSON-RPC notification from a transport.
|
| |
|
core::Result< core::Unit > | notify_roots_list_changed () |
| | Notifies connected clients that roots changed.
|
| |
|
core::Result< core::Unit > | notify_tool_list_changed () |
| | Notifies connected clients that the tool list changed.
|
| |
|
core::Result< core::Unit > | notify_prompt_list_changed () |
| | Notifies connected clients that the prompt list changed.
|
| |
|
core::Result< core::Unit > | notify_resource_list_changed () |
| | Notifies connected clients that the resource list changed.
|
| |
| core::Result< core::Unit > | notify_resource_updated (std::string_view uri) |
| | Notifies subscribed clients that a resource URI was updated.
|
| |
|
core::Result< core::Unit > | set_resource_subscription (const SessionContext &context, std::string_view uri, bool subscribed) |
| | Updates resource subscription routing for a transport session.
|
| |
|
core::Result< core::Unit > | notify_progress (const protocol::ProgressNotificationParams ¶ms) |
| | Sends a progress notification to connected clients.
|
| |
|
core::Result< core::Unit > | notify_logging_message (const protocol::LoggingMessageNotificationParams ¶ms) |
| | Sends a logging message notification to connected clients.
|
| |
| core::Result< core::Unit > | notify_elicitation_complete (std::string elicitation_id) |
| | Sends an elicitation-complete notification.
|
| |
|
core::Result< core::Unit > | notify_task_status (const protocol::Task &task) |
| | Sends a task status notification.
|
| |
| core::Result< protocol::CreateTaskResult > | enqueue_task (const protocol::Task &task) |
| | Sends a server-to-client request to create a new task.
|
| |
| core::Result< core::Unit > | add_transport (std::unique_ptr< Transport > transport) |
| | Adds a transport owned by the server.
|
| |
| core::Result< core::Unit > | add_session_transport (Transport &transport) |
| | Registers a borrowed session transport for outbound server events.
|
| |
|
void | set_auth_provider (std::unique_ptr< AuthProvider > auth_provider) |
| | Installs an authentication provider used by supported transports.
|
| |
|
void | set_rate_limiter (std::unique_ptr< RateLimiter > rate_limiter) |
| | Installs a rate limiter used by supported transports.
|
| |
|
void | set_schema_validator (std::shared_ptr< const JsonSchemaValidator > validator) |
| | Installs an optional JSON Schema validator.
|
| |
|
std::shared_ptr< const JsonSchemaValidator > | schema_validator () const noexcept |
| | Returns the configured JSON Schema validator, if any.
|
| |
|
core::Result< core::Unit > | start () |
| | Starts every registered transport.
|
| |
|
void | stop () noexcept |
| | Stops all transports.
|
| |
|
void | set_completion_handler (JsonHandler handler) |
| | Registers the completion request handler.
|
| |
|
void | set_completion_handler (JsonContextHandler handler) |
| |
|
void | set_completion_handler (JsonRequestContextHandler handler) |
| |
|
void | set_sampling_handler (JsonHandler handler) |
| | Registers the sampling request handler.
|
| |
|
void | set_sampling_handler (JsonContextHandler handler) |
| |
|
void | set_sampling_handler (JsonRequestContextHandler handler) |
| |
|
void | set_logging_handler (LoggingHandler handler) |
| | Registers the logging notification handler.
|
| |
|
void | set_raw_request_handler (RawRequestHandler handler) |
| | Registers a raw request hook.
|
| |
|
void | set_raw_request_handler (RawRequestContextHandler handler) |
| |
|
const RawRequestHandler & | raw_request_handler () const noexcept |
| | Returns the registered raw request handler, if any.
|
| |
|
const RawRequestContextHandler & | raw_request_context_handler () const noexcept |
| | Returns the registered raw request context handler, if any.
|
| |
|
void | set_raw_notification_handler (RawNotificationHandler handler) |
| | Registers a raw notification hook.
|
| |
|
void | set_custom_request_handler (RawRequestHandler handler) |
| | Registers a custom request handler.
|
| |
|
void | set_custom_request_handler (RawRequestContextHandler handler) |
| |
|
void | set_custom_notification_handler (RawNotificationHandler handler) |
| | Registers a custom notification handler.
|
| |
|
void | set_task_list_handler (TaskListHandler handler) |
| | Registers a task list request handler.
|
| |
|
void | set_tools_list_handler (ToolsListHandler handler) |
| | Registers a tools/list request handler.
|
| |
|
void | set_prompts_list_handler (PromptsListHandler handler) |
| | Registers a prompts/list request handler.
|
| |
|
void | set_resources_list_handler (ResourcesListHandler handler) |
| | Registers a resources/list request handler.
|
| |
|
void | set_resource_templates_list_handler (ResourceTemplatesListHandler handler) |
| | Registers a resources/templates/list request handler.
|
| |
|
void | set_task_get_handler (TaskGetHandler handler) |
| | Registers a task get request handler.
|
| |
|
void | set_task_cancel_handler (TaskCancelHandler handler) |
| | Registers a task cancel request handler.
|
| |
|
void | set_task_result_handler (TaskResultHandler handler) |
| | Registers a task result request handler.
|
| |
|
void | set_progress_handler (ProgressHandler handler) |
| | Registers a progress notification handler.
|
| |
|
void | set_roots_list_changed_handler (RootsListChangedHandler handler) |
| | Registers a roots-list-changed notification handler.
|
| |
|
void | set_tool_list_changed_handler (ListChangedHandler handler) |
| | Registers a tool-list-changed notification handler.
|
| |
|
void | set_prompt_list_changed_handler (ListChangedHandler handler) |
| | Registers a prompt-list-changed notification handler.
|
| |
|
void | set_resource_list_changed_handler (ListChangedHandler handler) |
| | Registers a resource-list-changed notification handler.
|
| |
|
void | set_resource_updated_handler (ResourceUpdatedHandler handler) |
| | Registers a resource-updated notification handler.
|
| |
| Server & | set_handler (const ServerHandler &handler) |
| | Installs every non-empty callback from a ServerHandler aggregate.
|
| |
| Server & | set_handler (const ServerHandlerInterface &handler) |
| | Installs callbacks from a borrowed ServerHandlerInterface contract.
|
| |
| Server & | set_handler (std::shared_ptr< const ServerHandlerInterface > handler) |
| | Installs callbacks from an owned ServerHandlerInterface contract.
|
| |
High-level MCP server compatibility API.
Server owns the configured transports and registries. Register tools, prompts, resources, and resource templates before start(), then use transports to serve JSON-RPC requests. Direct list/get/call/read methods are also available for tests, embedded use, and custom routing. New applications should prefer ServerPeer and Service as their entry points; Server remains a stable embeddable layer and compatibility surface.