Skip to content

Commit bc4dcf4

Browse files
Update go-sdk module
1 parent afdad5c commit bc4dcf4

File tree

14 files changed

+334
-125
lines changed

14 files changed

+334
-125
lines changed

cmd/docker-mcp/internal/mcp/mcp_client.go

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package mcp
33
import (
44
"context"
55
"fmt"
6-
"slices"
76

87
"github.com/modelcontextprotocol/go-sdk/mcp"
98
)
@@ -21,66 +20,36 @@ type Client interface {
2120
Close() error
2221
}
2322

24-
func allSessions(server *mcp.Server, callback func(session *mcp.ServerSession)) {
25-
for session := range server.Sessions() {
26-
callback(session)
27-
}
28-
}
29-
30-
func serverNotifications(server *mcp.Server) *mcp.ClientOptions {
23+
func stdioNotifications(serverSession *mcp.ServerSession) *mcp.ClientOptions {
3124
return &mcp.ClientOptions{
3225
CreateMessageHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.CreateMessageParams) (*mcp.CreateMessageResult, error) {
3326
// Handle create messages if needed
3427
return nil, fmt.Errorf("create messages not supported")
3528
},
3629
ToolListChangedHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.ToolListChangedParams) {
37-
// Handle tool list changes if needed
38-
if server != nil {
39-
sessions := slices.Collect(server.Sessions())
40-
mcp.NotifySessions(sessions, "notifications/tools/list_changed", params)
30+
if serverSession != nil {
31+
mcp.HandleNotify(ctx, serverSession, "notifications/tools/list_changed", params)
4132
}
4233
},
4334
ResourceListChangedHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.ResourceListChangedParams) {
44-
if server != nil {
45-
sessions := slices.Collect(server.Sessions())
46-
mcp.NotifySessions(sessions, "notifications/resources/list_changed", params)
35+
if serverSession != nil {
36+
mcp.HandleNotify(ctx, serverSession, "notifications/resources/list_changed", params)
4737
}
4838
},
4939
PromptListChangedHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.PromptListChangedParams) {
50-
if server != nil {
51-
sessions := slices.Collect(server.Sessions())
52-
mcp.NotifySessions(sessions, "notifications/prompts/list_changed", params)
40+
if serverSession != nil {
41+
mcp.HandleNotify(ctx, serverSession, "notifications/prompts/list_changed", params)
5342
}
5443
},
5544
ProgressNotificationHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.ProgressNotificationParams) {
56-
allSessions(server, func (session *mcp.ServerSession) {session.NotifyProgress(ctx, params)})
57-
},
58-
LoggingMessageHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.LoggingMessageParams) {
59-
allSessions(server, func (session *mcp.ServerSession) {session.Log(ctx, params)})
60-
},
61-
}
62-
}
63-
64-
func stdioNotifications(serverSession *mcp.ServerSession) *mcp.ClientOptions {
65-
return &mcp.ClientOptions{
66-
CreateMessageHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.CreateMessageParams) (*mcp.CreateMessageResult, error) {
67-
// Handle create messages if needed
68-
return nil, fmt.Errorf("create messages not supported")
69-
},
70-
ToolListChangedHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.ToolListChangedParams) {
71-
mcp.HandleNotify(ctx, serverSession, "notifications/tools/list_changed", params)
72-
},
73-
ResourceListChangedHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.ResourceListChangedParams) {
74-
mcp.HandleNotify(ctx, serverSession, "notifications/resources/list_changed", params)
75-
},
76-
PromptListChangedHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.PromptListChangedParams) {
77-
mcp.HandleNotify(ctx, serverSession, "notifications/prompts/list_changed", params)
78-
},
79-
ProgressNotificationHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.ProgressNotificationParams) {
80-
serverSession.NotifyProgress(ctx, params)
45+
if serverSession != nil {
46+
serverSession.NotifyProgress(ctx, params)
47+
}
8148
},
8249
LoggingMessageHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.LoggingMessageParams) {
83-
serverSession.Log(ctx, params)
50+
if serverSession != nil {
51+
serverSession.Log(ctx, params)
52+
}
8453
},
8554
}
8655
}

