Skip to content

Commit da02a28

Browse files
gofmt update
1 parent bc4dcf4 commit da02a28

File tree

14 files changed

+59
-54
lines changed

14 files changed

+59
-54
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"strings"
99
"sync"
1010

11-
"github.com/modelcontextprotocol/go-sdk/mcp"
1211
"github.com/modelcontextprotocol/go-sdk/jsonschema"
12+
"github.com/modelcontextprotocol/go-sdk/mcp"
1313
"golang.org/x/sync/errgroup"
1414
)
1515

@@ -156,7 +156,7 @@ func (g *Gateway) listCapabilities(ctx context.Context, configuration Configurat
156156
mcpTool.InputSchema.Type = "object"
157157
} else {
158158
mcpTool.InputSchema.Type = tool.Parameters.Type
159-
// Note: tool.Parameters.Properties.ToMap() returns map[string]any
159+
// Note: tool.Parameters.Properties.ToMap() returns map[string]any
160160
// but we need map[string]*jsonschema.Schema
161161
// This is a complex conversion that needs proper implementation
162162
}

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type clientPool struct {
3232
}
3333

3434
type clientConfig struct {
35-
readOnly *bool
35+
readOnly *bool
3636
serverSession *mcp.ServerSession
3737
}
3838

@@ -350,7 +350,11 @@ func (cg *clientGetter) GetClient(ctx context.Context) (mcpclient.Client, error)
350350

351351
image := cg.serverConfig.Spec.Image
352352
var readOnly *bool
353-
if cg.clientConfig != nil { readOnly = cg.clientConfig.readOnly} else { readOnly = nil }
353+
if cg.clientConfig != nil {
354+
readOnly = cg.clientConfig.readOnly
355+
} else {
356+
readOnly = nil
357+
}
354358
args, env := cg.cp.argsAndEnv(cg.serverConfig, readOnly, targetConfig)
355359

