File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -135,13 +135,22 @@ func WithBaseURL(baseURL string) SSEOption {
135135 }
136136}
137137
138- // WithBasePath adds a new option for setting a static base path
139- func WithBasePath (basePath string ) SSEOption {
138+ // WithStaticBasePath adds a new option for setting a static base path
139+ func WithStaticBasePath (basePath string ) SSEOption {
140140 return func (s * SSEServer ) {
141141 s .basePath = normalizeURLPath (basePath )
142142 }
143143}
144144
145+ // WithBasePath adds a new option for setting a static base path.
146+ //
147+ // Deprecated: Use WithStaticBasePath instead. This will be removed in a future version.
148+ //
149+ //go:deprecated
150+ func WithBasePath (basePath string ) SSEOption {
151+ return WithStaticBasePath (basePath )
152+ }
153+
145154// WithDynamicBasePath accepts a function for generating the base path. This is
146155// useful for cases where the base path is not known at the time of SSE server
147156// creation, such as when using a reverse proxy or when the server is mounted
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ func TestSSEServer(t *testing.T) {
2424 mcpServer := NewMCPServer ("test" , "1.0.0" )
2525 sseServer := NewSSEServer (mcpServer ,
2626 WithBaseURL ("http://localhost:8080" ),
27- WithBasePath ("/mcp" ),
27+ WithStaticBasePath ("/mcp" ),
2828 )
2929
3030 if sseServer == nil {
@@ -499,7 +499,7 @@ func TestSSEServer(t *testing.T) {
499499
500500 t .Run ("works as http.Handler with custom basePath" , func (t * testing.T ) {
501501 mcpServer := NewMCPServer ("test" , "1.0.0" )
502- sseServer := NewSSEServer (mcpServer , WithBasePath ("/mcp" ))
502+ sseServer := NewSSEServer (mcpServer , WithStaticBasePath ("/mcp" ))
503503
504504 ts := httptest .NewServer (sseServer )
505505 defer ts .Close ()
@@ -717,7 +717,7 @@ func TestSSEServer(t *testing.T) {
717717 useFullURLForMessageEndpoint := false
718718 srv := & http.Server {}
719719 rands := []SSEOption {
720- WithBasePath (basePath ),
720+ WithStaticBasePath (basePath ),
721721 WithBaseURL (baseURL ),
722722 WithMessageEndpoint (messageEndpoint ),
723723 WithUseFullURLForMessageEndpoint (useFullURLForMessageEndpoint ),
You can’t perform that action at this time.
0 commit comments