ed-mcp: document the tvOS stdio limitation in the public API
Address siGit Code Review feedback on PR #37: callers building an MCP client on tvOS see Transport::Stdio as a regular variant and only learn that the OS forbids child processes when the runtime errors out. Surface that in the rustdoc so the limitation is discoverable before shipping. - Transport::Stdio: note that tvOS cannot spawn child processes and point at Transport::Http as the supported alternative. - Connection::connect / connect_with: add # Errors sections calling out the tvOS-specific failure and the per-stage timeout for spawn, handshake and tools/list on every platform. Co-Authored-By: siGit Code v1.6.8-acp <noreply@sigit.si>
Seto Elkahfi committed
Oct 14, 2026 at 22:34 UTC
5e97a83559766be7a170e7edb67f65cdfc01fe64
1 file changed
+26
crates/ed-mcp/src/lib.rs
+26
@@ -142,6 +142,14 @@ impl ClientInfo {
142
#[derive(Clone)]
143
pub enum Transport {
144
/// Start `command args…` with extra environment variables and talk over its stdio.
145
+ ///
146
+ /// Stdio is only available on platforms that can spawn a child process.
147
+ /// On `target_os = "tvos"` the OS does not allow apps to create other
148
+ /// processes, so this variant is **not** supported on tvOS builds: the
149
+ /// matching arm in [`Connection::connect_with`] returns an error at
150
+ /// runtime instead of compiling out the variant. Use [`Transport::Http`]
151
+ /// for tvOS; if you only know the transport at runtime, branch on the
152
+ /// current `target_os` before constructing a `Stdio` spec.
153
Stdio {
154
command: PathBuf,
155
args: Vec<String>,
@@ -315,12 +323,30 @@ pub struct Connection {
323
324
impl Connection {
325
/// Connect to `spec`, run the handshake and list its tools, each within `timeout`.
326
+ ///
327
+ /// # Errors
328
+ ///
329
+ /// - On tvOS, connecting a `Transport::Stdio` spec always fails with a
330
+ /// "this platform can't run MCP servers as processes" error — tvOS does
331
+ /// not allow child processes. Use [`Transport::Http`] on that target.
332
+ /// - On every platform, spawning the child, completing the handshake and
333
+ /// listing tools are each independently bounded by `timeout` and may
334
+ /// fail or time out.
335
pub async fn connect(spec: &ServerSpec, info: &ClientInfo, timeout: Duration) -> Result<Self> {
336
Self::connect_with(spec, info, None, timeout).await
337
}
338
339
/// Connect to `spec`, with an optional [`Elicitation`] hook for server-initiated
340
/// `elicitation/create` requests. [`Connection::connect`] is this with no hook.
341
+ ///
342
+ /// # Errors
343
+ ///
344
+ /// - On tvOS, connecting a `Transport::Stdio` spec always fails with a
345
+ /// "this platform can't run MCP servers as processes" error — tvOS does
346
+ /// not allow child processes. Use [`Transport::Http`] on that target.
347
+ /// - On every platform, spawning the child, completing the handshake and
348
+ /// listing tools are each independently bounded by `timeout` and may
349
+ /// fail or time out.
350
pub async fn connect_with(
351
spec: &ServerSpec,
352
info: &ClientInfo,