From 85c2957248ade971171bfd51a08438e3791993a2 Mon Sep 17 00:00:00 2001 From: Ankitsinghsisodya Date: Fri, 15 May 2026 05:06:25 +0530 Subject: [PATCH] fix: prevent image push in read-only mode Added a check in the buildHandler function to return an error if an attempt is made to push images while the server is in read-only mode. This ensures that users are informed of the correct server state and can adjust their configurations accordingly. --- pkg/mcp/tools_build.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/mcp/tools_build.go b/pkg/mcp/tools_build.go index 52576187aa..3d55776942 100644 --- a/pkg/mcp/tools_build.go +++ b/pkg/mcp/tools_build.go @@ -20,6 +20,10 @@ var buildTool = &mcp.Tool{ } func (s *Server) buildHandler(ctx context.Context, r *mcp.CallToolRequest, input BuildInput) (result *mcp.CallToolResult, output BuildOutput, err error) { + if s.readonly && input.Push != nil && *input.Push { + err = fmt.Errorf("the server is in read-only mode; set FUNC_ENABLE_MCP_WRITE=true to push images") + return + } out, err := s.executor.Execute(ctx, "build", input.Args()...) if err != nil { err = fmt.Errorf("%w\n%s", err, string(out))