Documentation
¶
Overview ¶
Package transport provides utilities for handling different transport modes for communication between the client and MCP server.
Package transport provides utilities for MCP transport operations
Index ¶
- Constants
- func GenerateMCPServerURL(transportType string, host string, port int, containerName, remoteURL string) string
- type Factory
- type HTTPTransport
- func (t *HTTPTransport) IsRunning(_ context.Context) (bool, error)
- func (t *HTTPTransport) Mode() types.TransportType
- func (t *HTTPTransport) ProxyPort() int
- func (t *HTTPTransport) SetRemoteURL(remoteURL string)
- func (t *HTTPTransport) SetTokenSource(tokenSource *oauth2.TokenSource)
- func (t *HTTPTransport) Setup(ctx context.Context, runtime rt.Deployer, containerName string, image string, ...) error
- func (t *HTTPTransport) Start(ctx context.Context) error
- func (t *HTTPTransport) Stop(ctx context.Context) error
- type StdioBridge
- type StdioTransport
- func (t *StdioTransport) IsRunning(_ context.Context) (bool, error)
- func (*StdioTransport) Mode() types.TransportType
- func (t *StdioTransport) ProxyPort() int
- func (t *StdioTransport) SetProxyMode(mode types.ProxyMode)
- func (t *StdioTransport) Setup(ctx context.Context, runtime rt.Deployer, containerName string, image string, ...) error
- func (t *StdioTransport) Start(ctx context.Context) error
- func (t *StdioTransport) Stop(ctx context.Context) error
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 ¶
This section is empty.
Functions ¶
func GenerateMCPServerURL ¶ added in v0.2.4
func GenerateMCPServerURL(transportType string, host string, port int, containerName, remoteURL string) string
GenerateMCPServerURL generates the URL for an MCP server. If remoteURL is provided, the remote server's path will be used as the path of the proxy. For SSE/STDIO transports, a "#<containerName>" fragment is appended. For StreamableHTTP, no fragment is appended.
Types ¶
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, authInfoHandler http.Handler, prometheusHandler http.Handler, middlewares ...types.MiddlewareFunction, ) *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) SetRemoteURL ¶ added in v0.2.10
func (t *HTTPTransport) SetRemoteURL(remoteURL string)
SetRemoteURL sets the remote URL for the MCP server
func (*HTTPTransport) SetTokenSource ¶ added in v0.2.10
func (t *HTTPTransport) SetTokenSource(tokenSource *oauth2.TokenSource)
SetTokenSource sets the OAuth token source for remote authentication
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 map[string]string, labels map[string]string, permissionProfile *permissions.Profile, k8sPodTemplatePatch string, isolateNetwork bool, ignoreConfig *ignore.Config, ) error
Setup prepares the transport for use.
type StdioBridge ¶ added in v0.2.7
type StdioBridge struct {
// contains filtered or unexported fields
}
StdioBridge connects stdin/stdout to a target MCP server using the specified transport type.
func NewStdioBridge ¶ added in v0.2.7
func NewStdioBridge(name, rawURL string, mode types.TransportType) (*StdioBridge, error)
NewStdioBridge creates a new StdioBridge instance for the given target URL and transport type.
func (*StdioBridge) Shutdown ¶ added in v0.2.7
func (b *StdioBridge) Shutdown()
Shutdown gracefully stops the bridge, closing connections and waiting for cleanup.
func (*StdioBridge) Start ¶ added in v0.2.7
func (b *StdioBridge) Start(ctx context.Context)
Start initializes the bridge and connects to the upstream MCP server.
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.MiddlewareFunction, ) *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) 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.
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. |
|
proxy
|
|
|
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. |
|
tunnel
|
|
|
ngrok
Package ngrok provides an implementation of the TunnelProvider interface using ngrok.
|
Package ngrok provides an implementation of the TunnelProvider interface using ngrok. |
|
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. |
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |