mcp_langbase_reasoning/lib.rs
1//! # MCP Langbase Reasoning Server
2//!
3//! A Model Context Protocol (MCP) server that provides structured reasoning capabilities
4//! by delegating to Langbase Pipes for LLM-powered cognitive processing.
5//!
6//! ## Features
7//!
8//! - **Linear Reasoning**: Sequential step-by-step thought processing
9//! - **Tree Reasoning**: Branching exploration with multiple reasoning paths
10//! - **Divergent Reasoning**: Creative exploration with multiple perspectives
11//! - **Reflection**: Meta-cognitive analysis and quality improvement
12//! - **Backtracking**: Checkpoint-based state restoration for exploration
13//! - **Auto Routing**: Intelligent mode selection based on content analysis
14//! - **Graph-of-Thoughts (GoT)**: Advanced graph-based reasoning with scoring and pruning
15//! - **Bias & Fallacy Detection**: Cognitive bias and logical fallacy identification
16//! - **Workflow Presets**: Composable multi-step reasoning workflows
17//! - **Self-Improvement**: Autonomous system health monitoring and optimization
18//!
19//! ## Architecture
20//!
21//! ```text
22//! MCP Client → MCP Server (Rust) → Langbase Pipes (HTTP)
23//! ↓
24//! SQLite (State)
25//! ```
26//!
27//! ## Example
28//!
29//! ```ignore
30//! use std::sync::Arc;
31//! use mcp_langbase_reasoning::{Config, AppState, McpServer};
32//! use mcp_langbase_reasoning::langbase::LangbaseClient;
33//! use mcp_langbase_reasoning::storage::SqliteStorage;
34//!
35//! #[tokio::main]
36//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
37//! let config = Config::from_env()?;
38//! let storage = SqliteStorage::new(&config.database_path).await?;
39//! let langbase = LangbaseClient::new(&config)?;
40//! let state = Arc::new(AppState::new(config, storage, langbase));
41//! let server = McpServer::new(state);
42//! server.run().await?;
43//! Ok(())
44//! }
45//! ```
46
47#![warn(missing_docs)]
48
49/// Configuration management for the MCP server.
50pub mod config;
51/// Error types and result aliases for the application.
52pub mod error;
53/// Langbase API client and types for pipe communication.
54pub mod langbase;
55/// Reasoning mode implementations (linear, tree, divergent, etc.).
56pub mod modes;
57/// Workflow preset system for composable reasoning workflows.
58pub mod presets;
59/// System prompts for Langbase pipes.
60pub mod prompts;
61/// MCP server implementation and request handling.
62pub mod server;
63/// SQLite storage layer for persistence.
64pub mod storage;
65/// Self-improvement system for autonomous optimization.
66pub mod self_improvement;
67
68pub use config::Config;
69pub use error::{AppError, AppResult};
70pub use server::{AppState, McpServer, SharedState};