Documentation
¶
Overview ¶
Package transport provides utilities for handling different transport modes for communication between the client and MCP server.
Package transport provides utilities for handling different transport modes for communication between the client and MCP server.
Index ¶
- Constants
- Variables
- type Factory
- type SSETransport
- func (t *SSETransport) IsRunning(_ context.Context) (bool, error)
- func (*SSETransport) Mode() types.TransportType
- func (t *SSETransport) Port() int
- func (t *SSETransport) Setup(ctx context.Context, runtime rt.Runtime, containerName string, image string, ...) error
- func (t *SSETransport) Start(ctx context.Context) error
- func (t *SSETransport) Stop(ctx context.Context) error
- type StdioTransport
- func (t *StdioTransport) IsRunning(_ context.Context) (bool, error)
- func (*StdioTransport) Mode() types.TransportType
- func (t *StdioTransport) Port() int
- func (t *StdioTransport) Setup(ctx context.Context, runtime rt.Runtime, containerName string, image string, ...) error
- func (t *StdioTransport) Start(ctx context.Context) error
- func (t *StdioTransport) Stop(ctx context.Context) error
- type TransportError
Constants ¶
const ( // LocalhostName is the standard hostname for localhost LocalhostName = "localhost" // LocalhostIPv4 is the standard IPv4 address for localhost LocalhostIPv4 = "127.0.0.1" )
Variables ¶
var ( ErrUnsupportedTransport = errors.New("unsupported transport type") ErrTransportNotStarted = errors.New("transport not started") ErrTransportClosed = errors.New("transport closed") ErrInvalidMessage = errors.New("invalid message") ErrRuntimeNotSet = errors.New("container runtime not set") ErrContainerIDNotSet = errors.New("container ID not set") ErrContainerNameNotSet = errors.New("container name not set") )
Common transport errors
Functions ¶
This section is empty.
Types ¶
type SSETransport ¶
type SSETransport struct {
// contains filtered or unexported fields
}
SSETransport implements the Transport interface using Server-Sent Events.
func NewSSETransport ¶
func NewSSETransport( host string, port int, targetPort int, runtime rt.Runtime, debug bool, targetHost string, middlewares ...types.Middleware, ) *SSETransport
NewSSETransport creates a new SSE transport.
func (*SSETransport) IsRunning ¶
func (t *SSETransport) IsRunning(_ context.Context) (bool, error)
IsRunning checks if the transport is currently running.
func (*SSETransport) Mode ¶
func (*SSETransport) Mode() types.TransportType
Mode returns the transport mode.
func (*SSETransport) Port ¶
func (t *SSETransport) Port() int
Port returns the port used by the transport.
func (*SSETransport) Setup ¶
func (t *SSETransport) Setup(ctx context.Context, runtime rt.Runtime, containerName string, image string, cmdArgs []string, envVars, labels map[string]string, permissionProfile *permissions.Profile, k8sPodTemplatePatch string) error
Setup prepares the transport for use.
type StdioTransport ¶
type StdioTransport struct {
// contains filtered or unexported fields
}
StdioTransport implements the Transport interface using standard input/output. It acts as a proxy between the MCP client and the container's stdin/stdout.
func NewStdioTransport ¶
func NewStdioTransport( host string, port int, runtime rt.Runtime, debug bool, middlewares ...types.Middleware, ) *StdioTransport
NewStdioTransport creates a new stdio transport.
func (*StdioTransport) IsRunning ¶
func (t *StdioTransport) IsRunning(_ context.Context) (bool, error)
IsRunning checks if the transport is currently running.
func (*StdioTransport) Mode ¶
func (*StdioTransport) Mode() types.TransportType
Mode returns the transport mode.
func (*StdioTransport) Port ¶
func (t *StdioTransport) Port() int
Port returns the port used by the transport.
func (*StdioTransport) Setup ¶
func (t *StdioTransport) Setup( ctx context.Context, runtime rt.Runtime, containerName string, image string, cmdArgs []string, envVars, labels map[string]string, permissionProfile *permissions.Profile, k8sPodTemplatePatch string, ) error
Setup prepares the transport for use.
type TransportError ¶
type TransportError struct {
// Err is the underlying error
Err error
// ContainerID is the ID of the container
ContainerID string
// Message is an optional error message
Message string
}
TransportError represents an error related to transport operations
func NewTransportError ¶
func NewTransportError(err error, containerID, message string) *TransportError
NewTransportError creates a new transport error
func (*TransportError) Error ¶
func (e *TransportError) Error() string
Error returns the error message
func (*TransportError) Unwrap ¶
func (e *TransportError) Unwrap() error
Unwrap returns the underlying error
Directories
¶
| Path | Synopsis |
|---|---|
|
Package errors provides error types and constants for the transport package.
|
Package errors provides error types and constants for the transport package. |
|
Package proxy contains code for managing proxy processes.
|
Package proxy contains code for managing proxy processes. |
|
httpsse
Package httpsse provides an HTTP proxy implementation for Server-Sent Events (SSE) used in communication between the client and MCP server.
|
Package httpsse provides an HTTP proxy implementation for Server-Sent Events (SSE) used in communication between the client and MCP server. |
|
transparent
Package transparent provides a transparent HTTP proxy implementation that forwards requests to a destination without modifying them.
|
Package transparent provides a transparent HTTP proxy implementation that forwards requests to a destination without modifying them. |
|
Package ssecommon provides common types and utilities for Server-Sent Events (SSE) used in communication between the client and MCP server.
|
Package ssecommon provides common types and utilities for Server-Sent Events (SSE) used in communication between the client and MCP server. |
|
Package types provides common types and interfaces for the transport package used in communication between the client and MCP server.
|
Package types provides common types and interfaces for the transport package used in communication between the client and MCP server. |