Skip to content

Commit 387ac10

Browse files
authored
Upgrade go-sdk to v1.6.0 and consolidate session-not-found matcher
1 parent 92a18fa commit 387ac10

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.25.0
44

55
require (
66
github.com/BurntSushi/toml v1.6.0
7-
github.com/modelcontextprotocol/go-sdk v1.5.0
7+
github.com/modelcontextprotocol/go-sdk v1.6.0
88
github.com/spf13/cobra v1.10.2
99
golang.org/x/term v0.41.0
1010
)
@@ -27,7 +27,7 @@ require (
2727
github.com/davecgh/go-spew v1.1.1 // indirect
2828
github.com/go-logr/logr v1.4.3 // indirect
2929
github.com/go-logr/stdr v1.2.2 // indirect
30-
github.com/google/jsonschema-go v0.4.2 // indirect
30+
github.com/google/jsonschema-go v0.4.3 // indirect
3131
github.com/google/uuid v1.6.0 // indirect
3232
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
3333
github.com/inconshreveable/mousetrap v1.1.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
1818
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
1919
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
2020
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
21-
github.com/google/jsonschema-go v0.4.2 h1:tmrUohrwoLZZS/P3x7ex0WAVknEkBZM46iALbcqoRA8=
22-
github.com/google/jsonschema-go v0.4.2/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
21+
github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0=
22+
github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
2323
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
2424
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
2525
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs=
@@ -34,8 +34,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
3434
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
3535
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
3636
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
37-
github.com/modelcontextprotocol/go-sdk v1.5.0 h1:CHU0FIX9kpueNkxuYtfYQn1Z0slhFzBZuq+x6IiblIU=
38-
github.com/modelcontextprotocol/go-sdk v1.5.0/go.mod h1:gggDIhoemhWs3BGkGwd1umzEXCEMMvAnhTrnbXJKKKA=
37+
github.com/modelcontextprotocol/go-sdk v1.6.0 h1:PPLS3kn7WtOEnR+Af4X5H96SG0qSab8R/ZQT/HkhPkY=
38+
github.com/modelcontextprotocol/go-sdk v1.6.0/go.mod h1:kzm3kzFL1/+AziGOE0nUs3gvPoNxMCvkxokMkuFapXQ=
3939
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4040
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4141
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=

internal/mcp/http_transport.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const (
3232
HTTPTransportSSE HTTPTransportType = "sse"
3333
// HTTPTransportPlainJSON uses plain JSON-RPC 2.0 over HTTP POST (non-standard)
3434
HTTPTransportPlainJSON HTTPTransportType = "plain-json"
35+
sessionNotFoundMessage = "session not found"
3536
)
3637

3738
// MCPProtocolVersion is the MCP protocol version used only by the plain JSON-RPC
@@ -86,7 +87,7 @@ func isSessionNotFoundError(err error) bool {
8687
// TODO(tech-debt): remove this string-matching fallback once the plain JSON-RPC
8788
// transport (HTTPTransportPlainJSON) is retired. The plain JSON-RPC path exists
8889
// only for compatibility with backends that predate the 2024-11-05 MCP spec.
89-
return strings.Contains(strings.ToLower(err.Error()), "session not found")
90+
return strings.Contains(strings.ToLower(err.Error()), sessionNotFoundMessage)
9091
}
9192

9293
// isSessionNotFoundHTTPResponse checks if an HTTP response indicates the backend session was not found.
@@ -95,7 +96,7 @@ func isSessionNotFoundHTTPResponse(statusCode int, body []byte) bool {
9596
if statusCode != http.StatusNotFound {
9697
return false
9798
}
98-
return strings.Contains(strings.ToLower(string(body)), "session not found")
99+
return strings.Contains(strings.ToLower(string(body)), sessionNotFoundMessage)
99100
}
100101

101102
// parseSSEResponse extracts JSON data from SSE-formatted response

internal/server/tool_registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type launchResult struct {
5050
// does require that InputSchema is non-nil and has type "object" (enforced since v1.5.0), but
5151
// it does not validate the argument values — that responsibility belongs to the caller.
5252
// This distinction relies on internal SDK behaviour and must be re-verified on every SDK upgrade.
53-
// Verified correct for go-sdk v1.5.0 (see server.go:Server.AddTool vs AddTool[In,Out]).
53+
// Verified correct for go-sdk v1.6.0 (see server.go:Server.AddTool vs AddTool[In,Out]).
5454
func registerToolWithoutValidation(server *sdk.Server, tool *sdk.Tool, handler func(context.Context, *sdk.CallToolRequest, interface{}) (*sdk.CallToolResult, interface{}, error)) {
5555
server.AddTool(tool, func(ctx context.Context, req *sdk.CallToolRequest) (*sdk.CallToolResult, error) {
5656
result, _, err := handler(ctx, req, nil)

0 commit comments

Comments
 (0)