Skip to content

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

refactor(registry): replace install/config_assist with config_get/config_set

Steven Enamakel3d38ba8136d3
diff --git a/crates/openhuman-core/src/mcp/registry/schemas/handlers.rs b/crates/openhuman-core/src/mcp/registry/schemas/handlers.rs
index cb7bb8c34e..1a5436499f 100644
--- a/crates/openhuman-core/src/mcp/registry/schemas/handlers.rs
+++ b/crates/openhuman-core/src/mcp/registry/schemas/handlers.rs
@@ -7,8 +7,7 @@ use crate::config::rpc as config_rpc;
use crate::core::all::ControllerFuture;
use super::params::{
- read_optional, read_optional_json, read_optional_string, read_optional_u32, read_required,
- to_json,
+ read_optional, read_optional_string, read_optional_u32, read_required, to_json,
};
// ── Handler implementations ──────────────────────────────────────────────────
@@ -45,24 +44,6 @@ pub(super) fn handle_installed_list(params: Map<String, Value>) -> ControllerFut
})
}
-pub(super) fn handle_install(params: Map<String, Value>) -> ControllerFuture {
- Box::pin(async move {
- let config = config_rpc::load_config_with_timeout().await?;
- let qualified_name = read_required::<String>(&params, "qualified_name")?;
- let env = read_required::<std::collections::HashMap<String, String>>(&params, "env")?;
- let config_value = read_optional_json(&params, "config")?;
- to_json(
- crate::mcp::registry::ops::mcp_clients_install(
- &config,
- qualified_name,
- env,
- config_value,
- )
- .await?,
- )
- })
-}
-
pub(super) fn handle_update_env(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let config = config_rpc::load_config_with_timeout().await?;
@@ -149,22 +130,22 @@ pub(super) fn handle_tool_call(params: Map<String, Value>) -> ControllerFuture {
})
}
-pub(super) fn handle_config_assist(params: Map<String, Value>) -> ControllerFuture {
+pub(super) fn handle_config_get(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
+ let _ = params;
let config = config_rpc::load_config_with_timeout().await?;
- let qualified_name = read_required::<String>(&params, "qualified_name")?;
- let user_message = read_required::<String>(&params, "user_message")?;
- let history =
- read_optional::<Vec<crate::mcp::registry::types::ChatTurn>>(&params, "history")?;
- to_json(
- crate::mcp::registry::ops::mcp_clients_config_assist(
- &config,
- qualified_name,
- user_message,
- history,
- )
- .await?,
- )
+ to_json(crate::mcp::registry::ops::mcp_clients_config_get(&config).await?)
+ })
+}
+
+pub(super) fn handle_config_set(params: Map<String, Value>) -> ControllerFuture {
+ Box::pin(async move {
+ let config = config_rpc::load_config_with_timeout().await?;
+ // The whole document is the parameter set: `{ "mcpServers": { … } }`
+ // is what a user pastes, and wrapping it in another key would make the
+ // wire shape differ from the file shape for no reason.
+ let doc = Value::Object(params);
+ to_json(crate::mcp::registry::ops::mcp_clients_config_set(&config, doc).await?)
})
}
diff --git a/crates/openhuman-core/src/mcp/registry/schemas/mod.rs b/crates/openhuman-core/src/mcp/registry/schemas/mod.rs
index ddaad5642c..076f80a06f 100644
--- a/crates/openhuman-core/src/mcp/registry/schemas/mod.rs
+++ b/crates/openhuman-core/src/mcp/registry/schemas/mod.rs
@@ -11,8 +11,6 @@ mod tests;
mod handlers;
mod params;
mod registry;
-mod setup_handlers;
-mod setup_registry;
pub use registry::{all_controller_schemas, all_registered_controllers, schemas};
@@ -21,5 +19,3 @@ pub use registry::{all_controller_schemas, all_registered_controllers, schemas};
// had when `include!` spliced everything into one file.
#[cfg(test)]
use params::{read_optional_u32, read_required, type_name};
-#[cfg(test)]
-pub(crate) use setup_registry::setup_schemas;
diff --git a/crates/openhuman-core/src/mcp/registry/schemas/params.rs b/crates/openhuman-core/src/mcp/registry/schemas/params.rs
index ed768eb3a7..57b9024a6d 100644
--- a/crates/openhuman-core/src/mcp/registry/schemas/params.rs
+++ b/crates/openhuman-core/src/mcp/registry/schemas/params.rs
@@ -1,5 +1,5 @@
//! Shared param-deserialisation and outcome-conversion helpers used by
-//! every `mcp_clients_*` and `mcp_setup_*` handler.
+//! every `mcp_clients_*` handler.
use serde_json::{Map, Value};
@@ -33,16 +33,6 @@ pub(super) fn read_optional_u32(
}
}
-pub(super) fn read_optional_json(
- params: &Map<String, Value>,
- key: &str,
-) -> Result<Option<Value>, String> {
- match params.get(key) {
- None | Some(Value::Null) => Ok(None),
- Some(v) => Ok(Some(v.clone())),
- }
-}
-
pub(super) fn to_json<T: serde::Serialize>(outcome: RpcOutcome<T>) -> Result<Value, String> {
serde_json::to_value(outcome.value).map_err(|e| e.to_string())
}
diff --git a/crates/openhuman-core/src/mcp/registry/schemas/registry.rs b/crates/openhuman-core/src/mcp/registry/schemas/registry.rs
index 69bfb69a42..3f55c045ed 100644
--- a/crates/openhuman-core/src/mcp/registry/schemas/registry.rs
+++ b/crates/openhuman-core/src/mcp/registry/schemas/registry.rs
@@ -6,16 +6,11 @@ use crate::core::all::RegisteredController;
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
use super::handlers::{
- handle_config_assist, handle_connect, handle_detect_auth, handle_disconnect, handle_install,
+ handle_config_get, handle_config_set, handle_connect, handle_detect_auth, handle_disconnect,
handle_installed_list, handle_oauth_begin, handle_registry_get, handle_registry_search,
handle_registry_settings_get, handle_registry_settings_set, handle_set_enabled, handle_status,
handle_tool_call, handle_uninstall, handle_update_env,
};
-use super::setup_handlers::{
- handle_setup_get, handle_setup_install_and_connect, handle_setup_request_secret,
- handle_setup_search, handle_setup_submit_secret, handle_setup_test_connection,
-};
-use super::setup_registry::setup_schemas;
// ── Schema registry ──────────────────────────────────────────────────────────
@@ -24,7 +19,8 @@ pub fn all_controller_schemas() -> Vec<ControllerSchema> {
schemas("registry_search"),
schemas("registry_get"),
schemas("installed_list"),
- schemas("install"),
+ schemas("config_get"),
+ schemas("config_set"),
schemas("update_env"),
schemas("uninstall"),
schemas("detect_auth"),
@@ -33,17 +29,9 @@ pub fn all_controller_schemas() -> Vec<ControllerSchema> {
schemas("disconnect"),
schemas("status"),
schemas("tool_call"),
- schemas("config_assist"),
schemas("registry_settings_get"),
schemas("registry_settings_set"),
schemas("set_enabled"),
- // Setup-agent surface (mcp_setup namespace, lives in setup_ops.rs).
- setup_schemas("search"),
- setup_schemas("get"),
- setup_schemas("request_secret"),
- setup_schemas("submit_secret"),
- setup_schemas("test_connection"),
- setup_schemas("install_and_connect"),
]
}
@@ -62,8 +50,12 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {
handler: handle_installed_list,
},
RegisteredController {
- schema: schemas("install"),
- handler: handle_install,
+ schema: schemas("config_get"),
+ handler: handle_config_get,
+ },
+ RegisteredController {
+ schema: schemas("config_set"),
+ handler: handle_config_set,
},
RegisteredController {
schema: schemas("update_env"),
@@ -97,10 +89,6 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {
schema: schemas("tool_call"),
handler: handle_tool_call,
},
- RegisteredController {
- schema: schemas("config_assist"),
- handler: handle_config_assist,
- },
RegisteredController {
schema: schemas("registry_settings_get"),
handler: handle_registry_settings_get,
@@ -113,30 +101,6 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {
schema: schemas("set_enabled"),
handler: handle_set_enabled,
},
- RegisteredController {
- schema: setup_schemas("search"),
- handler: handle_setup_search,
- },
- RegisteredController {
- schema: setup_schemas("get"),
- handler: handle_setup_get,
- },
- RegisteredController {
- schema: setup_schemas("request_secret"),
- handler: handle_setup_request_secret,
- },
- RegisteredController {
- schema: setup_schemas("submit_secret"),
- handler: handle_setup_submit_secret,
- },
- RegisteredController {
- schema: setup_schemas("test_connection"),
- handler: handle_setup_test_connection,
- },
- RegisteredController {
- schema: setup_schemas("install_and_connect"),
- handler: handle_setup_install_and_connect,
- },
]
}
@@ -225,36 +189,55 @@ pub fn schemas(function: &str) -> ControllerSchema {
}],
},
- "install" => ControllerSchema {
+ "config_get" => ControllerSchema {
namespace: "mcp_clients",
- function: "install",
- description: "Install an MCP server from the Smithery registry.",
- inputs: vec![
+ function: "config_get",
+ description: "Read the user's MCP servers as one `mcp.json` document: `{ \"mcpServers\": { name: { url | command, args, description, enabled, envKeys, authConfigured } } }`. Credential values are never returned; `envKeys` lists their names.",
+ inputs: vec![],
+ outputs: vec![FieldSchema {
+ name: "mcpServers",
+ ty: TypeSchema::Map(Box::new(TypeSchema::Json)),
+ comment: "Server name -> declaration. `url` for a hosted server, `command`/`args` for a local one.",
+ required: true,
+ }],
+ },
+
+ "config_set" => ControllerSchema {
+ namespace: "mcp_clients",
+ function: "config_set",
+ description: "Replace the user's MCP servers with an `mcp.json` document. A server absent from the document is uninstalled; a new one is added; one whose dial changed is rewritten in place. `env` (local) / `headers` (hosted) are stored write-only: omit the block to keep what is stored, set a key to \"\" to remove it. Enabled servers are connected in the background.",
+ inputs: vec![FieldSchema {
+ name: "mcpServers",
+ ty: TypeSchema::Map(Box::new(TypeSchema::Json)),
+ comment: "Server name -> { url | command, args?, env? | headers?, description?, enabled? }.",
+ required: true,
+ }],
+ outputs: vec![
FieldSchema {
- name: "qualified_name",
- ty: TypeSchema::String,
- comment: "Registry qualified name.",
+ name: "mcpServers",
+ ty: TypeSchema::Map(Box::new(TypeSchema::Json)),
+ comment: "The document as the store now renders it.",
required: true,
},
FieldSchema {
- name: "env",
- ty: TypeSchema::Map(Box::new(TypeSchema::String)),
- comment: "Environment variable values required by the server. Values are stored encrypted and never returned.",
+ name: "added",
+ ty: TypeSchema::Array(Box::new(TypeSchema::String)),
+ comment: "Names installed by this write.",
required: true,
},
FieldSchema {
- name: "config",
- ty: TypeSchema::Option(Box::new(TypeSchema::Json)),
- comment: "Optional JSON configuration blob.",
- required: false,
+ name: "updated",
+ ty: TypeSchema::Array(Box::new(TypeSchema::String)),
+ comment: "Names whose dial or credentials changed.",
+ required: true,
+ },
+ FieldSchema {
+ name: "removed",
+ ty: TypeSchema::Array(Box::new(TypeSchema::String)),
+ comment: "Names uninstalled because the document no longer declares them.",
+ required: true,
},
],
- outputs: vec![FieldSchema {
- name: "server",
- ty: TypeSchema::Ref("InstalledServer"),
- comment: "The newly installed server record.",
- required: true,
- }],
},
"update_env" => ControllerSchema {
@@ -498,48 +481,6 @@ pub fn schemas(function: &str) -> ControllerSchema {
],
},
- "config_assist" => ControllerSchema {
- namespace: "mcp_clients",
- function: "config_assist",
- description: "AI assistant that helps configure an MCP server's required env vars.",
- inputs: vec![
- FieldSchema {
- name: "qualified_name",
- ty: TypeSchema::String,
- comment: "Registry qualified name of the server being configured.",
- required: true,
- },
- FieldSchema {
- name: "user_message",
- ty: TypeSchema::String,
- comment: "User's question or reply.",
- required: true,
- },
- FieldSchema {
- name: "history",
- ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(TypeSchema::Ref(
- "ChatTurn",
- ))))),
- comment: "Prior conversation turns `[{role, content}]`.",
- required: false,
- },
- ],
- outputs: vec![
- FieldSchema {
- name: "reply",
- ty: TypeSchema::String,
- comment: "Assistant reply (markdown).",
- required: true,
- },
- FieldSchema {
- name: "suggested_env",
- ty: TypeSchema::Option(Box::new(TypeSchema::Map(Box::new(TypeSchema::String)))),
- comment: "Env vars extracted from the user's message, if any.",
- required: false,
- },
- ],
- },
-
"registry_settings_get" => ControllerSchema {
namespace: "mcp_clients",
function: "registry_settings_get",