The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(mcp): move server instructions into handler and use tinymcp_bus types
Steven Enamakelc5c752bfb8f6
diff --git a/crates/openhuman-core/src/mcp/server/handler.rs b/crates/openhuman-core/src/mcp/server/handler.rsindex b17b3fd353..616f011474 100644--- a/crates/openhuman-core/src/mcp/server/handler.rs+++ b/crates/openhuman-core/src/mcp/server/handler.rs@@ -9,6 +9,8 @@ use tinymcp_bus::{ServerHostCall, ServerHostReply, ToolCallError};use super::{resources, subagent_depth, tools};+const INSTRUCTIONS: &str = "OpenHuman MCP exposes first-level core integration: inspect the live tool catalog with core.list_tools or core.tool_instructions, inspect subagents with agent.list_subagents, run a standalone subagent with agent.run_subagent, use web_search or web_answer for live web lookups (and searxng_search when self-hosted search is enabled), and use memory.recall (answer with citations), memory.fetch or memory.list to read memory, and memory.learn or memory.forget to change it.";+/// Apply the host-owned part of a validated TinyMCP server callback.pub(super) async fn dispatch(call: ServerHostCall) -> ServerHostReply {match call {@@ -31,13 +33,15 @@ pub(super) async fn dispatch(call: ServerHostCall) -> ServerHostReply {name,arguments,} => {- let depth = header_string(&headers, subagent_depth::HEADER_SUBAGENT_DEPTH)- .and_then(subagent_depth::parse_header);+ let depth = subagent_depth::parse_header(header_string(+ &headers,+ subagent_depth::HEADER_SUBAGENT_DEPTH,+ ));log::trace!("[mcp_server] tools/call tool={name} client_source_type={source_type} chain_depth={depth:?}");let result = subagent_depth::scope(- depth.unwrap_or_default(),+ depth,tools::call_tool(&name, Value::Object(arguments), &source_type),).await;@@ -60,7 +64,7 @@ pub(super) async fn dispatch(call: ServerHostCall) -> ServerHostReply {/// Declarations frozen into a module-owned server session.pub(super) fn declarations() -> (Value, String, Vec<Value>) {let info = tinymcp_bus::ServerInfo::new("openhuman-core", env!("CARGO_PKG_VERSION"))- .with_instructions(super::INSTRUCTIONS);+ .with_instructions(INSTRUCTIONS);let resources = resources::resource_specs().into_iter().filter_map(|resource| serde_json::to_value(resource).ok())diff --git a/crates/openhuman-core/src/mcp/server/resources.rs b/crates/openhuman-core/src/mcp/server/resources.rsindex 16054f3a1c..189f0851f8 100644--- a/crates/openhuman-core/src/mcp/server/resources.rs+++ b/crates/openhuman-core/src/mcp/server/resources.rs@@ -20,7 +20,7 @@//! a matching catalog entry fails that test and therefore CI.use serde_json::{json, Value};-use tinymcp::{ResourceSpec, ToolCallError};+use tinymcp_bus::{ResourceSpec, ToolCallError};/// Every bundled prompt is markdown.const MIME_TYPE: &str = "text/markdown";@@ -164,7 +164,7 @@ pub fn resource_specs() -> Vec<ResourceSpec> {/// The `resources/read` result for `uri`, or/// [`ToolCallError::ResourceNotFound`] (`-32002`) when the catalog has no such-/// entry. `tinymcp` has already rejected a missing or blank `uri`.+/// entry. TinyMCP has already rejected a missing or blank `uri`.pub fn read_resource(uri: &str) -> Result<Value, ToolCallError> {let resource = RESOURCE_CATALOG.iter()diff --git a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs b/crates/openhuman-core/src/mcp/server/tools/dispatch.rsindex 889731f61a..c2205f5175 100644--- a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs+++ b/crates/openhuman-core/src/mcp/server/tools/dispatch.rs@@ -11,7 +11,7 @@ use super::super::write_dispatch;use super::params::{build_rpc_params, validate_controller_params};use super::specs::{base_tool_specs, tool_specs_for_loaded_config};use super::types::McpToolSpec;-use tinymcp::ToolCallError;+use tinymcp_bus::ToolCallError;/// The tools `tools/list` advertises and `tools/call` accepts: every tool the/// loaded config can serve, or only the config-independent base set when thediff --git a/crates/openhuman-core/src/mcp/server/tools/mod.rs b/crates/openhuman-core/src/mcp/server/tools/mod.rsindex 673e6b67a4..f297530960 100644--- a/crates/openhuman-core/src/mcp/server/tools/mod.rs+++ b/crates/openhuman-core/src/mcp/server/tools/mod.rs@@ -3,7 +3,7 @@//! Split into focused sub-modules://! - `types` — `McpToolSpec` and the argument/limit constants//! - `specs` — tool spec builders, schema helpers, and the conversion to-//! `tinymcp::ServerToolSpec`+//! `tinymcp_bus::ServerToolSpec`//! - `params` — OpenHuman's per-tool argument policy and RPC param//! construction, over `tinymcp::server::args`' generic validators//! - `dispatch` — `call_tool`, `list_tool_specs`, agent/subagent handlers@@ -33,7 +33,7 @@ pub use dispatch::{call_tool, list_tool_specs, tool_error, tool_success};#[cfg(feature = "mcp")]pub use specs::{server_tool_spec, tool_specs};#[cfg(feature = "mcp")]-pub use tinymcp::ToolCallError;+pub use tinymcp_bus::ToolCallError;pub use types::McpToolSpec;diff --git a/crates/openhuman-core/src/mcp/server/tools/params.rs b/crates/openhuman-core/src/mcp/server/tools/params.rsindex d8dbdf34ff..b27a82d085 100644--- a/crates/openhuman-core/src/mcp/server/tools/params.rs+++ b/crates/openhuman-core/src/mcp/server/tools/params.rs@@ -4,7 +4,7 @@ use tinymcp::server::args::{object_arguments, optional_non_empty_string, optional_positive_u64,reject_unexpected_arguments, required_non_empty_string, required_non_empty_string_array,};-use tinymcp::ToolCallError;+use tinymcp_bus::ToolCallError;use crate::core::all;diff --git a/crates/openhuman-core/src/mcp/server/tools/specs.rs b/crates/openhuman-core/src/mcp/server/tools/specs.rsindex 53522c46cd..89aebfec27 100644--- a/crates/openhuman-core/src/mcp/server/tools/specs.rs+++ b/crates/openhuman-core/src/mcp/server/tools/specs.rs@@ -1,6 +1,6 @@use crate::tools::schema_cache::static_schema;use serde_json::{json, Value};-use tinymcp::ServerToolSpec;+use tinymcp_bus::ServerToolSpec;use super::types::{McpToolSpec, FETCH_MODES, ITEM_KINDS, LEARNING_KINDS, MEMORY_FORGET_MAX_IDS, MEMORY_MAX_LIMIT,@@ -244,7 +244,7 @@ pub fn tool_specs_for_config(specs}-/// A catalog entry as `tinymcp` advertises it in `tools/list`.+/// A catalog entry as TinyMCP advertises it in `tools/list`.pub fn server_tool_spec(spec: &McpToolSpec) -> ServerToolSpec {ServerToolSpec::new(spec.name, spec.description, spec.input_schema.clone()).with_title(spec.title)