diff --git a/pkg/mcp/tools_build.go b/pkg/mcp/tools_build.go index 52576187aa..e1f6a6758f 100644 --- a/pkg/mcp/tools_build.go +++ b/pkg/mcp/tools_build.go @@ -20,6 +20,11 @@ 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.Load() { + err = fmt.Errorf("the server is currently in read-only mode; to enable write operations, set FUNC_ENABLE_MCP_WRITE in the server environment and restart the server") + return + } + out, err := s.executor.Execute(ctx, "build", input.Args()...) if err != nil { err = fmt.Errorf("%w\n%s", err, string(out))