Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions mcp/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
37 changes: 0 additions & 37 deletions mcp/sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
53 changes: 0 additions & 53 deletions mcp/streamable.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mcp/streamable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 0 additions & 20 deletions mcp/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down