Documentation
¶
Overview ¶
Package ws provides a WebSocket implementation of the MCP transport.
This package implements the Transport interface using WebSockets, suitable for web applications requiring bidirectional communication.
Index ¶
- Constants
- type Transport
- func (t *Transport) GetFullWSPath() string
- func (t *Transport) Initialize() error
- func (t *Transport) Receive() ([]byte, error)
- func (t *Transport) Send(message []byte) error
- func (t *Transport) SetPathPrefix(prefix string) *Transport
- func (t *Transport) SetWSPath(path string) *Transport
- func (t *Transport) Start() error
- func (t *Transport) Stop() error
Constants ¶
const DefaultShutdownTimeout = 10 * time.Second
DefaultShutdownTimeout is the default timeout for graceful shutdown
const DefaultWSPath = "/ws"
DefaultWSPath is the default endpoint path for WebSocket connections
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Transport ¶
type Transport struct {
transport.BaseTransport
// contains filtered or unexported fields
}
Transport implements the transport.Transport interface for WebSocket
func NewTransport ¶
NewTransport creates a new WebSocket transport
func (*Transport) GetFullWSPath ¶ added in v1.2.1
GetFullWSPath returns the complete path for the WebSocket endpoint
func (*Transport) Initialize ¶
Initialize initializes the transport
func (*Transport) SetPathPrefix ¶ added in v1.2.1
SetPathPrefix sets a prefix for the endpoint path For example, SetPathPrefix("/mcp") will result in endpoint like "/mcp/ws"