transport

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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