transport

package
v0.0.0-...-b198e9d Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionHandler

type ConnectionHandler interface {
	OnConnect(ctx context.Context, sessionID string)
	OnDisconnect(ctx context.Context, sessionID string)
}

ConnectionHandler is called when a new connection is established or closed.

type MessageHandler

type MessageHandler func(ctx context.Context, sess *session.Session, message []byte) ([]byte, error)

MessageHandler is called when a message is received from a client. It receives the session and raw message, and returns a response.

type Transport

type Transport interface {
	// Start begins accepting connections and processing messages.
	Start(ctx context.Context) error

	// Stop gracefully shuts down the transport, closing all connections.
	Stop(ctx context.Context) error

	// Name returns the transport type name (e.g., "sse", "stdio", "http")
	Name() string

	// SetMessageHandler sets the callback for processing incoming messages.
	SetMessageHandler(handler MessageHandler)
}

Transport defines the interface for MCP transport implementations. Supported transports: SSE, stdio, HTTP

type TransportConfig

type TransportConfig struct {
	Address        string
	Port           int
	ReadTimeout    int // seconds
	WriteTimeout   int // seconds
	MaxConnections int
}

TransportConfig holds common transport configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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