go.mod

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ require (
88
github.com/containerd/errdefs v1.0.0
99
github.com/distribution/reference v0.6.0
1010
github.com/docker/cli v28.2.2+incompatible
11+
github.com/docker/cli-docs-tool v0.10.0
1112
github.com/docker/docker v28.2.2+incompatible
1213
github.com/docker/docker-credential-helpers v0.9.3
1314
github.com/fsnotify/fsnotify v1.9.0
1415
github.com/google/go-containerregistry v0.20.6
1516
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
1617
github.com/mikefarah/yq/v4 v4.45.4
1718
github.com/modelcontextprotocol/go-sdk v0.2.0
19+
github.com/pkg/errors v0.9.1
1820
github.com/sigstore/cosign/v2 v2.5.0
1921
github.com/sigstore/sigstore v1.9.5
2022
github.com/spf13/cobra v1.9.1
@@ -41,6 +43,7 @@ require (
4143
github.com/cloudflare/circl v1.6.1 // indirect
4244
github.com/containerd/errdefs/pkg v0.3.0 // indirect
4345
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
46+
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
4447
github.com/creack/pty v1.1.24 // indirect
4548
github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 // indirect
4649
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -108,10 +111,10 @@ require (
108111
github.com/opencontainers/image-spec v1.1.1 // indirect
109112
github.com/opentracing/opentracing-go v1.2.0 // indirect
110113
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
111-
github.com/pkg/errors v0.9.1 // indirect
112114
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
113115
github.com/prometheus/client_model v0.6.2 // indirect
114116
github.com/rivo/uniseg v0.4.7 // indirect
117+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
115118
github.com/sagikazarmark/locafero v0.9.0 // indirect
116119
github.com/sassoftware/relic v7.2.1+incompatible // indirect
117120
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
@@ -167,4 +170,4 @@ require (
167170
k8s.io/client-go v0.33.1 // indirect
168171
)
169172

170-
replace github.com/modelcontextprotocol/go-sdk => github.com/slimslenderslacks/go-sdk v0.0.0-20250731002857-c781e1b26d39
173+
replace github.com/modelcontextprotocol/go-sdk => github.com/slimslenderslacks/go-sdk v0.0.0-20250801003645-bd8989837cf8

go.sum

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ github.com/containerd/stargz-snapshotter/estargz v0.16.3/go.mod h1:uyr4BfYfOj3G9
195195
github.com/coreos/go-oidc/v3 v3.14.1 h1:9ePWwfdwC4QKRlCXsJGou56adA/owXczOzwKdOumLqk=
196196
github.com/coreos/go-oidc/v3 v3.14.1/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU=
197197
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
198+
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
199+
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
198200
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
199201
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
200202
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
@@ -218,6 +220,8 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfr
218220
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
219221
github.com/docker/cli v28.2.2+incompatible h1:qzx5BNUDFqlvyq4AHzdNB7gSyVTmU4cgsyN9SdInc1A=
220222
github.com/docker/cli v28.2.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
223+
github.com/docker/cli-docs-tool v0.10.0 h1:bOD6mKynPQgojQi3s2jgcUWGp/Ebqy1SeCr9VfKQLLU=
224+
github.com/docker/cli-docs-tool v0.10.0/go.mod h1:5EM5zPnT2E7yCLERZmrDA234Vwn09fzRHP4aX1qwp1U=
221225
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
222226
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
223227
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
@@ -590,6 +594,7 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
590594
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
591595
github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a h1:w3tdWGKbLGBPtR/8/oO74W6hmz0qE5q0z9aqSAewaaM=
592596
github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a/go.mod h1:S8kfXMp+yh77OxPD4fdM6YUknrZpQxLhvxzS4gDHENY=
597+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
593598
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
594599
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
595600
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
@@ -639,8 +644,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
639644
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
640645
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA=
641646
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
642-
github.com/slimslenderslacks/go-sdk v0.0.0-20250731002857-c781e1b26d39 h1:c20nHcC1qDWA4QFmddgvSKhwhPgAdzQ+9q1t2jbvAqg=
643-
github.com/slimslenderslacks/go-sdk v0.0.0-20250731002857-c781e1b26d39/go.mod h1:0sL9zUKKs2FTTkeCCVnKqbLJTw5TScefPAzojjU459E=
647+
github.com/slimslenderslacks/go-sdk v0.0.0-20250801003645-bd8989837cf8 h1:WEZOvnSBzsG/0ytdo0YleG3n6gMx6v19tk+A/yoV4WA=
648+
github.com/slimslenderslacks/go-sdk v0.0.0-20250801003645-bd8989837cf8/go.mod h1:0sL9zUKKs2FTTkeCCVnKqbLJTw5TScefPAzojjU459E=
644649
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
645650
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
646651
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=

vendor/github.com/modelcontextprotocol/go-sdk/internal/jsonrpc2/wire.go

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/modelcontextprotocol/go-sdk/jsonschema/doc.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/modelcontextprotocol/go-sdk/jsonschema/schema.go

Lines changed: 51 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)