transport

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StdioTransport

type StdioTransport struct {
	// contains filtered or unexported fields
}

StdioTransport implements Transport interface for stdio communication

func NewStdioTransport

func NewStdioTransport() *StdioTransport

NewStdioTransport creates a new stdio transport

func (*StdioTransport) ReadMessage

func (t *StdioTransport) ReadMessage() ([]byte, error)

ReadMessage reads a JSON-RPC message from stdin.

A buffered message always wins over a terminal read error. readLoop can hand off a message and then hit EOF before this runs, leaving msgChan and errChan both ready; a single select over both would pick at random and drop roughly half of the requests whose client closes stdin right after writing. Draining msgChan first makes the last request before EOF arrive reliably.

func (*StdioTransport) Start

func (t *StdioTransport) Start(ctx context.Context) error

Start the stdio transport

func (*StdioTransport) Stop

func (t *StdioTransport) Stop() error

Stop the stdio transport

func (*StdioTransport) WriteMessage

func (t *StdioTransport) WriteMessage(data []byte) error

WriteMessage writes a JSON-RPC message to stdout

type Transport

type Transport interface {
	Start(ctx context.Context) error
	Stop() error
	// ReadMessage returns the next message. An error is terminal: the input is
	// gone and no later call will return a message, so the caller stops reading.
	ReadMessage() ([]byte, error)
	WriteMessage(data []byte) error
}

Transport interface for MCP communication

Jump to

Keyboard shortcuts

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