# `Mead.MCP.Transport.Stdio`
[🔗](https://github.com/albertosca/mead/blob/main/lib/mead/mcp/transport/stdio.ex#L1)

Runs an MCP server as a child process and talks to it over its standard input and output, one
JSON message per line.

## Options

  * `:command` - the executable, looked up on the `PATH` (required).
  * `:arguments` - a list of binaries; defaults to `[]`.
  * `:maximum_message_bytes` - the longest message accepted; defaults to 4 MiB. A longer one
    closes the transport with `:message_too_large` instead of growing without bound.
  * `:exit_grace_milliseconds` - how long a child gets to leave after its stdin closes before it
    is sent `SIGTERM`; defaults to 1 000. A child that is still alive 500 ms after `SIGTERM`
    receives `SIGKILL`.

The child's standard error is not read: it goes to the terminal of the Erlang VM, which keeps
the progress chatter that tools such as `npx` print out of the protocol stream.

`Port.close/1` does not end the child, so stopping this transport closes stdin (which makes a
well-behaved server exit) and then signals the child that stays. A server started through a
wrapper such as `npx` may leave a grandchild that shares the wrapper's stdin and ends with it;
a grandchild that ignores stdin closing is not tracked.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

---

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