Skip to content

Commit dd3210c

Browse files
authored
feat: Implement Streamable-HTTP Client Basic (#168)
* add streamable http transport * doc * update * remove default timeout * Update streamable_http.go * add http client * Update streamable_http.go * add timeout to close request * Update http.go * fix log
1 parent 8c0f2be commit dd3210c

File tree

3 files changed

+829
-0
lines changed

3 files changed

+829
-0
lines changed

client/http.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package client
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/mark3labs/mcp-go/client/transport"
7+
)
8+
9+
// NewStreamableHttpClient is a convenience method that creates a new streamable-http-based MCP client
10+
// with the given base URL. Returns an error if the URL is invalid.
11+
func NewStreamableHttpClient(baseURL string, options ...transport.StreamableHTTPCOption) (*Client, error) {
12+
trans, err := transport.NewStreamableHTTP(baseURL, options...)
13+
if err != nil {
14+
return nil, fmt.Errorf("failed to create SSE transport: %w", err)
15+
}
16+
return NewClient(trans), nil
17+
}

0 commit comments

Comments
 (0)