Documentation
¶
Overview ¶
Package httpsse provides an HTTP proxy implementation for Server-Sent Events (SSE) used in communication between the client and MCP server.
Index ¶
- type HTTPSSEProxy
- func (p *HTTPSSEProxy) ForwardResponseToClients(_ context.Context, msg jsonrpc2.Message) error
- func (p *HTTPSSEProxy) GetMessageChannel() chan jsonrpc2.Message
- func (p *HTTPSSEProxy) GetResponseChannel() <-chan jsonrpc2.Message
- func (p *HTTPSSEProxy) SendMessageToDestination(msg jsonrpc2.Message) error
- func (p *HTTPSSEProxy) SendResponseMessage(msg jsonrpc2.Message) error
- func (p *HTTPSSEProxy) Start(_ context.Context) error
- func (p *HTTPSSEProxy) Stop(ctx context.Context) error
- type Proxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPSSEProxy ¶
type HTTPSSEProxy struct {
// contains filtered or unexported fields
}
HTTPSSEProxy encapsulates the HTTP proxy functionality for SSE transports. It provides SSE endpoints and JSON-RPC message handling.
func NewHTTPSSEProxy ¶
func NewHTTPSSEProxy(port int, containerName string, middlewares ...types.Middleware) *HTTPSSEProxy
NewHTTPSSEProxy creates a new HTTP SSE proxy for transports.
func (*HTTPSSEProxy) ForwardResponseToClients ¶
ForwardResponseToClients forwards a response from the destination to all connected SSE clients.
func (*HTTPSSEProxy) GetMessageChannel ¶
func (p *HTTPSSEProxy) GetMessageChannel() chan jsonrpc2.Message
GetMessageChannel returns the channel for messages to/from the destination.
func (*HTTPSSEProxy) GetResponseChannel ¶
func (p *HTTPSSEProxy) GetResponseChannel() <-chan jsonrpc2.Message
GetResponseChannel returns the channel for receiving messages from the destination.
func (*HTTPSSEProxy) SendMessageToDestination ¶
func (p *HTTPSSEProxy) SendMessageToDestination(msg jsonrpc2.Message) error
SendMessageToDestination sends a message to the destination via the message channel.
func (*HTTPSSEProxy) SendResponseMessage ¶
func (p *HTTPSSEProxy) SendResponseMessage(msg jsonrpc2.Message) error
SendResponseMessage sends a message to the response channel.
type Proxy ¶
type Proxy interface {
// Start starts the proxy.
Start(ctx context.Context) error
// Stop stops the proxy.
Stop(ctx context.Context) error
// GetMessageChannel returns the channel for messages to/from the destination.
GetMessageChannel() chan jsonrpc2.Message
// GetResponseChannel returns the channel for receiving messages from the destination.
GetResponseChannel() <-chan jsonrpc2.Message
// SendMessageToDestination sends a message to the destination.
SendMessageToDestination(msg jsonrpc2.Message) error
// ForwardResponseToClients forwards a response from the destination to clients.
ForwardResponseToClients(ctx context.Context, msg jsonrpc2.Message) error
// SendResponseMessage sends a message to the response channel.
SendResponseMessage(msg jsonrpc2.Message) error
}
Proxy defines the interface for proxying messages between clients and destinations.