Skip to content

Commit 68dbe67

Browse files
Copilotlpcox
andcommitted
Upgrade go-sdk to v1.2.0 and add configuration enhancements
- Upgraded modelcontextprotocol/go-sdk from v1.1.0 to v1.2.0 * Security fixes, bug fixes, MCP spec 2025-11-25 support * Session hijacking prevention, streamable transport improvements - Added Logger to StreamableHTTPOptions using slog adapter * Integrates SDK logging with project's logger framework - Added SessionTimeout (30 minutes) to StreamableHTTPOptions * Prevents resource leaks from idle connections - Updated Implementation.Version to use actual project version * Added SetClientGatewayVersion function in mcp package * Called from cmd.SetVersion to sync version across components Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent 876bc12 commit 68dbe67

5 files changed

Lines changed: 23 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
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.1.0
7+
github.com/modelcontextprotocol/go-sdk v1.2.0
88
github.com/spf13/cobra v1.10.2
99
golang.org/x/term v0.38.0
1010
)

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2
33
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
44
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
55
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6+
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
7+
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
68
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
79
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
810
github.com/google/jsonschema-go v0.3.0 h1:6AH2TxVNtk3IlvkkhjrtbUc4S8AvO0Xii0DxIygDg+Q=
@@ -13,8 +15,8 @@ github.com/itchyny/gojq v0.12.18 h1:gFGHyt/MLbG9n6dqnvlliiya2TaMMh6FFaR2b1H6Drc=
1315
github.com/itchyny/gojq v0.12.18/go.mod h1:4hPoZ/3lN9fDL1D+aK7DY1f39XZpY9+1Xpjz8atrEkg=
1416
github.com/itchyny/timefmt-go v0.1.7 h1:xyftit9Tbw+Dc/huSSPJaEmX1TVL8lw5vxjJLK4GMMA=
1517
github.com/itchyny/timefmt-go v0.1.7/go.mod h1:5E46Q+zj7vbTgWY8o5YkMeYb4I6GeWLFnetPy5oBrAI=
16-
github.com/modelcontextprotocol/go-sdk v1.1.0 h1:Qjayg53dnKC4UZ+792W21e4BpwEZBzwgRW6LrjLWSwA=
17-
github.com/modelcontextprotocol/go-sdk v1.1.0/go.mod h1:6fM3LCm3yV7pAs8isnKLn07oKtB0MP9LHd3DfAcKw10=
18+
github.com/modelcontextprotocol/go-sdk v1.2.0 h1:Y23co09300CEk8iZ/tMxIX1dVmKZkzoSBZOpJwUnc/s=
19+
github.com/modelcontextprotocol/go-sdk v1.2.0/go.mod h1:6fM3LCm3yV7pAs8isnKLn07oKtB0MP9LHd3DfAcKw10=
1820
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1921
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2022
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=

internal/cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
"github.com/githubnext/gh-aw-mcpg/internal/config"
1818
"github.com/githubnext/gh-aw-mcpg/internal/logger"
19+
"github.com/githubnext/gh-aw-mcpg/internal/mcp"
1920
"github.com/githubnext/gh-aw-mcpg/internal/server"
2021
"github.com/spf13/cobra"
2122
)
@@ -448,4 +449,5 @@ func SetVersion(v string) {
448449
version = v
449450
rootCmd.Version = v
450451
config.SetGatewayVersion(v)
452+
mcp.SetClientGatewayVersion(v)
451453
}

internal/mcp/connection.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ import (
2121

2222
var logConn = logger.New("mcp:connection")
2323

24+
// gatewayVersion stores the gateway version used in MCP client implementation
25+
// It defaults to "dev" and is set at startup via SetClientGatewayVersion
26+
var gatewayVersion = "dev"
27+
28+
// SetClientGatewayVersion sets the gateway version for MCP client implementation reporting
29+
func SetClientGatewayVersion(version string) {
30+
if version != "" {
31+
gatewayVersion = version
32+
}
33+
}
34+
2435
// parseSSEResponse extracts JSON data from SSE-formatted response
2536
// SSE format: "event: message\ndata: {json}\n\n"
2637
func parseSSEResponse(body []byte) ([]byte, error) {
@@ -76,7 +87,7 @@ type Connection struct {
7687
func newMCPClient() *sdk.Client {
7788
return sdk.NewClient(&sdk.Implementation{
7889
Name: "awmg",
79-
Version: "1.0.0",
90+
Version: gatewayVersion,
8091
}, nil)
8192
}
8293

internal/server/transport.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"log"
66
"net/http"
7+
"time"
78

89
"github.com/githubnext/gh-aw-mcpg/internal/logger"
910
sdk "github.com/modelcontextprotocol/go-sdk/mcp"
@@ -97,7 +98,9 @@ func CreateHTTPServerForMCP(addr string, unifiedServer *UnifiedServer, apiKey st
9798

9899
return unifiedServer.server
99100
}, &sdk.StreamableHTTPOptions{
100-
Stateless: false, // Support stateful sessions
101+
Stateless: false, // Support stateful sessions
102+
Logger: logger.NewSlogLoggerWithHandler(logTransport), // Integrate SDK logging with project logger
103+
SessionTimeout: 30 * time.Minute, // Prevent resource leaks from idle connections
101104
})
102105

103106
// Wrap SDK handler with detailed logging for JSON-RPC translation debugging

0 commit comments

Comments
 (0)