356360
command := expandEnvList(eval.EvaluateList(cg.serverConfig.Spec.Command, cg.serverConfig.Config), env)
@@ -379,7 +383,11 @@ func (cg *clientGetter) GetClient(ctx context.Context) (mcpclient.Client, error)
379383
// Use the original context instead of creating a timeout context
380384
// to avoid cancellation issues
381385
var ss *mcp.ServerSession
382-
if cg.clientConfig != nil { ss = cg.clientConfig.serverSession} else { ss = nil }
386+
if cg.clientConfig != nil {
387+
ss = cg.clientConfig.serverSession
388+
} else {
389+
ss = nil
390+
}
383391
if _, err := client.Initialize(ctx, initParams, cg.cp.Verbose, ss); err != nil {
384392
return nil, err
385393
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ func TestStdioClientInitialization(t *testing.T) {
194194
serverConfig := catalog.ServerConfig{
195195
Name: "test-server",
196196
Spec: catalog.Server{
197-
Image: "mcp/brave-search@sha256:e13f4693a3421e2b316c8b6196c5c543c77281f9d8938850681e3613bba95115", // User should provide their image
197+
Image: "mcp/brave-search@sha256:e13f4693a3421e2b316c8b6196c5c543c77281f9d8938850681e3613bba95115", // User should provide their image
198198
Command: []string{},
199-
Env: []catalog.Env{{Name: "BRAVE_API_KEY", Value: "test_key"}},
199+
Env: []catalog.Env{{Name: "BRAVE_API_KEY", Value: "test_key"}},
200200
},
201201
Config: map[string]any{},
202202
Secrets: map[string]string{},
@@ -205,7 +205,7 @@ func TestStdioClientInitialization(t *testing.T) {
205205
// Create a real Docker CLI client
206206
dockerCli, err := command.NewDockerCli()
207207
require.NoError(t, err)
208-
208+
209209
dockerClient := docker.NewClient(dockerCli)
210210
clientPool := newClientPool(Options{
211211
Cpus: 1,
@@ -231,6 +231,6 @@ func TestStdioClientInitialization(t *testing.T) {
231231
// Basic assertions - user can customize based on expected behavior
232232
assert.NotNil(t, tools)
233233
assert.NotNil(t, tools.Tools)
234-
234+
235235
t.Logf("Successfully initialized stdio client and retrieved %d tools", len(tools.Tools))
236236
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ func (g *Gateway) mcpServerToolHandler(serverConfig catalog.ServerConfig, annota
3030
if annotations != nil && annotations.ReadOnlyHint {
3131
readOnlyHint = &annotations.ReadOnlyHint
3232
}
33-
33+
3434
// Convert to the generic version for our internal methods
3535
genericParams := &mcp.CallToolParams{
3636
Meta: params.Meta,
3737
Name: params.Name,
3838
Arguments: params.Arguments,
3939
}
40-
41-
client, err := g.clientPool.AcquireClient(ctx, serverConfig, getClientConfig( readOnlyHint, ss))
40+
41+
client, err := g.clientPool.AcquireClient(ctx, serverConfig, getClientConfig(readOnlyHint, ss))
4242
if err != nil {
4343
return nil, err
4444
}

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ func (g *Gateway) Run(ctx context.Context) error {
8383
Name: "Docker AI MCP Gateway",
8484
Version: "2.0.1",
8585
}, &mcp.ServerOptions{
86-
SubscribeHandler: nil,
87-
UnsubscribeHandler: nil,
86+
SubscribeHandler: nil,
87+
UnsubscribeHandler: nil,
8888
RootsListChangedHandler: nil,
89-
CompletionHandler: nil,
90-
InitializedHandler: nil,
91-
HasPrompts: true,
92-
HasResources: true,
93-
HasTools: true,
89+
CompletionHandler: nil,
90+
InitializedHandler: nil,
91+
HasPrompts: true,
92+
HasResources: true,
93+
HasTools: true,
9494
})
9595

9696
// Add interceptor middleware to the server
@@ -103,7 +103,7 @@ func (g *Gateway) Run(ctx context.Context) error {
103103
return fmt.Errorf("loading configuration: %w", err)
104104
}
105105

106-
// Central mode.
106+
// Central mode.
107107
if g.Central {
108108
log("> Initialized (in central mode) in", time.Since(start))
109109
if g.DryRun {
@@ -206,19 +206,19 @@ func (g *Gateway) reloadConfiguration(ctx context.Context, configuration Configu
206206
// Update capabilities
207207
// Clear existing capabilities and register new ones
208208
// Note: The new SDK doesn't have bulk set methods, so we register individually
209-
209+
210210
for _, tool := range capabilities.Tools {
211211
g.mcpServer.AddTool(tool.Tool, tool.Handler)
212212
}
213-
213+
214214
for _, prompt := range capabilities.Prompts {
215215
g.mcpServer.AddPrompt(prompt.Prompt, prompt.Handler)
216216
}
217-
217+
218218
for _, resource := range capabilities.Resources {
219219
g.mcpServer.AddResource(resource.Resource, resource.Handler)
220220
}
221-
221+
222222
// Resource templates are handled as regular resources in the new SDK
223223
for _, template := range capabilities.ResourceTemplates {
224224
// Convert ResourceTemplate to Resource
@@ -230,7 +230,7 @@ func (g *Gateway) reloadConfiguration(ctx context.Context, configuration Configu
230230
}
231231
g.mcpServer.AddResource(resource, template.Handler)
232232
}
233-
233+
234234
g.health.SetHealthy()
235235

236236
return nil

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"strings"
99
"sync"
1010

11-
"github.com/modelcontextprotocol/go-sdk/mcp"
1211
"github.com/docker/mcp-gateway/cmd/docker-mcp/internal/health"
12+
"github.com/modelcontextprotocol/go-sdk/mcp"
1313
)
1414

1515
func (g *Gateway) startStdioServer(ctx context.Context, stdin io.Reader, stdout io.Writer) error {

cmd/docker-mcp/internal/interceptors/block_secrets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func BlockSecretsMiddleware() mcp.Middleware[*mcp.ServerSession] {
5151
logf(" - Scanning tool call response for secrets...\n")
5252

5353
var contents string
54-
54+
5555
// Try to extract content from JSON result
5656
if jsonData, err := json.Marshal(result); err == nil {
5757
var callResult mcp.CallToolResult

cmd/docker-mcp/internal/interceptors/log_calls.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func LogCallsMiddleware() mcp.Middleware[*mcp.ServerSession] {
2121
// Extract tool name from params by marshaling/unmarshaling
2222
var toolName string
2323
var arguments any
24-
24+
2525
// Try to extract from JSON
2626
if jsonData, err := json.Marshal(params); err == nil {
2727
var callParams mcp.CallToolParams
@@ -30,7 +30,7 @@ func LogCallsMiddleware() mcp.Middleware[*mcp.ServerSession] {
3030
arguments = callParams.Arguments
3131
}
3232
}
33-
33+
3434
if toolName != "" {
3535
logf(" - Calling tool %s with arguments: %s\n", toolName, argumentsToString(arguments))
3636
} else {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ func stdioNotifications(serverSession *mcp.ServerSession) *mcp.ClientOptions {
4848
},
4949
LoggingMessageHandler: func(ctx context.Context, session *mcp.ClientSession, params *mcp.LoggingMessageParams) {
5050
if serverSession != nil {
51-
serverSession.Log(ctx, params)
51+
serverSession.Log(ctx, params)
5252
}
5353
},
5454
}
5555
}
56-

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (c *remoteMCPClient) Initialize(ctx context.Context, params *mcp.Initialize
8282

8383
c.session = session
8484
c.initialized.Store(true)
85-
85+
8686
// The Connect method handles initialization automatically in the new SDK
8787
return &mcp.InitializeResult{
8888
ProtocolVersion: "2024-11-05",
@@ -117,7 +117,7 @@ func (c *remoteMCPClient) ListResources(ctx context.Context, params *mcp.ListRes
117117

118118
func (c *remoteMCPClient) ListResourceTemplates(ctx context.Context, params *mcp.ListResourceTemplatesParams) (*mcp.ListResourceTemplatesResult, error) {
119119
if !c.initialized.Load() {
120-
return nil, fmt.Errorf("client not initialized")
120+
return nil, fmt.Errorf("client not initialized")
121121
}
122122
return c.session.ListResourceTemplates(ctx, params)
123123
}

0 commit comments

Comments
 (0)