Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func ConnectAndInitialize ¶
func ConnectAndInitialize(ctx context.Context, name string, t transport.Transport) (*Client, *protocol.InitializeResultV1, error)
ConnectAndInitialize creates a Client that connects to a remote HTTP MCP server.
func SpawnAndInitialize ¶
func (*Client) Call ¶
type HTTPTransport ¶
type HTTPTransport struct {
// contains filtered or unexported fields
}
HTTPTransport implements transport.Transport for MCP Streamable HTTP. It POSTs JSON-RPC messages to a remote server and reads responses from the HTTP response body (plain JSON or SSE).
func NewHTTPTransport ¶
func NewHTTPTransport(url string, opts ...HTTPTransportOption) *HTTPTransport
NewHTTPTransport creates a new HTTP client transport for the given URL.
func (*HTTPTransport) Close ¶
func (t *HTTPTransport) Close() error
Close closes the transport and sends a DELETE to terminate the session.
func (*HTTPTransport) Read ¶
func (t *HTTPTransport) Read() (*jsonrpc.Message, error)
Read returns the next message received from the server.
func (*HTTPTransport) SessionID ¶
func (t *HTTPTransport) SessionID() string
SessionID returns the current session ID, if any.
func (*HTTPTransport) Write ¶
func (t *HTTPTransport) Write(msg *jsonrpc.Message) error
Write sends a JSON-RPC message to the server via HTTP POST. For requests (messages with an ID), it reads the response and enqueues it. For notifications, it accepts a 202 response.
type HTTPTransportOption ¶
type HTTPTransportOption func(*HTTPTransport)
HTTPTransportOption configures an HTTPTransport.
func WithBearerToken ¶
func WithBearerToken(token string) HTTPTransportOption
WithBearerToken sets an Authorization: Bearer header.
func WithHeaders ¶
func WithHeaders(headers map[string]string) HTTPTransportOption
WithHeaders sets static headers sent with every request.
type LineTooLongError ¶
type LineTooLongError struct {
Server string // child server name
Ceiling int64 // the deliver ceiling that was exceeded, in bytes
Bytes int64 // line size read: exact content length when
// NewlineFound, else the drain budget consumed (a
// lower bound on the true size)
NewlineFound bool // whether the terminating newline was reached within
// the drain budget — if so the stream is resynced to
// the next message; if not the stream is unrecoverable
SpillPath string // temp file the oversize line was written to, "" if not spilled
}
LineTooLongError is returned by the stdio reader when a child emits a single newline-delimited message larger than the configured ceiling (MOXY_CHILD_MAX_MESSAGE). It carries the offending line's size so operators can tune the ceiling from the reported number. The child process is still alive — only its oversize message was refused. See #275.
func (*LineTooLongError) Error ¶
func (e *LineTooLongError) Error() string
Source Files
¶
- client.go
- http.go
- sse.go
- stdioreader.go