I need to run a blender script server side and would like to know if there is a way to run just some of blender libraries for server optimization purposes . My script is just importing a heavy glb file and exporting it to glb again ( because blender cleans the file by itself i chose it as part of the pipeline .)
Generally the answer is "no", blender cant run as a standalone module except if you build it on your own (never tried that to be honest).
What I would suggest instead, is to run Blender on the background and load your scripts and your 3d mesh, do all the processing and export your file as needed.
Here you may find all the possible and useful args for your commandline
it will take some more tweaking in order to set your custom scripts either on the blender startup or as additonal arguments on the commandline before the execution.