lean-ctx 3.6.25

Context Runtime for AI Agents with CCP. 63 MCP tools, 10 read modes, 60+ compression patterns, cross-session memory (CCP), persistent AI knowledge with temporal facts + contradiction detection, multi-agent context sharing, LITM-aware positioning, AAAK compact format, adaptive compression with Thompson Sampling bandits. Supports 24+ AI tools. Reduces LLM token consumption by up to 99%.
Documentation
use rmcp::model::{ProgressNotificationParam, ProgressToken};
use rmcp::service::Peer;
use rmcp::RoleServer;

/// Sends MCP progress notifications to the client during long-running tool operations.
#[derive(Clone)]
pub struct ProgressSender {
    peer: Peer<RoleServer>,
    token: ProgressToken,
}

impl ProgressSender {
    pub fn new(peer: Peer<RoleServer>, token: ProgressToken) -> Self {
        Self { peer, token }
    }

    pub fn send(&self, progress: f64, total: Option<f64>, message: Option<String>) {
        let params = ProgressNotificationParam {
            progress_token: self.token.clone(),
            progress,
            total,
            message,
        };
        let peer = self.peer.clone();
        tokio::spawn(async move {
            if let Err(e) = peer.notify_progress(params).await {
                tracing::debug!("[progress] notify failed: {e}");
            }
        });
    }
}

pub type SharedProgressSender = std::sync::Arc<std::sync::Mutex<Option<ProgressSender>>>;