This code is totally untested, but hopefully it works. The code requires three inputs. The first is the full path to your folder containing the gdbs. The second is the saved map document file you wish to add the layers to. The third is an empty group layer file (.lyr). The code basically an iteration through your geodatabases, creating a new group layer for each, and then iterating and adding each feature class as a layer to the group layer.
#Full path to folder containing GDBs
inFolder = r"C:\Test\folder"
#Map document to add layers to
mapDoc = r"C:\Test\mapdoc.mxd"
#Group layer .lyr file
grpLyr = r"C:\Test\grouplayer.lyr"
#----End locals
#import modules
print "importing"
import arcpy
import os
#create mxd objects
print "creating map objects"
mxd = arcpy.mapping.MapDocument (mapDoc)
df = arcpy.mapping.ListDataFrames (mxd)[0]
#set arcpy env workspace to input folder
print "setting workspace"
arcpy.env.workspace = inFolder
#list geodatabases
print "listing geodatabases"
gdbs = arcpy.ListWorkspaces (workspace_type = "FileGDB")
#iterate geodatabases
print "iterating", len (gdbs), "file geodatabases"
for gdb in gdbs:
print "exploring", gdb
#create group layer object
groupLayer = arcpy.mapping.Layer (grpLyr)
#rename layer to gdb name
groupLayer.name = gdb
#add group layer to data frame
arcpy.mapping.AddLayer (df, groupLayer)
#change workspace to gdb
gdbFullPath = os.path.join (inFolder, gdb)
arcpy.env.workspace = gdbFullPath
#list feature classes in gdb
fcs = arcpy.ListFeatureClasses ()
#iterate fcs
print "adding", len (fcs), "layers"
for fc in fcs:
#create feature class layer object
lyr = arcpy.mapping.Layer (fc)
#add layer to group layer
arcpy.AddLayerToGroup (df, groupLayer, lyr)
print "saving map file"
mxd.save ()
del mxd
del df
print "done"