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
//! # TurboMCP STDIO Transport
//!
//! Standard I/O transport implementation for the TurboMCP Model Context Protocol SDK.
//! This transport uses stdin/stdout for communication, which is the standard way
//! MCP servers communicate with clients.
//!
//! ## MCP Specification Compliance
//!
//! This implementation is **fully compliant** with the MCP stdio transport specification:
//!
//! - **Newline-delimited JSON**: Uses `LinesCodec` for proper message framing
//! - **No embedded newlines**: Validates messages don't contain `\n` or `\r` characters
//! - **UTF-8 encoding**: All messages are UTF-8 encoded (enforced by `std::str::from_utf8`)
//! - **stderr for logging**: Uses `tracing` crate which outputs to stderr by default
//! - **Bidirectional communication**: Supports both client→server and server→client messages
//! - **Valid JSON only**: Validates all messages are well-formed JSON before sending
//!
//! Per MCP spec: "Messages are delimited by newlines, and **MUST NOT** contain embedded newlines."
//!
//! ## Usage
//!
//! ```rust,ignore
//! use turbomcp_stdio::StdioTransport;
//! use turbomcp_transport_traits::Transport;
//!
//! #[tokio::main]
//! async fn main() {
//! let transport = StdioTransport::new();
//! transport.connect().await.unwrap();
//!
//! // Send and receive messages...
//! }
//! ```
pub use ;
// Re-export common types for convenience
pub use ;