The controlled assembly of nanomaterials into desired architectures presents many opportunities; however, current preparations lack spatial precision and versatility in developing complex nano-architectures. Inspired by the amphiphilic nature of surfactants, we develop a facile approach to guide nanomaterial integration – spatial organization and distribution – in metal-organic frameworks (MOFs). Named surfactant tunable spatial architecture (STAR), the technology leverages the varied interactions of surfactants with nanoparticles and MOF constituents, respectively, to direct nanoparticle arrangement while molding the growing framework. By surfactant matching, the approach achieves not only tunable and precise integration of diverse nanomaterials in different MOF structures, but also fast and aqueous synthesis, in solution and on solid substrates. Employing the approach, we develop a dual-probe STAR that comprises peripheral working probes and central reference probes to achieve differential responsiveness to biomarkers. When applied for the direct profiling of clinical ascites, STAR reveals glycosylation signatures of extracellular vesicles and differentiates cancer patient prognosis.