Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(mcp): add module client for MCP server connections

Steven Enamakela6e810150477
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index 90e7dc6448..cec5b9a75c 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -463,6 +463,10 @@ impl McpConfiguredClient {
// The lifecycle recorded intent before this confidential
// call; retrying the same configuration recovers the
// module's idempotent receipt after a cancelled caller.
+ // Servers and audit rows from before the storage contract
+ // move into the module's storage before it reads them.
+ // Best effort: a failure is retried at the next open.
+ crate::modules::import_legacy_mcp(std::path::Path::new(&self.data_dir)).await;
let reply = self.port.open_configured(&self.data_dir, &config).await;
state.open_replied(reply.clone().map_err(|_| ()));
reply?;
diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rs
index b25e23cc0e..1552bb6a19 100644
--- a/crates/openhuman-core/src/modules/mod.rs
+++ b/crates/openhuman-core/src/modules/mod.rs
@@ -97,6 +97,8 @@ pub(crate) mod storage_host;
#[cfg(feature = "modules")]
mod storage_host_linked;
#[cfg(feature = "modules")]
+mod storage_import_tinymcp;
+#[cfg(feature = "modules")]
pub mod tinybox;
#[cfg(feature = "modules")]
mod tokenjuice_host;
@@ -123,3 +125,16 @@ pub use schemas::{all_controller_schemas, all_registered_controllers};
#[doc(hidden)]
pub use source::local_artifact;
pub use types::{LoadPolicy, ModuleRecord, ModuleSource, ModuleState, ModuleStatus, PlatformAsset};
+
+/// Imports tinymcp's legacy SQLite files under `data_dir` into the module's
+/// storage, once per directory. Never fails the caller: an error is logged and
+/// the import is retried at the next open.
+pub async fn import_legacy_mcp(data_dir: &std::path::Path) {
+ #[cfg(feature = "modules")]
+ match storage_import_tinymcp::import_legacy(data_dir).await {
+ Ok(outcome) => log::debug!("[mcp] legacy storage import: {outcome:?}"),
+ Err(error) => log::warn!("[mcp] legacy storage import failed, will retry: {error:#}"),
+ }
+ #[cfg(not(feature = "modules"))]
+ let _ = data_dir;
+}