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
fix(host): give connectors a free name when Codex already uses theirs
leepokaic02e745d7b86
diff --git a/docs/features/marketplace.md b/docs/features/marketplace.mdindex 0a33d728..6da10cad 100644--- a/docs/features/marketplace.md+++ b/docs/features/marketplace.md@@ -32,7 +32,7 @@ Registry package installs use pinned package references: npm, PyPI and NuGet reqA 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.-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.+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. Each server is named after its connector id. codex-acp leaves out a requested server whose name Codex's own config already uses (its `[mcp_servers.<name>]`, disabled ones too, in `~/.codex`, `/etc/codex` or a `.codex` folder from the bot's folder up) and says so only in a startup notice, so for a Codex bot such a server is named `codync-<name>` instead (`agent/bot/codex_names.rs`, #217).Every `codync-host mcp` server Codync gives an agent, connectors and built-in tools alike, carries the host's data directory as `CODYNC_HOME` in its ACP `env` (`mcp::acp_server`): some agents start MCP servers with only a few environment variables (Hermes keeps PATH, HOME and the like), and without it a host with a custom `CODYNC_HOME` (a sandbox, a server) would leave those tools reading the wrong token.diff --git a/host/src/agent/bot/codex_names.rs b/host/src/agent/bot/codex_names.rsnew file mode 100644index 00000000..072a67b8--- /dev/null+++ b/host/src/agent/bot/codex_names.rs@@ -0,0 +1,74 @@+//! codex-acp leaves out a requested MCP server whose name Codex's own config already uses ("Codex uses its own+//! entry, or no server if that entry is disabled"), and says so only in a notice before the first turn. A connector+//! named like one of the user's Codex servers (`notion`) then never reaches the bot (#217), so it gets a free name.++use serde_json::Value;+use std::collections::HashSet;+use std::path::{Path, PathBuf};+use toml_edit::{DocumentMut, Item};++/// Renames each of `servers` whose name a Codex config for `cwd` already defines.+pub(super) async fn avoid_clashes(servers: &mut Value, cwd: &str) {+ let files = config_files(Path::new(cwd));+ match tokio::task::spawn_blocking(move || taken(&files)).await {+ Ok(taken) => rename(servers, &taken),+ Err(e) => tracing::warn!(error = format!("{e:#}"), "couldn't read Codex's MCP server names"),+ }+}++fn rename(servers: &mut Value, taken: &HashSet<String>) {+ for server in servers.as_array_mut().into_iter().flatten() {+ if let Some(name) = server["name"].as_str().filter(|name| taken.contains(*name)) {+ server["name"] = format!("codync-{name}").into();+ }+ }+}++/// The files Codex layers its config from: the user's and the system's, and `.codex/config.toml` in the folders+/// from `cwd` up (projects).+// ponytail: `[profiles.<name>.mcp_servers]` isn't read; add it if a profile's server ever clashes.+fn config_files(cwd: &Path) -> Vec<PathBuf> {+ let user = std::env::var_os("CODEX_HOME").map(PathBuf::from).or_else(|| dirs::home_dir().map(|h| h.join(".codex")));+ let mut files: Vec<PathBuf> = user.into_iter().map(|dir| dir.join("config.toml")).collect();+ if cfg!(unix) {+ files.push("/etc/codex/config.toml".into());+ }+ files.extend(cwd.ancestors().map(|dir| dir.join(".codex/config.toml")));+ files+}++/// Every `[mcp_servers.<name>]` in `files`, disabled ones too: codex-acp skips those as well.+fn taken(files: &[PathBuf]) -> HashSet<String> {+ let mut names = HashSet::new();+ for text in files.iter().filter_map(|file| std::fs::read_to_string(file).ok()) {+ let Ok(doc) = text.parse::<DocumentMut>() else { continue };+ if let Some(servers) = doc.get("mcp_servers").and_then(Item::as_table_like) {+ names.extend(servers.iter().map(|(name, _)| name.to_owned()));+ }+ }+ names+}++#[cfg(test)]+mod tests {+ use super::*;+ use serde_json::json;++ #[test]+ fn servers_codex_already_names_get_a_free_name() {+ let dir = std::env::temp_dir().join(format!("codync-codex-names-{}", uuid::Uuid::new_v4()));+ let project = dir.join("work/app");+ std::fs::create_dir_all(dir.join("work/.codex")).expect("dir");+ std::fs::create_dir_all(&project).expect("dir");+ std::fs::write(+ dir.join("work/.codex/config.toml"),+ "[mcp_servers.notion]\nurl = \"https://mcp.notion.com/mcp\"\n\n[mcp_servers.memory]\ncommand = \"npx\"\nenabled = false\n",+ )+ .expect("config");+ let files: Vec<PathBuf> = project.ancestors().map(|d| d.join(".codex/config.toml")).collect();+ let mut servers = json!([{"name": "notion"}, {"name": "memory"}, {"name": "chat"}]);+ rename(&mut servers, &taken(&files));+ assert_eq!(servers, json!([{"name": "codync-notion"}, {"name": "codync-memory"}, {"name": "chat"}]));+ std::fs::remove_dir_all(dir).expect("cleanup");+ }+}diff --git a/host/src/agent/bot/mod.rs b/host/src/agent/bot/mod.rsindex 6667b6fe..be18f6b8 100644--- a/host/src/agent/bot/mod.rs+++ b/host/src/agent/bot/mod.rs@@ -17,6 +17,7 @@//! from a session of its own (see `session`).mod cmd;+mod codex_names;mod compaction;mod fallback;mod fast_mode;diff --git a/host/src/agent/bot/session.rs b/host/src/agent/bot/session.rsindex 050b6112..19bbafc4 100644--- a/host/src/agent/bot/session.rs+++ b/host/src/agent/bot/session.rs@@ -2,7 +2,7 @@use super::fast_mode::Listing;use super::launch::{claude_meta, launch_commands, select_model, start_agent, system_prompt};-use super::{Actor, Conn, Instructions};+use super::{Actor, Adapter, Conn, Instructions, codex_names};use crate::agent::acp::{self, Incoming};use crate::agent::own_memory;use crate::agent::registry::Candidate;@@ -182,7 +182,10 @@ impl Actor {return Err(last_err.unwrap_or_else(|| anyhow!("agent failed to start")));}}- let servers = self.mcp_servers()?;+ let mut servers = self.mcp_servers()?;+ if self.conn.as_ref().is_some_and(|c| c.adapter == Adapter::Codex) {+ codex_names::avoid_clashes(&mut servers, &self.cfg.cwd).await;+ }let instructions = self.conn.as_ref().map_or(Instructions::FirstMessage, Conn::instructions);// Claude gets the frozen instructions as its system prompt. When a compaction// re-rendered them, loading the session again swaps the prompt in (the adapterdiff --git a/host/src/agent/bot/tool_entry.rs b/host/src/agent/bot/tool_entry.rsindex e3cb249c..b4b49d81 100644--- a/host/src/agent/bot/tool_entry.rs+++ b/host/src/agent/bot/tool_entry.rs@@ -66,16 +66,19 @@ fn diff_summary(path: &str, old: &str, new: &str) -> Value {})}-/// Composing the bot's message: the `chat` MCP server's `send_message`, by the name the agent titles the call with.+/// Composing the bot's message: the `chat` MCP server's `send_message`, by the name the agent titles the call with+/// (`codync-chat` where the user's Codex config already has a `chat` server, see `codex_names`).fn sends_message(title: &str) -> bool {- ["mcp__chat__send_message", "chat.send_message"].iter().any(|name| title.starts_with(name))+ ["mcp__chat__send_message", "chat.send_message", "codync-chat.send_message"]+ .iter()+ .any(|name| title.starts_with(name))}/// Keeping the bot's memory: a call of the `memory` MCP server, or one that names a file in a memory folder the/// bot sees (in its `locations` or diffs, as `chat::memory::turns::touched` reads them).fn keeps_memory(cfg: &BotConfig, data: &Value) -> bool {let title = data["title"].as_str().unwrap_or_default();- if ["mcp__memory__", "memory."].iter().any(|server| title.starts_with(server)) {+ if ["mcp__memory__", "memory.", "codync-memory."].iter().any(|server| title.starts_with(server)) {return true;}let folders: Vec<PathBuf> = files::layers(cfg).iter().map(|layer| files::folder(layer.as_deref())).collect();@@ -128,6 +131,8 @@ mod tests {json!({"title": "chat.send_message"}),json!({"title": "mcp__memory__edit_memory"}),json!({"title": "memory.search_memory"}),+ json!({"title": "codync-chat.send_message"}),+ json!({"title": "codync-memory.edit_memory"}),json!({"title": "Write", "locations": [{"path": note}]}),json!({"title": "Edit", "diffs": [{"path": note}]}),] {diff --git a/web/content/docs/connectors-and-skills.mdx b/web/content/docs/connectors-and-skills.mdxindex 7a583e64..9cce46bd 100644--- a/web/content/docs/connectors-and-skills.mdx+++ b/web/content/docs/connectors-and-skills.mdx@@ -84,6 +84,8 @@ A connector or skill you add is turned on for every bot, and new bots start withThe bot picks up the change on its next turn, in the same conversation.+On a Codex bot, a connector named like an MCP server in your own Codex config (for example `notion`, after `codex mcp add notion`) reaches the bot as `codync-notion`, so the bot gets both: Codex keeps its own entry and skips any other server with that name.+What that agent already brings is on its own page, not the bot's. Open **Extensions → Agents**, choose the agent, and look under **Sign in**. **Skills**, **Connectors**, **Rules** and **Plugins** each show a count and open to the list. The section is left out when the agent has none of them. Those rows are read only. In the terminal, the same lists open from **What the agent brings** on the agent's sign-in sheet.## Skills