mcp: remove deprecated transport constructors
In #272, we made transports open structs and deprecated their constructors. However, we left the constructors in place to allow go:fix directives to facilitate migration. Now let's remove the constructors before cutting the release. Fixes #305
This commit is contained in:
parent
5bbca40032
commit
b1c75f04d8
1 changed files with 1 additions and 124 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue