Skip to content

mcp.connect_stdio

mcp.connect_stdio(spec) -> McpClient

Spawn spec.command and connect over its stdin/stdout. Raises on a connect failure (the program is missing, or the handshake fails).

Parameters

  • spec: {command: {[integer]: string}, env: {[string]: string}?}
    • command — The argv to execute, e.g. { "uvx", "mcp-server-time" }: the first element is the program, the rest its arguments.
    • env — Extra environment variables set for the child, atop the inherited environment.

Returns