diff --git a/mcp/cmd.go b/mcp/cmd.go index 01195d22..55e5cca6 100644 --- a/mcp/cmd.go +++ b/mcp/cmd.go @@ -27,19 +27,6 @@ type CommandTransport struct { TerminateDuration time.Duration } -// NewCommandTransport returns a [CommandTransport] that runs the given command -// and communicates with it over stdin/stdout. -// -// The resulting transport takes ownership of the command, starting it during -// [CommandTransport.Connect], and stopping it when the connection is closed. -// -// Deprecated: use a CommandTransport literal. -// -//go:fix inline -func NewCommandTransport(cmd *exec.Cmd) *CommandTransport { - return &CommandTransport{Command: cmd} -} - // Connect starts the command, and connects to it over stdin/stdout. func (t *CommandTransport) Connect(ctx context.Context) (Connection, error) { stdout, err := t.Command.StdoutPipe() diff --git a/mcp/sse.go b/mcp/sse.go index b7f0d4e2..f39a0397 100644 --- a/mcp/sse.go +++ b/mcp/sse.go @@ -114,19 +114,6 @@ type SSEServerTransport struct { done chan struct{} // closed when the connection is closed } -// NewSSEServerTransport creates a new SSE transport for the given messages -// endpoint, and hanging GET response. -// -// Deprecated: use an SSEServerTransport literal. -// -//go:fix inline -func NewSSEServerTransport(endpoint string, w http.ResponseWriter) *SSEServerTransport { - return &SSEServerTransport{ - Endpoint: endpoint, - Response: w, - } -} - // ServeHTTP handles POST requests to the transport endpoint. func (t *SSEServerTransport) ServeHTTP(w http.ResponseWriter, req *http.Request) { if t.incoming == nil { @@ -334,30 +321,6 @@ type SSEClientTransport struct { HTTPClient *http.Client } -// SSEClientTransportOptions provides options for the [NewSSEClientTransport] -// constructor. -// -// Deprecated: use an SSEClientTransport literal. -type SSEClientTransportOptions struct { - // HTTPClient is the client to use for making HTTP requests. If nil, - // http.DefaultClient is used. - HTTPClient *http.Client -} - -// NewSSEClientTransport returns a new client transport that connects to the -// SSE server at the provided URL. -// -// Deprecated: use an SSEClientTransport literal. -// -//go:fix inline -func NewSSEClientTransport(endpoint string, opts *SSEClientTransportOptions) *SSEClientTransport { - t := &SSEClientTransport{Endpoint: endpoint} - if opts != nil { - t.HTTPClient = opts.HTTPClient - } - return t -} - // Connect connects through the client endpoint. func (c *SSEClientTransport) Connect(ctx context.Context) (Connection, error) { parsedURL, err := url.Parse(c.Endpoint) diff --git a/mcp/streamable.go b/mcp/streamable.go index 1eef9a74..e820a2ba 100644 --- a/mcp/streamable.go +++ b/mcp/streamable.go @@ -323,15 +323,6 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque transport.ServeHTTP(w, req) } -// StreamableServerTransportOptions configures the stramable server transport. -// -// Deprecated: use a StreamableServerTransport literal. -type StreamableServerTransportOptions struct { - // Storage for events, to enable stream resumption. - // If nil, a [MemoryEventStore] with the default maximum size will be used. - EventStore EventStore -} - // A StreamableServerTransport implements the server side of the MCP streamable // transport. // @@ -385,22 +376,6 @@ type StreamableServerTransport struct { connection *streamableServerConn } -// NewStreamableServerTransport returns a new [StreamableServerTransport] with -// the given session ID and options. -// -// Deprecated: use a StreamableServerTransport literal. -// -//go:fix inline. -func NewStreamableServerTransport(sessionID string, opts *StreamableServerTransportOptions) *StreamableServerTransport { - t := &StreamableServerTransport{ - SessionID: sessionID, - } - if opts != nil { - t.EventStore = opts.EventStore - } - return t -} - // Connect implements the [Transport] interface. func (t *StreamableServerTransport) Connect(ctx context.Context) (Connection, error) { if t.connection != nil { @@ -1025,34 +1000,6 @@ const ( reconnectMaxDelay = 30 * time.Second ) -// StreamableClientTransportOptions provides options for the -// [NewStreamableClientTransport] constructor. -// -// Deprecated: use a StremableClientTransport literal. -type StreamableClientTransportOptions struct { - // HTTPClient is the client to use for making HTTP requests. If nil, - // http.DefaultClient is used. - HTTPClient *http.Client - // MaxRetries is the maximum number of times to attempt a reconnect before giving up. - // It defaults to 5. To disable retries, use a negative number. - MaxRetries int -} - -// NewStreamableClientTransport returns a new client transport that connects to -// the streamable HTTP server at the provided URL. -// -// Deprecated: use a StreamableClientTransport literal. -// -//go:fix inline -func NewStreamableClientTransport(url string, opts *StreamableClientTransportOptions) *StreamableClientTransport { - t := &StreamableClientTransport{Endpoint: url} - if opts != nil { - t.HTTPClient = opts.HTTPClient - t.MaxRetries = opts.MaxRetries - } - return t -} - // Connect implements the [Transport] interface. // // The resulting [Connection] writes messages via POST requests to the diff --git a/mcp/streamable_test.go b/mcp/streamable_test.go index a85fbec0..5c9685e6 100644 --- a/mcp/streamable_test.go +++ b/mcp/streamable_test.go @@ -1211,7 +1211,7 @@ func TestTokenInfo(t *testing.T) { httpServer := httptest.NewServer(handler) defer httpServer.Close() - transport := NewStreamableClientTransport(httpServer.URL, nil) + transport := &StreamableClientTransport{Endpoint: httpServer.URL} client := NewClient(testImpl, nil) session, err := client.Connect(ctx, transport, nil) if err != nil { diff --git a/mcp/transport.go b/mcp/transport.go index 5c7ca130..608247cd 100644 --- a/mcp/transport.go +++ b/mcp/transport.go @@ -93,16 +93,6 @@ func (*StdioTransport) Connect(context.Context) (Connection, error) { return newIOConn(rwc{os.Stdin, os.Stdout}), nil } -// NewStdioTransport constructs a transport that communicates over -// stdin/stdout. -// -// Deprecated: use a StdioTransport literal. -// -//go:fix inline -func NewStdioTransport() *StdioTransport { - return &StdioTransport{} -} - // An InMemoryTransport is a [Transport] that communicates over an in-memory // network connection, using newline-delimited JSON. type InMemoryTransport struct { @@ -215,16 +205,6 @@ type LoggingTransport struct { Writer io.Writer } -// NewLoggingTransport creates a new LoggingTransport that delegates to the -// provided transport, writing RPC logs to the provided io.Writer. -// -// Deprecated: use a LoggingTransport literal. -// -//go:fix inline -func NewLoggingTransport(delegate Transport, w io.Writer) *LoggingTransport { - return &LoggingTransport{Transport: delegate, Writer: w} -} - // Connect connects the underlying transport, returning a [Connection] that writes // logs to the configured destination. func (t *LoggingTransport) Connect(ctx context.Context) (Connection, error) {