1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
//! # TurboMCP Server
//!
//! Production-ready MCP (Model Context Protocol) server implementation with
//! zero-boilerplate development, transport-agnostic design, and WASM support.
//!
//! ## Features
//!
//! - **Zero Boilerplate** - Use `#[server]` and `#[tool]` macros for instant setup
//! - **Transport Agnostic** - STDIO, HTTP, WebSocket, TCP, Unix sockets
//! - **Runtime Selection** - Choose transport at runtime without recompilation
//! - **BYO Server** - Integrate with existing Axum/Tower infrastructure
//! - **WASM Ready** - no_std compatible core for edge deployment
//! - **Graceful Shutdown** - Clean termination with in-flight request handling
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use turbomcp_server::prelude::*;
//!
//! #[derive(Clone)]
//! struct Calculator;
//!
//! #[server(name = "calculator", version = "1.0.0")]
//! impl Calculator {
//! /// Add two numbers together
//! #[tool]
//! async fn add(&self, a: i64, b: i64) -> i64 {
//! a + b
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() {
//! // Simplest: uses STDIO by default
//! Calculator.serve().await.unwrap();
//! }
//! ```
//!
//! ## Runtime Transport Selection
//!
//! ```rust,ignore
//! use turbomcp_server::prelude::*;
//!
//! #[tokio::main]
//! async fn main() {
//! let transport = std::env::var("MCP_TRANSPORT").unwrap_or_default();
//!
//! Calculator.builder()
//! .transport(match transport.as_str() {
//! "http" => Transport::http("0.0.0.0:8080"),
//! "ws" => Transport::websocket("0.0.0.0:8080"),
//! _ => Transport::stdio(),
//! })
//! .serve()
//! .await
//! .unwrap();
//! }
//! ```
//!
//! ## Bring Your Own Server (Axum Integration)
//!
//! ```rust,ignore
//! use axum::Router;
//! use turbomcp_server::prelude::*;
//!
//! #[tokio::main]
//! async fn main() {
//! // Get MCP as an Axum router
//! let mcp = Calculator.builder().into_axum_router();
//!
//! // Merge with your app
//! let app = Router::new()
//! .route("/health", get(|| async { "OK" }))
//! .merge(mcp);
//!
//! let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?;
//! axum::serve(listener, app).await?;
//! }
//! ```
// Note: missing_errors_doc and missing_panics_doc are now workspace-level warnings
// to improve API documentation quality for enterprise adoption
// Core modules
/// Transport implementations for different protocols.
/// Progressive disclosure through component visibility control.
pub use ;
/// Server composition through handler mounting.
pub use CompositeHandler;
/// Typed middleware for MCP request processing.
pub use ;
// Public exports
pub use ;
pub use ;
pub use ;
pub use McpHandlerExt;
pub use ;
// Re-export McpHandler from core for unified architecture
pub use McpHandler;
/// Internal module for macro-generated code.
/// Prelude for easy imports.
///
/// This prelude provides everything needed to build MCP servers:
///
/// # Example
///
/// ```rust,ignore
/// use turbomcp_server::prelude::*;
///
/// #[derive(Clone)]
/// struct MyServer;
///
/// #[server(name = "my-server", version = "1.0.0")]
/// impl MyServer {
/// #[tool]
/// async fn greet(&self, name: String) -> String {
/// format!("Hello, {}!", name)
/// }
/// }
///
/// #[tokio::main]
/// async fn main() {
/// MyServer.serve().await.unwrap();
/// }
/// ```