Skip to main content
Version: 1.1.0 (latest)

Server Architecture

rust-mcp-sdk provides two levels of server handler abstraction.

Handler Traitsโ€‹

TraitUse Case
ServerHandlerRecommended - override only the methods you need
ServerHandlerCoreAdvanced - three raw methods for full control

McpServer Traitโ€‹

The McpServer trait is injected into every handler method via Arc<dyn McpServer>, providing:

  • server_info() - server identity and capabilities
  • client_info() - connected client details
  • session_id() - session identifier (HTTP backends)
  • auth_info() - current authentication data
  • task_store() / client_task_store() - MCP Tasks support
  • request_message_creation() - LLM sampling requests
  • request_elicitation() - user input elicitation
  • notify_*() methods - send notifications to the client

Server Runtimesโ€‹

TransportFunction
Stdioserver_runtime::create_server() or server_runtime_core::create_server()
Streamable HTTP (Axum)create_axum_server()
Streamable HTTP (Actix)create_actix_server()