transport

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package transport provides utilities for handling different transport modes for communication between the client and MCP server.

Index

Constants

View Source
const (
	// LocalhostName is the standard hostname for localhost
	LocalhostName = "localhost"
	// LocalhostIPv4 is the standard IPv4 address for localhost
	LocalhostIPv4 = "127.0.0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct{}

Factory creates transports

func NewFactory

func NewFactory() *Factory

NewFactory creates a new transport factory

func (*Factory) Create

func (*Factory) Create(config types.Config) (types.Transport, error)

Create creates a transport based on the provided configuration

type HTTPTransport added in v0.0.48

type HTTPTransport struct {
	// contains filtered or unexported fields
}

HTTPTransport implements the Transport interface using Server-Sent/Streamable Events.

func NewHTTPTransport added in v0.0.48

func NewHTTPTransport(
	transportType types.TransportType,
	host string,
	proxyPort int,
	targetPort int,
	deployer rt.Deployer,
	debug bool,
	targetHost string,
	prometheusHandler http.Handler,
	middlewares ...types.Middleware,
) *HTTPTransport

NewHTTPTransport creates a new HTTP transport.

func (*HTTPTransport) IsRunning added in v0.0.48

func (t *HTTPTransport) IsRunning(_ context.Context) (bool, error)

IsRunning checks if the transport is currently running.

func (*HTTPTransport) Mode added in v0.0.48

func (t *HTTPTransport) Mode() types.TransportType

Mode returns the transport mode.

func (*HTTPTransport) ProxyPort added in v0.1.9

func (t *HTTPTransport) ProxyPort() int

ProxyPort returns the proxy port used by the transport.

func (*HTTPTransport) Setup added in v0.0.48

func (t *HTTPTransport) Setup(ctx context.Context, runtime rt.Deployer, containerName string, image string, cmdArgs []string,
	envVars, labels map[string]string, permissionProfile *permissions.Profile, k8sPodTemplatePatch string,
	isolateNetwork bool, ignoreConfig *ignore.Config) error

Setup prepares the transport for use.

func (*HTTPTransport) Start added in v0.0.48

func (t *HTTPTransport) Start(ctx context.Context) error

Start initializes the transport and begins processing messages. The transport is responsible for starting the container.

func (*HTTPTransport) Stop added in v0.0.48

func (t *HTTPTransport) Stop(ctx context.Context) error

Stop gracefully shuts down the transport and the container.

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,
	proxyPort int,
	deployer rt.Deployer,
	debug bool,
	prometheusHandler http.Handler,
	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

Mode returns the transport mode.

func (*StdioTransport) ProxyPort added in v0.1.9

func (t *StdioTransport) ProxyPort() int

ProxyPort returns the proxy port used by the transport.

func (*StdioTransport) SetProxyMode added in v0.1.3

func (t *StdioTransport) SetProxyMode(mode types.ProxyMode)

SetProxyMode allows configuring the proxy mode (SSE or Streamable HTTP)

func (*StdioTransport) Setup

func (t *StdioTransport) Setup(
	ctx context.Context,
	runtime rt.Deployer,
	containerName string,
	image string,
	cmdArgs []string,
	envVars, labels map[string]string,
	permissionProfile *permissions.Profile,
	k8sPodTemplatePatch string,
	isolateNetwork bool,
	ignoreConfig *ignore.Config,
) error

Setup prepares the transport for use.

func (*StdioTransport) Start

func (t *StdioTransport) Start(ctx context.Context) error

Start initializes the transport and begins processing messages. The transport is responsible for starting the container and attaching to it.

func (*StdioTransport) Stop

func (t *StdioTransport) Stop(ctx context.Context) error

Stop gracefully shuts down the transport and the container.

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.
streamable
Package streamable provides a streamable HTTP proxy for MCP servers.
Package streamable provides a streamable HTTP proxy for MCP servers.
transparent
Package transparent provides MCP ping functionality for transparent proxies.
Package transparent provides MCP ping functionality for transparent proxies.
Package session provides a session manager with TTL cleanup.
Package session provides a session manager with TTL cleanup.
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 streamable provides common types and utilities for Streamable HTTP connections used in communication between the client and MCP server.
Package streamable provides common types and utilities for Streamable HTTP connections 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.

Jump to

Keyboard shortcuts

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