use rmcp::{
handler::server::ServerHandler,
model::{ServerCapabilities, ServerInfo},
};
use rmcp_server_kit::{
config::ObservabilityConfig,
observability::init_tracing_from_config_strict,
transport::{McpServerConfig, serve},
};
#[derive(Clone)]
struct MinimalHandler;
impl ServerHandler for MinimalHandler {
fn get_info(&self) -> ServerInfo {
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
}
}
#[tokio::main(flavor = "multi_thread", worker_threads = 2)]
async fn main() -> rmcp_server_kit::Result<()> {
let mut observability = ObservabilityConfig::default();
observability.log_level = "info,rmcp_server_kit=debug".into();
let _tracing_guard = init_tracing_from_config_strict(&observability)?;
let config = McpServerConfig::new(
"127.0.0.1:8080",
"rmcp-server-kit-minimal-example",
env!("CARGO_PKG_VERSION"),
)
.with_request_timeout(std::time::Duration::from_secs(30))
.enable_request_header_logging();
serve(config.validate()?, || MinimalHandler).await
}