embedded

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 5 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransportPair

func NewTransportPair(options ...Option) (*Transport, *Transport)

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

func WithBufferSize(size int) Option

WithBufferSize sets the buffer size for message channels

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the default timeout for operations

type Transport

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

Transport represents an embedded transport for in-process communication.

func NewTransport

func NewTransport(options ...Option) *Transport

NewTransport creates a new embedded transport

func (*Transport) GetChannelStats

func (t *Transport) GetChannelStats() map[string]int

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

func (t *Transport) GetResponseChannel() <-chan []byte

GetResponseChannel returns the channel for receiving responses (for client use)

func (*Transport) Initialize

func (t *Transport) Initialize() error

Initialize initializes the transport

func (*Transport) IsStarted

func (t *Transport) IsStarted() bool

IsStarted returns whether the transport is started

func (*Transport) Receive

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

Receive receives a message from the transport

func (*Transport) Send

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

Send sends a message over the transport

func (*Transport) Start

func (t *Transport) Start() error

Start starts the transport

func (*Transport) Stop

func (t *Transport) Stop() error

Stop stops the transport

Jump to

Keyboard shortcuts

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