# `Snodo.Client.Stdio`
[🔗](https://github.com/joshrotenberg/snodo/blob/v0.3.1/lib/snodo/client/stdio.ex#L1)

Stdio transport for `Snodo.Client.connect({:stdio, command, args}, opts)`.

A process owns a `Port` running `command`. It writes one JSON-RPC message per
line to the server's stdin and reads newline-delimited messages from its
stdout. The server's stderr is not captured. Responses are correlated by ID,
so any number of processes can share one client and have requests in flight
at once.

Options:

  * `:env` - extra environment variables, as `{name, value}` string pairs.
    A `nil` value unsets the variable.
  * `:cd` - the working directory for the command.
  * `:max_line_bytes` - the largest response line to accept, default 16 MiB.
    The rest of a longer line is discarded as it arrives, so the request it
    answered times out; later responses are unaffected.

The connection process monitors the process that called `connect/2` and
closes when it exits. When a request times out, the transport answers the
caller with a -32001 error and sends the server `notifications/cancelled` for
that request ID. When the server exits, requests in flight and later requests
fail with -32000. Server-to-client requests are answered with -32601.

A `notifications/progress` whose token belongs to a request made with
`progress:` is forwarded to the process waiting on that request, which calls
the progress function; with `reset_timeout_on_progress: true` the connection
process also restarts the request's timer. Other server notifications are
dropped. If the progress function raises, the request is cancelled on the
server.

`close/1` closes the server's stdin. An MCP stdio server exits at EOF after
finishing admitted requests; this transport does not signal or kill it.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
