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 and HTTP server support

Steven Enamakel784190a79be3
diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rs
index 3612cd0c7d..8e10d7978a 100644
--- a/crates/openhuman-core/src/channels/bus/delivery.rs
+++ b/crates/openhuman-core/src/channels/bus/delivery.rs
@@ -1,9 +1,7 @@
//! Captured managed transport for module-owned progressive replies.
use crate::backend::{BackendApiError, BackendClient};
-use crate::modules::{
- channel_runtime::ChannelRuntimeLease,
- client::{ModuleCallError, ModuleClient},
-};
+use crate::modules::channel_runtime::ChannelRuntimeLease;
+use tinybus::module::{ModuleCallError, ModuleClient};
use crate::security::credentials::session_support::{
get_session_token, is_local_session_token, BackendCredential,
};
diff --git a/crates/openhuman-core/src/channels/controllers/ops/discord.rs b/crates/openhuman-core/src/channels/controllers/ops/discord.rs
index 73f0390fd0..badbc4f551 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/discord.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/discord.rs
@@ -5,10 +5,8 @@
use crate::config::Config;
use crate::core::Outcome;
-use crate::modules::{
- channel_controller::{self, DiscordReply},
- client::ModuleClient,
-};
+use crate::modules::channel_controller::{self, DiscordReply};
+use tinybus::module::ModuleClient;
use crate::security::credentials;
use tinychannels_bus::{
controllers::{BotPermissionCheck, DiscordGuild, DiscordTextChannel},
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index 71701f77fe..853c43da4f 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -26,10 +26,8 @@ use tinymcp_bus::{
ValidateServerArgumentsRequest,
};
-use crate::{
- config::Config,
- ,
-};
+use crate::config::Config;
+use tinybus::module::{ModuleCallError, ModuleClient};
const MODULE: &str = "tinymcp";
const TRANSITION_TIMEOUT: Duration = Duration::from_secs(30);
diff --git a/crates/openhuman-core/src/mcp/server/http.rs b/crates/openhuman-core/src/mcp/server/http.rs
index ac745f36da..c1beae4397 100644
--- a/crates/openhuman-core/src/mcp/server/http.rs
+++ b/crates/openhuman-core/src/mcp/server/http.rs
@@ -17,7 +17,8 @@ use futures_util::stream;
use serde_json::{Map, Value};
use tinymcp_bus::{ServerHttpSessionMethod, ServerHttpSessionRequest, HEADER_SESSION_ID};
-use crate::{config::Config, modules::client::ModuleCallError};
+use crate::config::Config;
+use tinybus::module::ModuleCallError;
use super::module::{headers_object, ServerError, ServerPort, ServerSession};
diff --git a/crates/openhuman-core/src/mcp/server/module.rs b/crates/openhuman-core/src/mcp/server/module.rs
index 7b2ad0f142..eb8be8f7e8 100644
--- a/crates/openhuman-core/src/mcp/server/module.rs
+++ b/crates/openhuman-core/src/mcp/server/module.rs
@@ -20,10 +20,8 @@ use tinymcp_bus::{
use tokio_util::sync::CancellationToken;
use uuid::Uuid;
-use crate::{
- config::Config,
- ,
-};
+use crate::config::Config;
+use tinybus::module::{ModuleCallError, ModuleClient};
use super::handler;
diff --git a/crates/openhuman-core/src/modules/boot.rs b/crates/openhuman-core/src/modules/boot.rs
index afffe9be09..effa1f3012 100644
--- a/crates/openhuman-core/src/modules/boot.rs
+++ b/crates/openhuman-core/src/modules/boot.rs
@@ -15,7 +15,7 @@
//! network on something nobody has asked for yet.
use super::types::LoadPolicy;
-use super::{host, ops, registry};
+use super::{ops, registry, runtime};
use crate::config::Config;
/// Load the modules that should be serving before the first request.
@@ -29,7 +29,7 @@ pub async fn load_declared_modules(config: &Config) {
return;
}
- let runtime = match host::runtime().await {
+ let runtime = match runtime::runtime().await {
Ok(runtime) => runtime,
Err(err) => {
log::warn!("[modules] boot load skipped: the module bus could not start: {err}");
diff --git a/crates/openhuman-core/src/modules/documents.rs b/crates/openhuman-core/src/modules/documents.rs
index f8710dd24b..b85cc8abc6 100644
--- a/crates/openhuman-core/src/modules/documents.rs
+++ b/crates/openhuman-core/src/modules/documents.rs
@@ -189,13 +189,13 @@ pub async fn ensure_ready(config: &Config) -> Result<(), DocumentCallError> {
/// Ensure the module is serving and hand back what a call needs.
async fn ready(
config: &Config,
-) -> Result<(&'static host::ModuleRuntime, &'static super::ModuleRecord), DocumentCallError> {
+) -> Result<(&'static tinybus::module::ModuleRuntime, &'static super::ModuleRecord), DocumentCallError> {
ops::ensure_loaded(config, MODULE_ID)
.await
.map_err(DocumentCallError::Unavailable)?;
let record = registry::find(MODULE_ID)
.ok_or_else(|| DocumentCallError::Unavailable(format!("unknown module '{MODULE_ID}'")))?;
- let runtime = host::runtime()
+ let runtime = super::runtime::runtime()
.await
.map_err(|_| DocumentCallError::Unavailable("the module bus is not running".to_string()))?;
Ok((runtime, record))
@@ -203,7 +203,7 @@ async fn ready(
/// A proxy for the module's object.
fn proxy(
- runtime: &'static host::ModuleRuntime,
+ runtime: &'static tinybus::module::ModuleRuntime,
record: &super::ModuleRecord,
) -> Result<tinybus::Proxy, DocumentCallError> {
runtime
diff --git a/crates/openhuman-core/src/modules/voice.rs b/crates/openhuman-core/src/modules/voice.rs
index 75962a4ca4..dfb29e9811 100644
--- a/crates/openhuman-core/src/modules/voice.rs
+++ b/crates/openhuman-core/src/modules/voice.rs
@@ -685,7 +685,7 @@ where
.map_err(VoiceCallError::Unavailable)?;
let record = registry::find(MODULE_ID)
.ok_or_else(|| VoiceCallError::Unavailable(format!("unknown module '{MODULE_ID}'")))?;
- let runtime = host::runtime()
+ let runtime = super::runtime::runtime()
.await
.map_err(|_| VoiceCallError::Unavailable("the module bus is not running".to_string()))?;
let proxy = runtime
diff --git a/crates/openhuman-core/src/modules/wallet.rs b/crates/openhuman-core/src/modules/wallet.rs
index 0632b377f7..33f66b0aa4 100644
--- a/crates/openhuman-core/src/modules/wallet.rs
+++ b/crates/openhuman-core/src/modules/wallet.rs
@@ -497,13 +497,13 @@ pub async fn ensure_ready(config: &Config) -> Result<(), WalletCallError> {
/// Ensure the module is serving and hand back what a call needs.
async fn ready(
config: &Config,
-) -> Result<(&'static host::ModuleRuntime, &'static super::ModuleRecord), WalletCallError> {
+) -> Result<(&'static tinybus::module::ModuleRuntime, &'static super::ModuleRecord), WalletCallError> {
ops::ensure_loaded(config, MODULE_ID)
.await
.map_err(WalletCallError::Unavailable)?;
let record = registry::find(MODULE_ID)
.ok_or_else(|| WalletCallError::Unavailable(format!("unknown module '{MODULE_ID}'")))?;
- let runtime = host::runtime()
+ let runtime = super::runtime::runtime()
.await
.map_err(|_| WalletCallError::Unavailable("the module bus is not running".to_string()))?;
Ok((runtime, record))
@@ -511,7 +511,7 @@ async fn ready(
/// A proxy for the module's object.
fn proxy(
- runtime: &'static host::ModuleRuntime,
+ runtime: &'static tinybus::module::ModuleRuntime,
record: &super::ModuleRecord,
) -> Result<tinybus::Proxy, WalletCallError> {
runtime
diff --git a/crates/openhuman-core/src/tools/impl/network/gitbooks.rs b/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
index e21c8f10ab..740c9a124a 100644
--- a/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
@@ -2,7 +2,7 @@
//! confidential one-shot tool-call contract.
use crate::{
- config::Config, inference::provider::factory::redact_endpoint, modules::client::ModuleClient,
+ config::Config, inference::provider::factory::redact_endpoint,
};
use async_trait::async_trait;
use serde_json::{json, Value};