Skip to content

Commit a4ff009

Browse files
gofmt updates
1 parent f289aef commit a4ff009

File tree

5 files changed

+19
-28
lines changed

5 files changed

+19
-28
lines changed

cmd/docker-mcp/internal/gateway/clientpool.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,6 @@ func (cg *clientGetter) GetClient(ctx context.Context) (mcpclient.Client, error)
353353
var readOnly *bool
354354
if cg.clientConfig != nil {
355355
readOnly = cg.clientConfig.readOnly
356-
} else {
357-
readOnly = nil
358356
}
359357
args, env := cg.cp.argsAndEnv(cg.serverConfig, readOnly, targetConfig)
360358

@@ -381,15 +379,11 @@ func (cg *clientGetter) GetClient(ctx context.Context) (mcpclient.Client, error)
381379
},
382380
}
383381

384-
// Use the original context instead of creating a timeout context
385-
// to avoid cancellation issues
386382
var ss *mcp.ServerSession
387383
var server *mcp.Server
388384
if cg.clientConfig != nil {
389385
ss = cg.clientConfig.serverSession
390386
server = cg.clientConfig.server
391-
} else {
392-
ss = nil
393387
}
394388
if err := client.Initialize(ctx, initParams, cg.cp.Verbose, ss, server); err != nil {
395389
return nil, err

cmd/docker-mcp/internal/gateway/run.go

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ import (
1717
)
1818

1919
type ServerSessionCache struct {
20-
Roots []*mcp.Root
20+
Roots []*mcp.Root
2121
}
2222

23-
type SubsAction int
23+
// type SubsAction int
2424

25-
const (
26-
subscribe SubsAction = 0
27-
unsubscribe SubsAction = 1
28-
)
25+
// const (
26+
// subscribe SubsAction = 0
27+
// unsubscribe SubsAction = 1
28+
// )
2929

30-
type SubsMessage struct {
31-
uri string
32-
action SubsAction
33-
ss *mcp.ServerSession
34-
}
30+
// type SubsMessage struct {
31+
// uri string
32+
// action SubsAction
33+
// ss *mcp.ServerSession
34+
// }
3535

3636
type Gateway struct {
3737
Options
@@ -40,7 +40,7 @@ type Gateway struct {
4040
clientPool *clientPool
4141
mcpServer *mcp.Server
4242
health health.State
43-
subsChannel chan SubsMessage
43+
// subsChannel chan SubsMessage
4444

4545
sessionCacheMu sync.RWMutex
4646
sessionCache map[*mcp.ServerSession]*ServerSessionCache
@@ -63,7 +63,6 @@ func NewGateway(config Config, docker docker.Client) *Gateway {
6363
},
6464
clientPool: newClientPool(config.Options, docker),
6565
sessionCache: make(map[*mcp.ServerSession]*ServerSessionCache),
66-
subsChannel: make(chan SubsMessage, 10),
6766
}
6867
}
6968

@@ -113,26 +112,26 @@ func (g *Gateway) Run(ctx context.Context) error {
113112
Name: "Docker AI MCP Gateway",
114113
Version: "2.0.1",
115114
}, &mcp.ServerOptions{
116-
SubscribeHandler: func(ctx context.Context, ss *mcp.ServerSession, params *mcp.SubscribeParams) error {
115+
SubscribeHandler: func(_ context.Context, _ *mcp.ServerSession, params *mcp.SubscribeParams) error {
117116
log("- Client subscribed to URI:", params.URI)
118117
// The MCP SDK doesn't provide ServerSession in SubscribeHandler because it already
119118
// keeps track of the mapping between ServerSession and subscribed resources in the Server
120119
// g.subsChannel <- SubsMessage{uri: params.URI, action: subscribe , ss: ss}
121120
return nil
122121
},
123-
UnsubscribeHandler: func(ctx context.Context, ss *mcp.ServerSession, params *mcp.UnsubscribeParams) error {
122+
UnsubscribeHandler: func(_ context.Context, _ *mcp.ServerSession, params *mcp.UnsubscribeParams) error {
124123
log("- Client unsubscribed from URI:", params.URI)
125124
// The MCP SDK doesn't provide ServerSession in UnsubscribeHandler because it already
126125
// keeps track of the mapping ServerSession and subscribed resources in the Server
127126
// g.subsChannel <- SubsMessage{uri: params.URI, action: unsubscribe , ss: ss}
128127
return nil
129128
},
130-
RootsListChangedHandler: func(ctx context.Context, ss *mcp.ServerSession, params *mcp.RootsListChangedParams) {
129+
RootsListChangedHandler: func(ctx context.Context, ss *mcp.ServerSession, _ *mcp.RootsListChangedParams) {
131130
log("- Client roots list changed: ", ss.ID())
132131
g.ListRoots(ctx, ss)
133132
},
134133
CompletionHandler: nil,
135-
InitializedHandler: func(ctx context.Context, ss *mcp.ServerSession, params *mcp.InitializedParams) {
134+
InitializedHandler: func(ctx context.Context, ss *mcp.ServerSession, _ *mcp.InitializedParams) {
136135
log("- Client initialized: ", ss.ID())
137136
g.ListRoots(ctx, ss)
138137
},

cmd/docker-mcp/internal/gateway/transport.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (t *contextAwareStdioTransport) Connect(ctx context.Context) (mcp.Connectio
147147
if err != nil {
148148
return nil, err
149149
}
150-
150+
151151
return newContextAwareStdioConn(t.ctx, originalConn), nil
152152
}
153153

@@ -174,7 +174,7 @@ func (c *contextAwareStdioConn) Read(ctx context.Context) (jsonrpc.Message, erro
174174
msg jsonrpc.Message
175175
err error
176176
}
177-
177+
178178
ch := make(chan result, 1)
179179
go func() {
180180
msg, err := c.originalConn.Read(context.Background())

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ func (c *remoteMCPClient) Initialize(ctx context.Context, _ *mcp.InitializeParam
6161

6262
switch strings.ToLower(transport) {
6363
case "sse":
64-
// TODO: Need to implement custom HTTP client with headers for SSE
6564
mcpTransport = mcp.NewSSEClientTransport(url, &mcp.SSEClientTransportOptions{})
6665
case "http", "streamable", "streaming", "streamable-http":
67-
// TODO: Need to implement custom HTTP client with headers for streaming
6866
mcpTransport = mcp.NewStreamableClientTransport(url, &mcp.StreamableClientTransportOptions{})
6967
default:
7068
return fmt.Errorf("unsupported remote transport: %s", transport)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (c *stdioMCPClient) Initialize(ctx context.Context, _ *mcp.InitializeParams
4747
c.client = mcp.NewClient(&mcp.Implementation{
4848
Name: "docker-mcp-gateway",
4949
Version: "1.0.0",
50-
}, notifications(ss,server))
50+
}, notifications(ss, server))
5151

5252
session, err := c.client.Connect(ctx, transport)
5353
if err != nil {

0 commit comments

Comments
 (0)