Documentation
¶
Overview ¶
Package embedded provides an in-process implementation of the MCP transport.
This package implements the Transport interface for direct in-process communication, allowing MCP servers and clients to communicate without network overhead. Ideal for testing, library integration, and embedded use cases.
Index ¶
- func NewTransportPair(options ...Option) (*Transport, *Transport)
- type Option
- type Transport
- func (t *Transport) GetChannelStats() map[string]int
- func (t *Transport) GetMessageHandler() transport.MessageHandler
- func (t *Transport) GetResponseChannel() <-chan []byte
- func (t *Transport) Initialize() error
- func (t *Transport) IsStarted() bool
- func (t *Transport) Receive() ([]byte, error)
- func (t *Transport) Send(message []byte) error
- func (t *Transport) Start() error
- func (t *Transport) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTransportPair ¶
NewTransportPair creates a connected pair of embedded transports Returns (serverTransport, clientTransport)
Types ¶
type Option ¶
type Option func(*Transport)
Option configures the embedded transport
func WithBufferSize ¶
WithBufferSize sets the buffer size for message channels
func WithTimeout ¶
WithTimeout sets the default timeout for operations
type Transport ¶
type Transport struct {
transport.BaseTransport
// contains filtered or unexported fields
}
Transport implements an in-memory transport for testing and embedded use cases.
func NewTransport ¶
NewTransport creates a new embedded transport
func (*Transport) GetChannelStats ¶
GetChannelStats returns statistics about channel usage (for debugging)
func (*Transport) GetMessageHandler ¶ added in v1.6.4
func (t *Transport) GetMessageHandler() transport.MessageHandler
GetMessageHandler returns the current message handler (removed - use HandleMessage directly)
func (*Transport) GetResponseChannel ¶
GetResponseChannel returns the channel for receiving responses (for client use)
func (*Transport) Initialize ¶
Initialize initializes the transport