Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

3.3 KB
Raw Blame
---
title: stdio
sidebarTitle: stdio
---

# `fastmcp.client.transports.stdio`

## Classes

### `StdioTransport` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Base transport for connecting to an MCP server via subprocess with stdio.

This is a base class that can be subclassed for specific command-based
transports like Python, Node, Uvx, etc.


**Methods:**

#### `connect_session` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L79" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncGenerator[ClientSession, None]
```

#### `connect` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L98" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
connect(self, **session_kwargs: Unpack[SessionKwargs]) -> ClientSession | None
```

#### `disconnect` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L188" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
disconnect(self)
```

#### `close` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L238" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
close(self)
```

### `PythonStdioTransport` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L316" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Transport for running Python scripts.


### `FastMCPStdioTransport` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L374" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Transport for running FastMCP servers using the FastMCP CLI.

`args` are passed to the server script, not interpreted as FastMCP CLI options.


### `NodeStdioTransport` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L414" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Transport for running Node.js scripts.


### `UvStdioTransport` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L467" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Transport for running commands via the uv tool.


### `UvxStdioTransport` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L544" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Transport for running commands via the uvx tool.


### `NpxStdioTransport` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/client/transports/stdio.py#L609" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>


Transport for running commands via the npx tool.