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) 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