stdio

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package stdio provides a standard I/O implementation of the MCP transport.

This package implements the Transport interface using standard input and output, suitable for CLI applications and direct LLM integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport added in v1.2.0

type Transport struct {
	transport.BaseTransport
	// contains filtered or unexported fields
}

Transport implements the transport.Transport interface for Standard I/O.

func NewTransport added in v1.2.0

func NewTransport() *Transport

NewTransport creates a new Standard I/O transport. By default, it uses os.Stdin and os.Stdout.

func NewTransportWithIO added in v1.2.0

func NewTransportWithIO(in io.Reader, out io.Writer) *Transport

NewTransportWithIO creates a new Standard I/O transport with custom io.Reader and io.Writer. This is particularly useful for testing or custom I/O streams.

func (*Transport) Initialize added in v1.2.0

func (t *Transport) Initialize() error

Initialize initializes the transport.

func (*Transport) Receive added in v1.2.0

func (t *Transport) Receive() ([]byte, error)

Receive is not implemented for stdio transport as it uses the readLoop.

func (*Transport) Send added in v1.2.0

func (t *Transport) Send(message []byte) error

Send sends a message over stdout.

func (*Transport) SetNewline added in v1.2.0

func (t *Transport) SetNewline(newline bool)

SetNewline configures whether to append a newline to each sent message.

func (*Transport) Start added in v1.2.0

func (t *Transport) Start() error

Start starts the transport, beginning to read from stdin.

func (*Transport) Stop added in v1.2.0

func (t *Transport) Stop() error

Stop stops the transport, closing the done channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL