Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat(host): turn connectors on for every bot by default
leepokai732f864fa83a
diff --git a/docs/features/marketplace.md b/docs/features/marketplace.mdindex 61c01470..f51a133b 100644--- a/docs/features/marketplace.md+++ b/docs/features/marketplace.md@@ -5,7 +5,7 @@ The Plugins screen configures capabilities installed on the selected computer. A| Capability | Implementation | Behavior || --- | --- | --- || Agents | `host/src/agent/backends.rs`, `host/src/agent/registry.rs` | Detect installed harnesses and resolve ACP registry adapters |-| Connectors | `host/src/market/mod.rs` | Discover MCP servers or add one manually; install per computer and enable per bot |+| Connectors | `host/src/market/mod.rs` | Discover MCP servers or add one manually; install per computer; on for every bot unless a bot turns it off || Connected apps | `host/src/market/composio.rs` | Expose connected Composio apps as connectors || Skills | `host/src/market/mod.rs` | Instruction folders containing `SKILL.md`, stored under `~/.codync/skills/<id>` |@@ -13,7 +13,7 @@ The Connectors shelf opens with a short featured list, then pages through the whA custom connector is a command line (split like a shell), a URL, or a pasted MCP config (`importConnectors {config}`: the `mcpServers` / `servers` JSON from READMEs, Claude, Cursor or VS Code, or one server's entry); every server in a config is added.-An enabled connector is passed to the agent as an MCP server when its session starts or resumes. Local connectors are spawned by the agent; remote ones always go through the host's stdio proxy (`codync-host mcp remote`, `host/src/mcp.rs`), so they work with agents that only speak stdio and always carry a fresh token. The proxy speaks streamable HTTP and falls back to the older HTTP+SSE transport when the first POST fails with 400/404/405, as the MCP spec suggests.+A connector installed on the computer (or an app connected through Composio) is turned on for every existing bot, and a new bot starts with all of them on; each bot can turn one off in its settings. An enabled connector is passed to the agent as an MCP server when its session starts or resumes. Local connectors are spawned by the agent; remote ones always go through the host's stdio proxy (`codync-host mcp remote`, `host/src/mcp.rs`), so they work with agents that only speak stdio and always carry a fresh token. The proxy speaks streamable HTTP and falls back to the older HTTP+SSE transport when the first POST fails with 400/404/405, as the MCP spec suggests.## Sign-in for remote connectors (`host/src/market/oauth.rs`)diff --git a/host/src/api/mod.rs b/host/src/api/mod.rsindex fa1df950..ce8a9b69 100644--- a/host/src/api/mod.rs+++ b/host/src/api/mod.rs@@ -207,6 +207,37 @@ fn str_arg<'a>(b: &'a Value, k: &str) -> Result<&'a str> {b[k].as_str().ok_or_else(|| anyhow!("`{k}` is required"))}+/// Everything a bot can turn on: installed connectors and connected apps.+fn connector_ids(store: &crate::store::Store) -> Result<Vec<String>> {+ Ok(market::list_connectors(store)?["items"]+ .as_array()+ .into_iter()+ .flatten()+ .filter_map(|c| c["id"].as_str().map(str::to_owned))+ .collect())+}++/// A connector installed on the computer is on for every bot; each bot can turn it off.+fn enable_new_connectors(hub: &Hub, before: &[String]) -> Result<()> {+ let new: Vec<String> = connector_ids(&hub.store)?.into_iter().filter(|id| !before.contains(id)).collect();+ if new.is_empty() {+ return Ok(());+ }+ for row in hub.store.bots()? {+ if row.deleted || row.config.is_group() {+ continue;+ }+ let mut on = row.config.connectors;+ for id in &new {+ if !on.contains(id) {+ on.push(id.clone());+ }+ }+ hub.update_bot(&json!({"id": row.config.id, "connectors": on}))?;+ }+ Ok(())+}+/// Runs one API method for `caller` (permissions per spec §6.6).pub async fn dispatch(hub: &Arc<Hub>, caller: &Caller, method: &str, b: Value) -> Result<Value> {devices::permit(caller, method)?;@@ -297,10 +328,23 @@ pub async fn dispatch(hub: &Arc<Hub>, caller: &Caller, method: &str, b: Value) -"composioConnect" => market::composio::connect(&hub.store, str_arg(&b, "toolkit")?).await?,"composioConnectFields" => {let fields = b["fields"].as_object().ok_or_else(|| anyhow!("`fields` is required"))?;- market::composio::connect_with_fields(&hub.store, str_arg(&b, "toolkit")?, str_arg(&b, "mode")?, fields)- .await?+ let before = connector_ids(&hub.store)?;+ let r = market::composio::connect_with_fields(+ &hub.store,+ str_arg(&b, "toolkit")?,+ str_arg(&b, "mode")?,+ fields,+ )+ .await?;+ enable_new_connectors(hub, &before)?;+ r+ }+ "composioConnection" => {+ let before = connector_ids(&hub.store)?;+ let r = market::composio::connection(&hub.store, str_arg(&b, "id")?).await?;+ enable_new_connectors(hub, &before)?;+ r}- "composioConnection" => market::composio::connection(&hub.store, str_arg(&b, "id")?).await?,"routineSchedule" => crate::routines::schedule_preview(&b, crate::store::now_ms())?,"routines" => hub.routines.list(str_arg(&b, "botId")?),"saveRoutine" => hub.routines.save(hub, str_arg(&b, "botId")?, &b)?,@@ -366,6 +410,11 @@ pub async fn dispatch(hub: &Arc<Hub>, caller: &Caller, method: &str, b: Value) -"createBot" => {let mut b = b;b["id"] = "".into();+ // Connectors are on for a new bot unless the client picked them.+ if b["connectors"].is_null() && b["kind"] != "group" {+ market::vault::unlock(hub.clone()).await?;+ b["connectors"] = json!(connector_ids(&hub.store)?);+ }let cfg: BotConfig = serde_json::from_value(b).context("invalid bot")?;let hub = hub.clone();json!({"bot": tokio::task::spawn_blocking(move || hub.create_bot(cfg)).await??})@@ -647,8 +696,14 @@ pub async fn dispatch(hub: &Arc<Hub>, caller: &Caller, method: &str, b: Value) -}"marketSkills" => market::browse_skills(&hub.store).await?,"connectors" => market::list_connectors(&hub.store)?,- "importConnectors" => market::import_connectors(&hub.store, str_arg(&b, "config")?).await?,+ "importConnectors" => {+ let before = connector_ids(&hub.store)?;+ let added = market::import_connectors(&hub.store, str_arg(&b, "config")?).await?;+ enable_new_connectors(hub, &before)?;+ added+ }"installConnector" => {+ let before = connector_ids(&hub.store)?;let c = if b["registryName"].is_string() {market::install_connector(&hub.store,@@ -660,6 +715,7 @@ pub async fn dispatch(hub: &Arc<Hub>, caller: &Caller, method: &str, b: Value) -} else {market::add_custom_connector(&hub.store, &b).await?};+ enable_new_connectors(hub, &before)?;json!({"connector": c})}"connectorSignIn" => {@@ -996,4 +1052,37 @@ mod tests {assert!(!is_loopback(ip("::ffff:192.168.1.20")));assert!(!is_loopback(ip("100.101.102.103")));}++ #[tokio::test]+ async fn new_connectors_turn_on_for_every_bot() {+ let dir = std::env::temp_dir().join(format!("codync-connectors-{}", uuid::Uuid::new_v4()));+ std::fs::create_dir_all(&dir).expect("temp dir");+ let store = crate::store::Store::open(std::path::Path::new(":memory:")).expect("memory store");+ for (id, on) in [("a", json!([])), ("b", json!(["old"]))] {+ let cfg: BotConfig = serde_json::from_value(+ json!({"id": id, "name": id, "backend": "fixture", "command": "true", "cwd": dir, "connectors": on, "notify": false}),+ )+ .expect("bot config");+ store.save_bot(&cfg).expect("save bot");+ }+ let connector = |id: &str| -> market::Connector {+ serde_json::from_value(json!({"id": id, "name": id, "url": "https://example.com/mcp"})).expect("connector")+ };+ market::save_connectors(&store, &[connector("old")]).expect("save");+ let hub = Hub::new(+ store,+ "test".into(),+ crate::remote::identity::Identity::load_or_create(&dir).expect("identity"),+ "test".into(),+ 19222,+ );+ hub.start().expect("start");+ let before = connector_ids(&hub.store).expect("ids");+ market::save_connectors(&hub.store, &[connector("old"), connector("linear")]).expect("save");+ enable_new_connectors(&hub, &before).expect("enable");+ let on = |id: &str| hub.store.bot(id).expect("read").expect("bot").config.connectors;+ assert_eq!(on("a"), ["linear"], "the new connector is on; one turned off stays off");+ assert_eq!(on("b"), ["old", "linear"]);+ let _ = std::fs::remove_dir_all(dir);+ }}diff --git a/host/src/tui/app.rs b/host/src/tui/app.rsindex d2c8521b..a05aa615 100644--- a/host/src/tui/app.rs+++ b/host/src/tui/app.rs@@ -1126,9 +1126,10 @@ impl App {for o in &mut self.overlays {if let Overlay::Form(f) = o {if connectors {- merge_toggles(&mut f.connectors, &self.market.0);+ // Connectors start on for a new bot.+ merge_toggles(&mut f.connectors, &self.market.0, f.bot_id.is_none());} else {- merge_toggles(&mut f.skills, &self.market.1);+ merge_toggles(&mut f.skills, &self.market.1, false);}}}@@ -1753,8 +1754,8 @@ impl App {error: None,saving: false,};- merge_toggles(&mut f.connectors, &self.market.0);- merge_toggles(&mut f.skills, &self.market.1);+ merge_toggles(&mut f.connectors, &self.market.0, false);+ merge_toggles(&mut f.skills, &self.market.1, false);self.overlays.push(Overlay::Form(Box::new(f)));self.call("connectors", json!({}), After::Connectors);self.call("skills", json!({}), After::Skills);@@ -2008,7 +2009,7 @@ impl App {.market.0.iter()- .map(|t| Toggle { id: t.id.clone(), name: t.name.clone(), on: false })+ .map(|t| Toggle { id: t.id.clone(), name: t.name.clone(), on: true }).collect(),skills: self.market@@ -2214,11 +2215,11 @@ fn cycle(i: usize, d: isize, n: usize) -> usize {usize::try_from((isize::try_from(i).unwrap_or(0) + d).rem_euclid(n)).unwrap_or(0)}-fn merge_toggles(have: &mut Vec<Toggle>, all: &[Toggle]) {+fn merge_toggles(have: &mut Vec<Toggle>, all: &[Toggle], on: bool) {for t in all {match have.iter_mut().find(|h| h.id == t.id) {Some(h) => h.name.clone_from(&t.name),- None => have.push(Toggle { id: t.id.clone(), name: t.name.clone(), on: false }),+ None => have.push(Toggle { id: t.id.clone(), name: t.name.clone(), on }),}}}diff --git a/kit/Sources/CodyncUI/Bots/BotEditorView.swift b/kit/Sources/CodyncUI/Bots/BotEditorView.swiftindex a29447fe..b61765df 100644--- a/kit/Sources/CodyncUI/Bots/BotEditorView.swift+++ b/kit/Sources/CodyncUI/Bots/BotEditorView.swift@@ -384,6 +384,10 @@ public extension BotStore {let first = hello?.backends.first(where: \.available) {draft.backend = first.id}+ // Connectors start on; left unset, the host turns on every one.+ if draft.connectors == nil, !installedConnectors.isEmpty {+ draft.connectors = installedConnectors.map(\.id)+ }}/// Creates "New Bot" with sensible defaults and opens it (desktop compose flow).