pub trait HttpServerAdapter: Send + Sync {
// Required method
fn start<'life0, 'async_trait>(
&'life0 self,
config: HttpServerConfig,
protocol: Arc<dyn ToolProtocol>,
) -> Pin<Box<dyn Future<Output = Result<HttpServerInstance, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn name(&self) -> &str { ... }
}Expand description
Trait for HTTP server implementations
Implementations of this trait provide HTTP endpoints for MCP protocols. Different HTTP frameworks can be swapped by implementing this trait.
Required Methods§
Sourcefn start<'life0, 'async_trait>(
&'life0 self,
config: HttpServerConfig,
protocol: Arc<dyn ToolProtocol>,
) -> Pin<Box<dyn Future<Output = Result<HttpServerInstance, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
config: HttpServerConfig,
protocol: Arc<dyn ToolProtocol>,
) -> Pin<Box<dyn Future<Output = Result<HttpServerInstance, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the HTTP server with the given configuration and tool protocol
§Arguments
config- Server configuration (address, auth, IP filtering)protocol- The ToolProtocol implementation to expose
§Endpoints
The server must provide the following endpoints:
POST /tools/list- List all available tools from the protocolPOST /tools/execute- Execute a tool with given parametersPOST /resources/list- List all available resources (if protocol supports)POST /resources/read- Read a resource by URI (if protocol supports)
§Returns
A running server instance, or an error if startup fails