Skip to main content

run_hyper_server

Function run_hyper_server 

Source
pub async fn run_hyper_server(
    server: &CratesDocsServer,
    config: HyperServerConfig,
) -> Result<()>
Expand description

Run a Hyper-based MCP server with the given configuration.

This function handles HTTP, SSE, and Hybrid servers based on the configuration.

§Arguments

  • server - CratesDocsServer instance
  • config - HyperServerConfig instance

§Errors

Returns error if server startup fails

§Example

use crates_docs::server::transport::{run_hyper_server, HyperServerConfig};
use crates_docs::{AppConfig, CratesDocsServer};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = AppConfig::default();
    let server = CratesDocsServer::new(config)?;
    let http_config = HyperServerConfig::http();
    run_hyper_server(&server, http_config).await?;
    Ok(())
}