streamable

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package streamable provides a streamable HTTP proxy for MCP servers.

Index

Constants

View Source
const (
	// StreamableHTTPEndpoint is the endpoint for streamable HTTP.
	StreamableHTTPEndpoint = "/mcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPProxy

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

HTTPProxy implements a proxy for streamable HTTP transport.

func NewHTTPProxy

func NewHTTPProxy(
	host string,
	port int,
	prometheusHandler http.Handler,
	middlewares []types.NamedMiddleware,
	opts ...Option,
) *HTTPProxy

NewHTTPProxy creates a new HTTPProxy for streamable HTTP transport.

func (*HTTPProxy) ForwardResponseToClients

func (p *HTTPProxy) ForwardResponseToClients(_ context.Context, msg jsonrpc2.Message) error

ForwardResponseToClients forwards a response from the container to the client.

func (*HTTPProxy) GetMessageChannel

func (p *HTTPProxy) GetMessageChannel() chan jsonrpc2.Message

GetMessageChannel returns the message channel for sending JSON-RPC to the container.

func (*HTTPProxy) GetResponseChannel

func (p *HTTPProxy) GetResponseChannel() <-chan jsonrpc2.Message

GetResponseChannel returns the response channel for receiving JSON-RPC from the container.

func (*HTTPProxy) IsRunning added in v0.9.1

func (p *HTTPProxy) IsRunning() (bool, error)

IsRunning checks if the proxy is running.

func (*HTTPProxy) SendMessageToDestination

func (p *HTTPProxy) SendMessageToDestination(msg jsonrpc2.Message) error

SendMessageToDestination sends a message to the container.

func (*HTTPProxy) SendResponseMessage

func (p *HTTPProxy) SendResponseMessage(msg jsonrpc2.Message) error

SendResponseMessage is for compatibility with the Proxy interface.

func (*HTTPProxy) Start

func (p *HTTPProxy) Start(_ context.Context) error

Start starts the HTTPProxy server.

func (*HTTPProxy) Stop

func (p *HTTPProxy) Stop(ctx context.Context) error

Stop gracefully shuts down the HTTPProxy server.

type Option added in v0.13.0

type Option func(*HTTPProxy)

Option configures an HTTPProxy.

func WithSessionStorage added in v0.13.0

func WithSessionStorage(storage session.Storage) Option

WithSessionStorage injects a custom storage backend into the session manager. When not provided, the proxy uses in-memory LocalStorage (single-replica default).

func WithSessionTTL added in v0.28.0

func WithSessionTTL(ttl time.Duration) Option

WithSessionTTL overrides the session inactivity timeout used by this proxy. Zero or negative values are ignored so the constructor's default is preserved.

Jump to

Keyboard shortcuts

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