StdioTransport class final
Runs an MCP server as a child process and speaks to it over stdio.
final transport = await StdioTransport.spawn(
executable: 'npx',
arguments: ['-y', '@modelcontextprotocol/server-filesystem', '/data'],
);
- Implemented types
Constructors
- StdioTransport.attach(Process process, {String name = 'stdio'})
-
Connects to an already-running
process.factory
Properties
-
exitCode
→ Future<
int> -
Completes with the child's exit code.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
incoming
→ Stream<
JsonMap> -
Messages arriving from the peer.
no setteroverride
- isOpen → bool
-
Whether the transport is still usable.
no setteroverride
- name → String
-
A short name for logs and errors, such as
stdioorhttp.final - pid → int
-
The child's process identifier.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stderrLines
→ Stream<
String> -
Whatever the server wrote to stderr.
no setter
Methods
-
dispose(
) → Future< void> - Releases every resource held by this object.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
JsonMap message) → Future< void> -
Sends
messageto the peer.override -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited