Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(mcp): offer the app's MCP servers as dodaios and keep reading jarvis (#581)

Ruben Lütkeb87b8564fce2
diff --git a/docs/agent-mcp.md b/docs/agent-mcp.md
index 1e72d90291..3f2fb2f62a 100644
--- a/docs/agent-mcp.md
+++ b/docs/agent-mcp.md
@@ -84,6 +84,16 @@ temp file, because a client reading a half-written config loses *all* its
servers, not just ours. Codex is never written to: a hand-formatted
`config.toml` is easy to corrupt and hard to restore, so it gets a snippet.
+The entry is written as `dodaios-agents`. A client connected before the rename
+holds it as `jarvis-agents`, and that entry keeps working untouched: it
+launches the same bridge and calls the same path. The next `connect` or
+`pair` with `"install": true` replaces it with `dodaios-agents` instead of
+adding a second one, so the client never lists every tool twice. Which entry
+is ours is decided by its target (the bridge module, or the surface URL),
+never by its name: a server somebody else put under `jarvis-agents` stays
+where it is. When pasting a snippet by hand, remove an existing
+`jarvis-agents` entry in the same step.
+
Environment overrides, for a Jarvis that is not on this box:
* `JARVIS_API_URL` — base URL of the Jarvis to drive
diff --git a/docs/agent-runtimes.md b/docs/agent-runtimes.md
index b524e043d1..0b6caf77bf 100644
--- a/docs/agent-runtimes.md
+++ b/docs/agent-runtimes.md
@@ -294,7 +294,10 @@ replayed during `session/load` is swallowed because the chat already shows it.
in the process environment.
- **Dodaios tools:** passed per session in `session/new` / `session/load`
`mcpServers` (HTTP with headers); `HERMES_ACP_SKIP_CONFIGURED_MCP=1` keeps
- any configured servers out. Hermes names them `mcp__jarvis__<tool>`.
+ any configured servers out. The server is mounted as `dodaios`, so Hermes
+ names them `mcp__dodaios__<tool>`; a conversation started while the server
+ was still mounted as `jarvis` has its pinned tool list discarded on resume
+ and rebuilt under the new name.
- **Sessions:** persisted in the profile's `state.db`; `session/load` restores
a conversation in a new process and replays it. An unknown id answers
`session/load` with an empty result, which Dodaios treats as "resume lost" and
@@ -357,8 +360,10 @@ replayed during `session/load` is swallowed because the chat already shows it.
- **Dodaios tools:** OpenClaw rejects per-session `mcpServers`, so the Dodaios
server is configured in the agent's own state directory. Values such as
`${JARVIS_CONTROL_API_KEY}` are substituted from the Gateway's environment,
- so no key is written to disk. OpenClaw names them `jarvis__<tool>`; Dodaios
- normalises that to `mcp__jarvis__<tool>`.
+ so no key is written to disk. OpenClaw names them `dodaios__<tool>`; Dodaios
+ normalises that to `mcp__dodaios__<tool>`. Names under the server's earlier
+ name (`jarvis__<tool>`, `mcp__jarvis__<tool>`) are read the same way
+ everywhere a tool name is matched (`jarvis/core/mcp_names.py`).
- **Sessions:** the fixed session key keeps one conversation across bridge
processes; the ACP session id changes per process and is not stored.
- **Heartbeat:** OpenClaw runs a background model turn every 30 minutes by
diff --git a/docs/agent-society/agent-definition.md b/docs/agent-society/agent-definition.md
index 993735202d..2726049129 100644
--- a/docs/agent-society/agent-definition.md
+++ b/docs/agent-society/agent-definition.md
@@ -57,7 +57,8 @@ card; nothing hidden drives behavior.
present, else the Anthropic API), Jarvis' brain runner for API rows.
- **On a seat the CLI runs AS the agent**: its briefing (§3.3) is the identity the CLI is handed
(`jarvis_harness.identity_prompt(prompt_override=…)`, Jarvis' own layers stay out), Jarvis'
- tools reach it over MCP (`mcp__jarvis__*`), and it brings its own hands (Claude Code's shell,
+ tools reach it over MCP (`mcp__dodaios__*`; `mcp__jarvis__*` in transcripts written before the
+ server was renamed, read alike), and it brings its own hands (Claude Code's shell,
editor, browser). The society-only tools (`society_message_agent`, `society_wiki_note`,
`society_shell`, `society_browser`, `society_run_skill`) are available on the brain runner
today and are NOT yet offered over MCP to a seated CLI (tracked gap).
diff --git a/jarvis/agent_chat/jarvis_harness.py b/jarvis/agent_chat/jarvis_harness.py
index 8c590834e8..1c8fac9bca 100644
--- a/jarvis/agent_chat/jarvis_harness.py
+++ b/jarvis/agent_chat/jarvis_harness.py
@@ -42,6 +42,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any, Final
+from jarvis.core.branding import MCP_TOOLS_SERVER_NAME
from jarvis.core.response_style import CONVERSATIONAL_TURN_REMINDER
log = logging.getLogger(__name__)
@@ -54,9 +55,11 @@ log = logging.getLogger(__name__)
_MCP_PATH: Final[str] = "/api/control/mcp/"
#: The server name the CLI shows to the model. Claude Code exposes the tools as
-#: ``mcp__jarvis__<tool>``; Grok Build as ``jarvis__<tool>`` (called through
-#: ``use_tool``). The preamble names both prefixes, so they must stay in step.
-_SERVER_NAME: Final[str] = "jarvis"
+#: ``mcp__<name>__<tool>``; Grok Build as ``<name>__<tool>`` (called through
+#: ``use_tool``). The preamble spells both prefixes from this one name, and
+#: every reader of a tool name accepts the earlier name as well
+#: (``jarvis.core.mcp_names``).
+_SERVER_NAME: Final[str] = MCP_TOOLS_SERVER_NAME
#: The request header that carries the chat's session id to the tool server.
#: ``jarvis.mcp.jarvis_tools_server`` reads it (through
@@ -78,7 +81,8 @@ SYSTEM_PREAMBLE: Final[str] = (
"person explicitly asks for one in this turn — no emoji headings, tables, "
"status icons or closers. Tables carry plain words, never emoji symbols.\n\n"
"You have Dodaios' own tools, offered to you over MCP. Claude Code names them "
- "`mcp__jarvis__<tool>`; Grok Build names them `jarvis__<tool>` and you call "
+ f"`mcp__{_SERVER_NAME}__<tool>`; Grok Build names them "
+ f"`{_SERVER_NAME}__<tool>` and you call "
"them through use_tool. They act on the RUNNING app and on the accounts the "
"person has connected to it — their calendar, mail, contacts, media, wiki, "
"windows, screen, skills and Dodaios' own settings. Prefer them over a shell "
@@ -87,15 +91,15 @@ SYSTEM_PREAMBLE: Final[str] = (
"machine: those tools are already signed in and already permitted. Reach for "
"your file and shell tools for code and for the filesystem.\n\n"
"When the user selects Chrome / Browser, @browser, @browser-use or "
- "[tools: core:browser], use society_browser from the `jarvis` MCP server. "
+ f"[tools: core:browser], use society_browser from the `{_SERVER_NAME}` MCP server. "
"That is the persistent browser displayed live in this agent's Options rail. "
"Use it for website interaction when no connected service tool can do the task. "
"A browser request takes priority over the general plugin preference. "
"Do not substitute your own browser, HTTP fetch or shell for this selection. "
"If society_browser is unavailable, report that explicitly.\n\n"
"Two kinds of hands: your own file and shell tools are your hands in the "
- "working folder this chat is open in; `mcp__jarvis__run_shell` / "
- "`jarvis__run_shell` and their siblings are Dodaios' hands on the whole "
+ f"working folder this chat is open in; `mcp__{_SERVER_NAME}__run_shell` / "
+ f"`{_SERVER_NAME}__run_shell` and their siblings are Dodaios' hands on the whole "
"machine. Use the folder's hands for the folder, Dodaios' for everything else.\n\n"
"Some of those tools ask the person for approval before they run. That is "
"normal and it is not a failure — wait for an approval card that is actually "
@@ -278,7 +282,7 @@ _GROK_BLOCK_END: Final[str] = "# END JARVIS HANDS"
def grok_mcp_server_entry(session_id: str | None = None) -> dict[str, Any] | None:
- """The Grok ``[mcp_servers.jarvis]`` row for this app's tool server.
+ """The Grok ``[mcp_servers.<name>]`` row for this app's tool server.
Grok speaks ``url`` + ``bearer_token_env_var`` + ``headers`` (not Claude's
``type``/``url`` JSON). ``None`` when the app cannot offer the tools —
diff --git a/jarvis/agent_chat/remote_mcp_config.py b/jarvis/agent_chat/remote_mcp_config.py
index 41e4d50831..ddf431572e 100644
--- a/jarvis/agent_chat/remote_mcp_config.py
+++ b/jarvis/agent_chat/remote_mcp_config.py
@@ -10,10 +10,13 @@ from __future__ import annotations
import asyncio
import json
import logging
+import re
import secrets
from dataclasses import dataclass, field
from typing import Any
+from jarvis.core.mcp_names import TOOLS_SERVER_NAMES
+
from .remote_mcp import RemoteToolsUnavailable
log = logging.getLogger(__name__)
@@ -30,6 +33,9 @@ SUPPORTED_RUNNERS = frozenset(
}
)
TOKEN_ENV = "JARVIS_REMOTE_MCP_TOKEN" # noqa: S105 — environment name, not a credential
+#: The name the tools server is mounted under, and the names an earlier turn
+#: may have left behind in a project file it could not clean up.
+_SERVER_NAME, *_LEGACY_SERVER_NAMES = TOOLS_SERVER_NAMES
_project_configs: set[tuple[str, str]] = set()
@@ -92,6 +98,28 @@ class ConfigFiles:
self.written.clear()
+_OWN_MOUNT_URL = re.compile(r"^http://127\.0\.0\.1:\d{1,5}/mcp$")
+
+
+def _is_own_mount(entry: Any) -> bool:
+ """Whether a project MCP entry is a mount this module wrote.
+
+ Identified by its target, never by its name alone: the loopback forward
+ this app opens for a turn (``remote_mcp``) and nothing but a bearer token
+ beside it.
+ """
+ if not isinstance(entry, dict) or set(entry) - {"url", "headers", "type"}:
+ return False
+ headers = entry.get("headers")
+ return (
+ isinstance(entry.get("url"), str)
+ and _OWN_MOUNT_URL.fullmatch(entry["url"]) is not None
+ and isinstance(headers, dict)
+ and set(headers) == {"Authorization"}
+ and str(headers["Authorization"]).startswith("Bearer ")
+ )
+
+
async def configure(
opened: Any,
host: Any,
@@ -133,14 +161,16 @@ async def configure(
"default_tools_approval_mode": '"approve"',
}
config.args = [
- part for k, v in values.items() for part in ("-c", f"mcp_servers.jarvis.{k}={v}")
+ part
+ for k, v in values.items()
+ for part in ("-c", f"mcp_servers.{_SERVER_NAME}.{k}={v}")
]
return config
if runner == "opencode-cli":
config.env["OPENCODE_CONFIG_CONTENT"] = json.dumps(
{
"mcp": {
- "jarvis": {
+ _SERVER_NAME: {
"type": "remote",
"url": url,
"headers": auth,
@@ -149,8 +179,10 @@ async def configure(
"timeout": 600000,
}
},
- # Jarvis' executor owns approval for this one server.
- "permission": {"jarvis_*": "allow"},
+ # Jarvis' executor owns approval for this one server. opencode
+ # names its tools ``<server>_<tool>``; a session resumed from a
+ # mount under an earlier server name still asks for those.
+ "permission": {f"{name}_*": "allow" for name in TOOLS_SERVER_NAMES},
}
)
return config
@@ -160,7 +192,7 @@ async def configure(
suffix = secrets.token_hex(8)
if runner in {"claude-cli", "kimi-cli"}:
path = f"{cwd}/.jarvis-mcp-{suffix}.json"
- await files.write(path, json.dumps({"mcpServers": {"jarvis": server}}))
+ await files.write(path, json.dumps({"mcpServers": {_SERVER_NAME: server}}))
flag = "--mcp-config" if runner == "claude-cli" else "--mcp-config-file"
config.args = [flag, path]
elif runner == "agy-cli":
@@ -170,7 +202,7 @@ async def configure(
f"{folder}/mcp_config.json",
json.dumps(
{
- "mcpServers": {"jarvis": {"serverUrl": url, "headers": auth}},
+ "mcpServers": {_SERVER_NAME: {"serverUrl": url, "headers": auth}},
}
),
)
@@ -187,7 +219,15 @@ async def configure(
old = await files.read(path)
try:
previous = json.loads(old) if old is not None else {}
- previous.setdefault("mcpServers", {})["jarvis"] = server
+ servers = previous.setdefault("mcpServers", {})
+ for stale in _LEGACY_SERVER_NAMES:
+ # A turn that could not clean up left its mount under the
+ # earlier name. Two entries for one server show every tool
+ # twice, so that one goes; anything else under the name is the
+ # person's own and stays.
+ if _is_own_mount(servers.get(stale)):
+ del servers[stale]
+ servers[_SERVER_NAME] = server
except (ValueError, TypeError, AttributeError) as exc:
raise RemoteToolsUnavailable(
"The computer's project MCP settings need repair in Cursor."
diff --git a/jarvis/agent_runtimes/acp.py b/jarvis/agent_runtimes/acp.py
index b86a106618..4b6a1d76a5 100644
--- a/jarvis/agent_runtimes/acp.py
+++ b/jarvis/agent_runtimes/acp.py
@@ -37,6 +37,7 @@ from dataclasses import dataclass, field
from typing import Any, Final, Protocol
from jarvis.agent_chat.events import make_event
+from jarvis.core.mcp_names import CLI_TOOL_PREFIX, TOOLS_SERVER_NAMES, cli_tool_name
log = logging.getLogger(__name__)
@@ -62,10 +63,15 @@ _STOPPED_EARLY: Final[dict[str, str]] = {
"cancelled": "The turn was cancelled before it finished.",
}
-#: ``mcp_<server>_<tool>`` (Hermes) and ``<server>__<tool>`` spellings of a
-#: Jarvis MCP tool, normalised to the ``mcp__jarvis__<tool>`` form the
-#: society checkpoints and quests read.
-_JARVIS_TOOL_PREFIXES: Final[tuple[str, ...]] = ("mcp_jarvis_", "jarvis__", "jarvis.")
+#: ``mcp_<server>_<tool>`` (Hermes), ``<server>__<tool>`` and
+#: ``<server>.<tool>`` spellings of a tool on this app's own MCP server, per
+#: name that server is registered under. Normalised to the
+#: ``mcp__<server>__<tool>`` form the society checkpoints and quests read.
+_OWN_TOOL_PREFIXES: Final[tuple[tuple[str, str], ...]] = tuple(
+ (prefix, server)
+ for server in TOOLS_SERVER_NAMES
+ for prefix in (f"mcp_{server}_", f"{server}__", f"{server}.")
+)
_IDENTIFIER: Final[re.Pattern[str]] = re.compile(r"^[A-Za-z_][\w.:-]{0,120}$")
@@ -109,12 +115,16 @@ class McpServer:
def normalize_tool_name(name: str) -> str:
- """Give a Jarvis MCP tool the ``mcp__jarvis__<tool>`` name Jarvis reads."""
- if name.startswith("mcp__"):
+ """Give a tool on this app's MCP server the ``mcp__<server>__<tool>`` name it is read by.
+
+ The server part stays the one the runtime used: a session mounted under an
+ earlier name keeps reporting it, and every reader accepts both.
+ """
+ if name.startswith(CLI_TOOL_PREFIX):
return name
- for prefix in _JARVIS_TOOL_PREFIXES:
+ for prefix, server in _OWN_TOOL_PREFIXES:
if name.startswith(prefix):
- return "mcp__jarvis__" + name[len(prefix) :]
+ return cli_tool_name(name[len(prefix) :], server)
return name
diff --git a/jarvis/agent_runtimes/hermes.py b/jarvis/agent_runtimes/hermes.py
index 181a931cbf..80b7637be3 100644
--- a/jarvis/agent_runtimes/hermes.py
+++ b/jarvis/agent_runtimes/hermes.py
@@ -465,10 +465,11 @@ class HermesRuntime:
servers: list[McpServer] = []
if turn.mcp_url and turn.control_key:
from jarvis.agent_chat.jarvis_harness import HEADER_NAME
+ from jarvis.core.branding import MCP_TOOLS_SERVER_NAME
servers.append(
McpServer(
- name="jarvis",
+ name=MCP_TOOLS_SERVER_NAME,
url=turn.mcp_url,
headers={
# Travels inside the ACP frame on stdin, never on argv.
diff --git a/jarvis/agent_runtimes/openclaw.py b/jarvis/agent_runtimes/openclaw.py
index 461b15c35f..05dbffc3f2 100644
--- a/jarvis/agent_runtimes/openclaw.py
+++ b/jarvis/agent_runtimes/openclaw.py
@@ -535,10 +535,11 @@ class OpenClawRuntime:
config["agents"]["defaults"]["thinkingDefault"] = thinking
if turn.mcp_url and turn.control_key:
from jarvis.agent_chat.jarvis_harness import HEADER_NAME
+ from jarvis.core.branding import MCP_TOOLS_SERVER_NAME
config["mcp"] = {
"servers": {
- "jarvis": {
+ MCP_TOOLS_SERVER_NAME: {
"url": turn.mcp_url,
"transport": "streamable-http",
"headers": {
diff --git a/jarvis/agent_runtimes/tool_snapshot.py b/jarvis/agent_runtimes/tool_snapshot.py
index 910801477b..adbc80ef56 100644
--- a/jarvis/agent_runtimes/tool_snapshot.py
+++ b/jarvis/agent_runtimes/tool_snapshot.py
@@ -8,6 +8,8 @@ import sqlite3
from contextlib import closing
from pathlib import Path
+from jarvis.core.mcp_names import own_cli_tool_prefixes
+
log = logging.getLogger(__name__)
@@ -49,7 +51,8 @@ def refresh_tool_search_cache(home: Path, session_id: str | None) -> bool:
tool if isinstance(tool, str) else tool.get("function", {}).get("name", "")
for tool in tools if isinstance(tool, (str, dict))
]
- if not any(str(name).startswith("mcp__jarvis__") for name in names):
+ own = own_cli_tool_prefixes()
+ if not any(str(name).startswith(own) for name in names):
return False
changed = connection.execute(
"UPDATE sessions SET tool_names = NULL WHERE id = ? AND tool_names = ?",
diff --git a/jarvis/core/branding.py b/jarvis/core/branding.py
index 221a9f235e..1849372d35 100644
--- a/jarvis/core/branding.py
+++ b/jarvis/core/branding.py
@@ -137,6 +137,17 @@ OFFICIAL_RELEASES_LATEST_API_URL = (
)
UPDATER_USER_AGENT = f"{PERSISTENT_COMPACT_NAME}-Updater"
+# --- MCP server names ---------------------------------------------------------
+# What the app calls its own MCP servers when it registers them in another
+# tool's configuration: the tools server a chat's coding CLI mounts, and the
+# agents surface an outside client connects. A client derives its tool names
+# from that name (``mcp__<name>__<tool>``), so the legacy names stay readable
+# forever: registrations and transcripts written under them still exist.
+MCP_TOOLS_SERVER_NAME = "dodaios"
+LEGACY_MCP_TOOLS_SERVER_NAMES = ("jarvis",)
+MCP_AGENTS_SERVER_NAME = "dodaios-agents"
+LEGACY_MCP_AGENTS_SERVER_NAMES = ("jarvis-agents",)
+
__all__ = [
"CLI_COMMAND_ALIAS",
"CLI_COMMAND_NAME",
@@ -164,6 +175,10 @@ __all__ = [
"MACOS_EXECUTABLE_NAME",
"MACOS_SIGNING_IDENTITY_LABEL",
"MANAGED_INSTALL_MARKER",
+ "MCP_AGENTS_SERVER_NAME",
+ "MCP_TOOLS_SERVER_NAME",
+ "LEGACY_MCP_AGENTS_SERVER_NAMES",
+ "LEGACY_MCP_TOOLS_SERVER_NAMES",
"OFFICIAL_RELEASES_LATEST_API_URL",
"OFFICIAL_REPO_GIT_URL",
"OFFICIAL_REPO_SLUG",
diff --git a/jarvis/core/mcp_names.py b/jarvis/core/mcp_names.py
new file mode 100644
index 0000000000..ddb81b88c8
--- /dev/null
+++ b/jarvis/core/mcp_names.py
@@ -0,0 +1,77 @@
+"""Tool names as a client spells them once it has mounted this app's tools server.
+
+A coding CLI names an MCP tool after the server it came from, and each one in
+its own way: Claude Code ``mcp__<server>__<tool>``, Grok Build
+``<server>__<tool>``, Hermes ``mcp_<server>_<tool>``, opencode
+``<server>_<tool>``. The server part is the name this app registered itself
+under (``jarvis.core.branding.MCP_TOOLS_SERVER_NAME``), so it changed when the
+product was renamed, and both spellings exist from then on: registrations a
+tool still holds, transcripts already written, a client that was not restarted.
+
+Everything that reads such a name asks this module instead of comparing against
+one literal, so a call is recognised as the app's own under every name the
+server has had. Standard-library only and import-light: it sits under matchers
+on the event path.
+"""
+
+from __future__ import annotations
+
+from typing import Final
+
+from .branding import LEGACY_MCP_TOOLS_SERVER_NAMES, MCP_TOOLS_SERVER_NAME
+
+__all__ = [
+ "CLI_TOOL_PREFIX",
+ "TOOLS_SERVER_NAMES",
+ "cli_tool_name",
+ "is_tools_server",
+ "own_cli_tool",
+ "own_cli_tool_prefixes",
+ "split_cli_tool_name",
+]
+
+#: What Claude Code puts in front of every MCP tool name.
+CLI_TOOL_PREFIX: Final[str] = "mcp__"
+
+#: Every name the tools server has been registered under, the current one first.
+TOOLS_SERVER_NAMES: Final[tuple[str, ...]] = (
+ MCP_TOOLS_SERVER_NAME,
+ *LEGACY_MCP_TOOLS_SERVER_NAMES,
+)
+
+
+def is_tools_server(server: str) -> bool:
+ """Whether ``server`` is a name this app's tools server is registered under."""
+ return server in TOOLS_SERVER_NAMES
+
+
+def cli_tool_name(tool: str, server: str = MCP_TOOLS_SERVER_NAME) -> str:
+ """``mcp__<server>__<tool>``, the canonical spelling of an MCP tool call."""
+ return f"{CLI_TOOL_PREFIX}{server}__{tool}"
+
+
+def own_cli_tool_prefixes() -> tuple[str, ...]:
+ """``mcp__dodaios__``, ``mcp__jarvis__``: the prefix under each server name."""
+ return tuple(cli_tool_name("", server) for server in TOOLS_SERVER_NAMES)
+
+
+def split_cli_tool_name(name: str) -> tuple[str, str] | None:
+ """``("server", "tool")`` of an ``mcp__<server>__<tool>`` name, else ``None``."""
+ if not name.startswith(CLI_TOOL_PREFIX):
+ return None
+ server, separator, tool = name[len(CLI_TOOL_PREFIX) :].partition("__")
+ if not separator or not server or not tool:
+ return None
+ return server, tool
+
+
+def own_cli_tool(name: str) -> str | None:
+ """The tool behind a call to this app's own server, else ``None``.
+
+ ``mcp__dodaios__gmail`` and ``mcp__jarvis__gmail`` both answer ``"gmail"``;
+ another server's tool and a name without the MCP prefix answer ``None``.
+ """
+ parts = split_cli_tool_name(name)
+ if parts is None or not is_tools_server(parts[0]):
+ return None
+ return parts[1]
diff --git a/jarvis/mcp/agents/export.py b/jarvis/mcp/agents/export.py
index 2e67d9a452..ac17029019 100644
--- a/jarvis/mcp/agents/export.py
+++ b/jarvis/mcp/agents/export.py
@@ -19,14 +19,25 @@ import logging
import os
import sys
from dataclasses import dataclass
+from itertools import pairwise
from pathlib import Path
from typing import Any, Final
+from urllib.parse import urlsplit
+
+from jarvis.core.branding import LEGACY_MCP_AGENTS_SERVER_NAMES, MCP_AGENTS_SERVER_NAME
log = logging.getLogger(__name__)
-#: The server's name in a client's config. Kept stable — renaming it in a
-#: client's file orphans the old entry rather than replacing it.
-ENTRY_NAME: Final[str] = "jarvis-agents"
+#: The server's name in a client's config.
+ENTRY_NAME: Final[str] = MCP_AGENTS_SERVER_NAME
+
+#: Names this module wrote the entry under before. An entry found under one of
+#: them keeps working untouched until the next write here, which replaces it
+#: (see :func:`_is_own_entry`) so a client never holds the same server twice.
+LEGACY_ENTRY_NAMES: Final[tuple[str, ...]] = LEGACY_MCP_AGENTS_SERVER_NAMES
+
+#: The module the stdio entry launches. Also how an entry is recognised as ours.
+_BRIDGE_MODULE: Final[str] = "jarvis.mcp.agents.bridge"
@dataclass(frozen=True)
@@ -148,7 +159,7 @@ def stdio_entry(
env["JARVIS_CONTROL_KEY"] = key
return {
"command": python or sys.executable,
- "args": ["-m", "jarvis.mcp.agents.bridge"],
+ "args": ["-m", _BRIDGE_MODULE],
"env": env,
}
@@ -170,6 +181,25 @@ def http_entry(*, token: str | None = None, base_url: str | None = None) -> dict
}
+def _is_own_entry(entry: Any) -> bool:
+ """Whether a config entry points at this app's agent surface.
+
+ Decided by the entry's target and never by its name: the stdio shape
+ launches the bridge module, the HTTP shape calls the surface path. An
+ entry somebody wrote by hand under the same name, pointing anywhere else,
+ is theirs.
+ """
+ from .bridge import SURFACE_PATH
+
+ if not isinstance(entry, dict):
+ return False
+ args = entry.get("args")
+ if isinstance(args, list) and ("-m", _BRIDGE_MODULE) in pairwise(args):
+ return True
+ url = entry.get("url")
+ return isinstance(url, str) and urlsplit(url).path.rstrip("/") == SURFACE_PATH
+
+
def entry_for(
*,
transport: str = "stdio",
@@ -218,7 +248,10 @@ def install(
"""Write the entry into the client's own config file.
Merges rather than replaces: an existing ``mcpServers`` object keeps every
- other server, and only our named entry is rewritten. TOML clients are not
+ other server, and only our named entry is rewritten. An entry this module
+ wrote under an earlier name is replaced by the new one, so the client does
+ not list every tool twice; an entry under such a name that points
+ somewhere else was written by the person and stays. TOML clients are not
written to — a hand-formatted ``config.toml`` is easy to corrupt and hard
to restore, so Codex gets a snippet to paste instead.
"""
@@ -260,6 +293,9 @@ def install(
if not isinstance(servers, dict):
return {"ok": False, "error": f"{path} has an mcpServers key that is not an object."}
replaced = ENTRY_NAME in servers
+ renamed_from = [name for name in LEGACY_ENTRY_NAMES if _is_own_entry(servers.get(name))]
+ for name in renamed_from:
+ del servers[name]
servers[ENTRY_NAME] = entry
path.parent.mkdir(parents=True, exist_ok=True)
# Write through a sibling temp file: a client reading a half-written config
@@ -271,7 +307,8 @@ def install(
"ok": True,
"client": target.label,
"path": str(path),
- "replaced": replaced,
+ "replaced": replaced or bool(renamed_from),
+ "renamed_from": renamed_from,
"transport": transport,
"restart_required": True,
}
@@ -279,6 +316,7 @@ def install(
__all__ = [
"ENTRY_NAME",
+ "LEGACY_ENTRY_NAMES",
"ClientTarget",
"entry_for",
"http_entry",
diff --git a/jarvis/mcp/server.py b/jarvis/mcp/server.py
index a4fe7afabe..96dc06289d 100644
--- a/jarvis/mcp/server.py
+++ b/jarvis/mcp/server.py
@@ -15,7 +15,10 @@ Resources:
- jarvis://core-memory/all — full core-memory JSON
Registration in the external `openclaw` CLI:
- claude mcp add jarvis python -m jarvis.mcp.server
+ claude mcp add dodaios python -m jarvis.mcp.server
+
+A registration made earlier under the name ``jarvis`` keeps working: the name
+is the client's own label for this command, and nothing here reads it.
Loop detection:
Every request handler checks the `JARVIS_MCP_DEPTH` env var. If it is
diff --git a/jarvis/society/checkpoints.py b/jarvis/society/checkpoints.py
index 04f7b074f8..c559e7dddc 100644
--- a/jarvis/society/checkpoints.py
+++ b/jarvis/society/checkpoints.py
@@ -54,6 +54,8 @@ from collections.abc import Callable
from dataclasses import dataclass
from typing import Any, Final
+from jarvis.core.mcp_names import CLI_TOOL_PREFIX, own_cli_tool
+
from .capabilities import CapabilityKind, capability_id_for_tool
from .events import AgentState, Checkpoint, MsgType, RoomState, SocietyEnvelope
from .memory import MEMORY_HOLD_S
@@ -146,10 +148,10 @@ _WORK_FAMILY: Final[dict[str, str]] = {
#: teammate messaging carry their own work family (``_WORK_FAMILY``).
_SOCIETY_SKILL_TOOL: Final[str] = "society_run_skill"
_SOCIETY_PREFIX: Final[str] = "society_"
-#: A coding CLI names an MCP tool ``mcp__<server>__<tool>``; Jarvis' own server
-#: carries the plugins, so those calls are classified by the tool behind them.
-_CLI_MCP_PREFIX: Final[str] = "mcp__"
-_JARVIS_MCP_SERVER: Final[str] = "jarvis"
+#: A coding CLI names an MCP tool ``mcp__<server>__<tool>``; this app's own
+#: server carries the plugins, so those calls are classified by the tool behind
+#: them — under every name that server is registered as
+#: (``jarvis.core.mcp_names``).
def family_of_tool(tool_name: str, *, cli_seat: bool = False) -> str:
@@ -167,9 +169,9 @@ def family_of_tool(tool_name: str, *, cli_seat: bool = False) -> str:
read through the ``mcp__<server>__<tool>`` name — Jarvis' server hands out
the plugins, any other server is an MCP capability.
"""
- if tool_name.startswith(_CLI_MCP_PREFIX):
- server, _, inner = tool_name[len(_CLI_MCP_PREFIX) :].partition("__")
- if server == _JARVIS_MCP_SERVER and inner:
+ if tool_name.startswith(CLI_TOOL_PREFIX):
+ inner = own_cli_tool(tool_name)
+ if inner:
return family_of_tool(inner)
return str(CapabilityKind.MCP)
work = _WORK_FAMILY.get(tool_name)
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/MessengerTurn.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/MessengerTurn.test.tsx
index bcb0d3907a..cd3ee9664b 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/MessengerTurn.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/MessengerTurn.test.tsx
@@ -71,6 +71,8 @@ describe("actionNoticeOf", () => {
it("classifies a call even behind a transport prefix", () => {
expect(callPresence(call("mcp__jarvis__society_memory_recall", {}))).toBe("recall");
+ expect(callPresence(call("mcp__dodaios__society_memory_recall", {}))).toBe("recall");
+ expect(presenceOf(turn([call("mcp__dodaios__society_wiki_note", { title: "x" })]))).toBe("writing");
expect(callPresence(call("Bash", {}))).toBe("command");
});
});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/messengerPresence.ts b/jarvis/ui/web/frontend/src/components/agentchat/messengerPresence.ts
index 8b25fe2ed2..13fc8c07de 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/messengerPresence.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/messengerPresence.ts
@@ -26,7 +26,7 @@ export type Presence =
/** The turn just finished: a short flourish before the stage clears. */
| "done";
-/** The bare operation of a call, without its transport prefix (`mcp__jarvis__…`, `jarvis/…`). */
+/** The bare operation of a call, without its transport prefix (`mcp__dodaios__…`, `dodaios/…`). */
export function bareToolName(name: string): string {
return (name.split(/__|\//).pop() ?? name).replace(/^(?:functions|tools)\./, "").toLowerCase();
}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts
index 950251f72c..d0d48515ea 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts
@@ -6,7 +6,7 @@ import pt from "@/i18n/locales/pt.json";
import { reduceThinkingSteps, type ThinkingStep } from "@/lib/thinkingSteps";
import type { ToolBlock, TurnBlock } from "./reduce";
import {
- buildTimeline, commandBinary, shortPath, traceDuration, withoutCd,
+ buildTimeline, commandBinary, ownServerTool, shortPath, traceDuration, withoutCd,
type ActivityEntry, type Call, type TimelineOptions,
} from "./traceEntries";
import { stepsToBlocks } from "./VoiceWorkTrace";
@@ -91,6 +91,25 @@ describe("trace timeline", () => {
expect(cli).toMatchObject({ kind: "command", text: "jarvisctl outputs list" });
});
+ it("reads the app's own server under its current and its earlier name alike", () => {
+ for (const server of ["dodaios", "jarvis"]) {
+ const plugin = only(tool("g", { name: `mcp__${server}__gmail`, input: { query: "is:unread" }, output: "[]" }));
+ expect(plugin).toMatchObject({ kind: "service", text: "Gmail" });
+ expect(plugin.brand).toBeTruthy();
+ const own = only(tool("r", { name: `mcp__${server}__society_routines`, input: {}, output: "{}" }));
+ expect(own).toMatchObject({ kind: "tool", text: "Society routines" });
+ const cli = only(tool("j", { name: `mcp__${server}__cli_jarvisctl`, input: { command: "jarvisctl outputs list" }, output: "" }));
+ expect(cli).toMatchObject({ kind: "command", text: "jarvisctl outputs list" });
+ const artifact = only(tool("a", { name: `mcp__${server}__create_artifact`, input: { title: "GitHub Stars" }, output: "Built." }));
+ expect(artifact).toMatchObject({ kind: "family", text: "Created an artifact", detail: "GitHub Stars" });
+ }
+ expect(ownServerTool("dodaios/gmail")).toBe("gmail");
+ expect(ownServerTool("Jarvis/gmail")).toBe("gmail");
+ expect(ownServerTool("github/create_issue")).toBeNull();
+ expect(ownServerTool("gmail")).toBeNull();
+ expect(ownServerTool("dodaios/")).toBeNull();
+ });
+
it("keeps Jarvis's own tools in their words and a terse result", () => {
const call = only(tool("a", { name: "mcp__jarvis__create_artifact", input: { title: "GitHub Stars" }, output: "The artifact is being built." }));
expect(call).toMatchObject({ kind: "family", text: "Created an artifact", detail: "GitHub Stars", result: "The artifact is being built." });
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts
index d39779bfa9..844547a103 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts
@@ -22,6 +22,7 @@
*/
import { fill } from "@/i18n";
+import { MCP_TOOLS_SERVER_NAMES } from "@/lib/branding";
import { cliVendor } from "@/lib/cliVendors";
import { resolveToolBrand } from "@/lib/toolBrand";
import { describeToolStep } from "@/lib/toolStepLabel";
@@ -305,19 +306,31 @@ export function commandBinary(command: string): string {
return "";
}
+/**
+ * The tool behind a call to the app's own MCP server, under every name that
+ * server has had ("dodaios/gmail", "jarvis/gmail" → "gmail"); null for
+ * another server's tool or a name without a server.
+ */
+export function ownServerTool(name: string): string | null {
+ const slash = name.indexOf("/");
+ if (slash <= 0 || slash === name.length - 1) return null;
+ return MCP_TOOLS_SERVER_NAMES.includes(name.slice(0, slash).toLowerCase()) ? name.slice(slash + 1) : null;
+}
+
/** One finished or running call as its line. */
function callOf(block: ToolBlock, turn: TurnStatus, t: Translate, lang: string): Call {
const view = traceToolIdentity(block);
const record = inputRecord(block);
const { status, reason } = statusOf(block, turn, t);
const name = traceToolName(block.name);
- const own = /^jarvis\//i.test(name) ? describeToolStep(name.slice("jarvis/".length), block.input) : null;
+ const ownTool = ownServerTool(name);
+ const own = ownTool !== null ? describeToolStep(ownTool, block.input) : null;
const description = own && (FAMILIES.has(own.family) || own.family === "shell") ? own : view.description;
const action = view.action === "memory" ? null : view.action;
const base = { id: block.callId, block, status, reason, added: 0, removed: 0, result: "", detail: "", brand: null as string | null };
- // Jarvis's CLI wrappers ("mcp__jarvis__cli_jarvisctl") run a command line.
- const wrapper = /^jarvis\/cli_/i.test(name) && firstString(record, ACTION_KEYS.command);
+ // The app's CLI wrappers ("mcp__dodaios__cli_jarvisctl") run a command line.
+ const wrapper = ownTool !== null && /^cli_/i.test(ownTool) && firstString(record, ACTION_KEYS.command);
if (action === "command" || description.family === "shell" || wrapper) {
const raw = firstString(record, ACTION_KEYS.command) || (typeof block.input === "string" ? block.input : "") || description.detail;
const command = oneLine(withoutCd(raw.split(/\r?\n/).find((line) => line.trim()) ?? ""), 200);
@@ -351,10 +364,10 @@ function callOf(block: ToolBlock, turn: TurnStatus, t: Translate, lang: string):
const kind: CallKind = family === "web" ? "web" : "family";
return { ...base, kind, text: capitalize(tr(t, `family.${family}`)), detail: oneLine(description.detail, 100), result, bucket: `family:${family}` };
}
- if (own) {
- // Jarvis's own server is the road, not the destination: "jarvis/gmail"
- // is the Gmail plugin, "jarvis/society_routines" is that tool by name.
- const rest = name.slice("jarvis/".length);
+ if (own && ownTool !== null) {
+ // The app's own server is the road, not the destination: "dodaios/gmail"
+ // is the Gmail plugin, "dodaios/society_routines" is that tool by name.
+ const rest = ownTool;
const brand = resolveToolBrand(rest);
if (brand.logoUrl) {
return { ...base, kind: "service", text: brand.label, detail: oneLine(own.detail, 100), result, bucket: `used:${brand.label}`, brand: brand.brandId ?? brand.label };
diff --git a/jarvis/ui/web/frontend/src/components/society/office/deskChat.test.ts b/jarvis/ui/web/frontend/src/components/society/office/deskChat.test.ts
index fa7112d250..ba586e4773 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/deskChat.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/deskChat.test.ts
@@ -31,6 +31,8 @@ describe("desk chat lines", () => {
});
it("labels tools and versions events", () => {
expect(toolLabel("Read")).toBe("Read");
+ expect(toolLabel("mcp__dodaios__society_shell")).toBe("society_shell");
+ expect(toolLabel("mcp__jarvis__society_shell")).toBe("society_shell");
expect(toolLabel(undefined)).toBe("tool");
expect(chatVersion([])).toBe("0");
expect(chatVersion([ev(9, "x", {})])).toBe("9:1");
diff --git a/jarvis/ui/web/frontend/src/components/society/office/deskChat.ts b/jarvis/ui/web/frontend/src/components/society/office/deskChat.ts
index be6098107d..131a9d27d8 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/deskChat.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/deskChat.ts
@@ -17,7 +17,7 @@ function clean(text: unknown, max = 160): string {
return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
}
-/** Short, human tool names: "mcp__jarvis__society_shell" → "society_shell". */
+/** Short, human tool names: "mcp__dodaios__society_shell" → "society_shell". */
export function toolLabel(name: unknown): string {
if (typeof name !== "string" || !name) return "tool";
const parts = name.split("__");
diff --git a/jarvis/ui/web/frontend/src/lib/branding.test.ts b/jarvis/ui/web/frontend/src/lib/branding.test.ts
index afa2e6946c..33317b8d05 100644
--- a/jarvis/ui/web/frontend/src/lib/branding.test.ts
+++ b/jarvis/ui/web/frontend/src/lib/branding.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import {
+ MCP_TOOLS_SERVER_NAMES,
OFFICIAL_REPO_LABEL,
OFFICIAL_REPO_SLUG,
OFFICIAL_REPO_URL,
@@ -17,4 +18,8 @@ describe("branding", () => {
expect(OFFICIAL_REPO_URL).toBe("https://github.com/Dodaios/Dodaios");
expect(OFFICIAL_REPO_LABEL).toBe("github.com/Dodaios/Dodaios");
});
+
+ it("names the MCP tools server, the current name first and the earlier one kept", () => {
+ expect(MCP_TOOLS_SERVER_NAMES).toEqual(["dodaios", "jarvis"]);
+ });
});
diff --git a/jarvis/ui/web/frontend/src/lib/branding.ts b/jarvis/ui/web/frontend/src/lib/branding.ts
index 2a02286229..9081536b3f 100644
--- a/jarvis/ui/web/frontend/src/lib/branding.ts
+++ b/jarvis/ui/web/frontend/src/lib/branding.ts
@@ -4,3 +4,11 @@ export const PRODUCT_NAME = "Dodaios";
export const OFFICIAL_REPO_SLUG = "Dodaios/Dodaios";
export const OFFICIAL_REPO_URL = `https://github.com/${OFFICIAL_REPO_SLUG}`;
export const OFFICIAL_REPO_LABEL = `github.com/${OFFICIAL_REPO_SLUG}`;
+
+/**
+ * Every name the app's own MCP tools server has been registered under, the
+ * current one first (jarvis/core/branding.py). A coding CLI names a tool after
+ * its server ("mcp__dodaios__gmail"), and transcripts written under the
+ * earlier name are still on disk, so a reader accepts all of them.
+ */
+export const MCP_TOOLS_SERVER_NAMES: readonly string[] = ["dodaios", "jarvis"];
diff --git a/tests/contract/test_browser_desktop_mcp.py b/tests/contract/test_browser_desktop_mcp.py
index 89c5dc9a34..9bfef39958 100644
--- a/tests/contract/test_browser_desktop_mcp.py
+++ b/tests/contract/test_browser_desktop_mcp.py
@@ -216,8 +216,8 @@ def test_jarvis_codex_seat_uses_owned_browser_not_inherited_plugins(
assert "--ignore-user-config" in plan.argv
assert "--ignore-rules" in plan.argv
assert "browser_use" in plan.argv and "plugins" in plan.argv
- assert 'mcp_servers.jarvis.tools.society_browser.approval_mode="approve"' in plan.argv
- assert "mcp_servers.jarvis.required=true" in plan.argv
+ assert 'mcp_servers.dodaios.tools.society_browser.approval_mode="approve"' in plan.argv
+ assert "mcp_servers.dodaios.required=true" in plan.argv
coding = runner_cli.plan_codex(**args)
assert "--ignore-user-config" not in coding.argv
assert "browser_use" not in coding.argv
diff --git a/tests/unit/agent_chat/test_jarvis_harness.py b/tests/unit/agent_chat/test_jarvis_harness.py
index a7a0739edc..7bcf7db262 100644
--- a/tests/unit/agent_chat/test_jarvis_harness.py
+++ b/tests/unit/agent_chat/test_jarvis_harness.py
@@ -191,9 +191,53 @@ def test_both_cli_shapes_point_at_the_same_endpoint(monkeypatch):
def test_the_preamble_names_the_prefix_the_tools_actually_get():
"""If the prefix drifts, the model is told to use tools it cannot see."""
- assert "`mcp__jarvis__<tool>`" in jarvis_harness.SYSTEM_PREAMBLE
- assert "`jarvis__<tool>`" in jarvis_harness.SYSTEM_PREAMBLE
- assert jarvis_harness._SERVER_NAME == "jarvis"
+ assert jarvis_harness._SERVER_NAME == "dodaios"
+ assert "`mcp__dodaios__<tool>`" in jarvis_harness.SYSTEM_PREAMBLE
+ assert "`dodaios__<tool>`" in jarvis_harness.SYSTEM_PREAMBLE
+ assert "`mcp__dodaios__run_shell` / `dodaios__run_shell`" in jarvis_harness.SYSTEM_PREAMBLE
+ assert "from the `dodaios` MCP server" in jarvis_harness.SYSTEM_PREAMBLE
+ # The model is told one name: the one the tools are mounted under.
+ assert "jarvis__" not in jarvis_harness.SYSTEM_PREAMBLE
+
+
+def test_every_cli_shape_mounts_the_server_under_the_one_name(monkeypatch):
+ """Claude's JSON, Codex' overrides and the Grok block must agree on the name."""
+ monkeypatch.setattr(jarvis_harness, "control_key", lambda: "k")
+ runtime_refs.set_api_base_url("http://127.0.0.1:47821")
+
+ assert list(json.loads(jarvis_harness.mcp_config_json("s") or "{}")["mcpServers"]) == [
+ "dodaios"
+ ]
+ codex = jarvis_harness.codex_config_args("society:scout")
+ assert codex[1::2] and all(arg.startswith("mcp_servers.dodaios.") for arg in codex[1::2])
+ assert 'mcp_servers.dodaios.tools.society_browser.approval_mode="approve"' in codex
+ assert 'mcp_servers.dodaios.default_tools_approval_mode="approve"' in codex
+ block = jarvis_harness._grok_jarvis_block(jarvis_harness.grok_mcp_server_entry("s") or {})
+ assert "[mcp_servers.dodaios]" in block and "[mcp_servers.dodaios.headers]" in block
+
+
+def test_a_grok_block_written_under_the_earlier_name_is_replaced_not_joined():
+ """A project file from an older version must not end up with two mounts."""
+ older = "\n".join(
+ [
+ "[mcp_servers.linear]",
+ 'url = "https://mcp.linear.app/mcp"',
+ "",
+ "# BEGIN JARVIS HANDS",
+ "[mcp_servers.jarvis]",
+ 'url = "http://127.0.0.1:47821/api/control/mcp/"',
+ "# END JARVIS HANDS",
+ "",
+ ]
+ )
+ block = jarvis_harness._grok_jarvis_block(
+ {"url": "http://127.0.0.1:47821/api/control/mcp/", "bearer_token_env_var": "K"}
+ )
+ merged = jarvis_harness._merge_grok_jarvis_block(older, block)
+
+ assert "[mcp_servers.jarvis]" not in merged
+ assert merged.count("[mcp_servers.dodaios]") == 1
+ assert "[mcp_servers.linear]" in merged
def test_agy_plugin_is_skipped_when_the_app_is_not_ready(tmp_path, monkeypatch):
diff --git a/tests/unit/agent_chat/test_jarvis_identity.py b/tests/unit/agent_chat/test_jarvis_identity.py
index b2d01e68b9..c4681f8367 100644
--- a/tests/unit/agent_chat/test_jarvis_identity.py
+++ b/tests/unit/agent_chat/test_jarvis_identity.py
@@ -233,8 +233,8 @@ def test_grok_with_identity_writes_a_project_mcp_config(monkeypatch, tmp_path: P
config = (tmp_path / ".grok" / "config.toml").read_text(encoding="utf-8")
assert "[mcp_servers.linear]" in config
assert "https://mcp.linear.app/mcp" in config
- assert "[mcp_servers.jarvis]" in config
- assert config.count("[mcp_servers.jarvis]") == 1
+ assert "[mcp_servers.dodaios]" in config
+ assert config.count("[mcp_servers.dodaios]") == 1
assert "/api/control/mcp/" in config
assert 'bearer_token_env_var = "JARVIS_CONTROL_API_KEY"' in config
assert "sess-1" in config
@@ -250,7 +250,7 @@ def test_grok_with_identity_writes_a_project_mcp_config(monkeypatch, tmp_path: P
identity=_identity(tmp_path),
)
again = (tmp_path / ".grok" / "config.toml").read_text(encoding="utf-8")
- assert again.count("[mcp_servers.jarvis]") == 1
+ assert again.count("[mcp_servers.dodaios]") == 1
assert "[mcp_servers.linear]" in again
@@ -285,7 +285,9 @@ def test_agy_with_identity_drops_a_workspace_plugin(monkeypatch, tmp_path: Path)
)
plugin = tmp_path / ".agents" / "plugins" / "jarvis-hands" / "mcp_config.json"
payload = json.loads(plugin.read_text(encoding="utf-8"))
- server = payload["mcpServers"]["jarvis"]
+ # The file is written whole, so one mount is all it can hold.
+ assert list(payload["mcpServers"]) == ["dodaios"]
+ server = payload["mcpServers"]["dodaios"]
assert server["serverUrl"].endswith("/api/control/mcp/")
assert server["headers"]["Authorization"] == "Bearer k"
assert server["headers"][jarvis_harness.HEADER_NAME] == "sess-1"
diff --git a/tests/unit/agent_chat/test_turn_completion.py b/tests/unit/agent_chat/test_turn_completion.py
index 45a5d7395a..be699a8970 100644
--- a/tests/unit/agent_chat/test_turn_completion.py
+++ b/tests/unit/agent_chat/test_turn_completion.py
@@ -353,14 +353,16 @@ async def test_a_secret_asked_for_in_the_reply_is_steered_to_the_secure_field_on
assert await gate.next_prompt() is None
-async def test_a_turn_that_opened_the_field_is_left_alone(card_world, monkeypatch):
[email protected]("server", ["dodaios", "jarvis"])
+async def test_a_turn_that_opened_the_field_is_left_alone(card_world, monkeypatch, server):
+ """The tool is recognised behind the server's current and its earlier name."""
from jarvis.agent_chat import turn_completion
monkeypatch.setattr(turn_completion, "_stored_credentials", stored([]))
_, _, gate = card_world
call = make_event(
"tool_call",
- {"call_id": "c", "name": "mcp__jarvis__society_request_credential", "input": {}},
+ {"call_id": "c", "name": f"mcp__{server}__society_request_credential", "input": {}},
)
await finish_with(
gate, call, make_event("assistant_text", {"text": "Please enter the token in the field."})
diff --git a/tests/unit/agent_runtimes/test_runtime_configs.py b/tests/unit/agent_runtimes/test_runtime_configs.py
index 53c525671c..559b1884fb 100644
--- a/tests/unit/agent_runtimes/test_runtime_configs.py
+++ b/tests/unit/agent_runtimes/test_runtime_configs.py
@@ -206,7 +206,8 @@ def test_openclaw_config_keeps_both_keys_out_of_the_file(tmp_path):
provider = config["models"]["providers"]["jarvis"]
assert provider["apiKey"] == "${JARVIS_RUNTIME_API_KEY}"
assert provider["api"] == "openai-completions"
- headers = config["mcp"]["servers"]["jarvis"]["headers"]
+ assert list(config["mcp"]["servers"]) == ["dodaios"]
+ headers = config["mcp"]["servers"]["dodaios"]["headers"]
assert headers["Authorization"] == "Bearer ${JARVIS_CONTROL_API_KEY}"
assert headers["X-Jarvis-Chat-Session"] == "society:hermit"
run = OpenClawRuntime().config_for(
@@ -214,7 +215,7 @@ def test_openclaw_config_keeps_both_keys_out_of_the_file(tmp_path):
)
# A routine run's tool calls carry its own session (approvals, grants).
assert (
- run["mcp"]["servers"]["jarvis"]["headers"]["X-Jarvis-Chat-Session"]
+ run["mcp"]["servers"]["dodaios"]["headers"]["X-Jarvis-Chat-Session"]
== "society:hermit:routine:t1:abc"
)
diff --git a/tests/unit/mcp/test_agent_mcp_export.py b/tests/unit/mcp/test_agent_mcp_export.py
index b65e4424c4..6f5f478231 100644
--- a/tests/unit/mcp/test_agent_mcp_export.py
+++ b/tests/unit/mcp/test_agent_mcp_export.py
@@ -63,7 +63,7 @@ def test_install_keeps_every_other_server(fake_home: Path) -> None:
assert result["ok"] is True
assert result["replaced"] is False
written = json.loads(path.read_text(encoding="utf-8"))
- assert set(written["mcpServers"]) == {"blender", "jarvis-agents"}
+ assert set(written["mcpServers"]) == {"blender", "dodaios-agents"}
assert written["mcpServers"]["blender"] == {"command": "blender-mcp"}
@@ -75,7 +75,8 @@ def test_install_is_idempotent(fake_home: Path) -> None:
assert first["replaced"] is False
assert second["replaced"] is True
written = json.loads((fake_home / ".cursor" / "mcp.json").read_text(encoding="utf-8"))
- assert list(written["mcpServers"]) == ["jarvis-agents"]
+ assert list(written["mcpServers"]) == ["dodaios-agents"]
+ assert second["renamed_from"] == []
# No stray temp file left behind by the atomic write.
assert not list((fake_home / ".cursor").glob("*.jarvis-tmp"))
@@ -97,7 +98,7 @@ def test_a_toml_client_gets_a_snippet_instead_of_a_write(fake_home: Path) -> Non
result = export.install("codex")
assert result["ok"] is False
- assert "[mcp_servers.jarvis-agents]" in result["snippet"]
+ assert "[mcp_servers.dodaios-agents]" in result["snippet"]
assert not (fake_home / ".codex" / "config.toml").exists()
@@ -109,4 +110,108 @@ def test_an_unknown_client_names_the_known_ones(fake_home: Path) -> None:
def test_snippet_is_valid_json_for_nested_clients(fake_home: Path) -> None:
parsed = json.loads(export.snippet("claude-desktop"))
- assert list(parsed["mcpServers"]) == ["jarvis-agents"]
+ assert list(parsed["mcpServers"]) == ["dodaios-agents"]
+
+
+# ---------------------------------------------------------------------------
+# The entry's earlier name
+# ---------------------------------------------------------------------------
+
+
+def _write_cursor(home: Path, servers: dict) -> Path:
+ path = home / ".cursor" / "mcp.json"
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(json.dumps({"mcpServers": servers}), encoding="utf-8")
+ return path
+
+
+def _servers(path: Path) -> dict:
+ return json.loads(path.read_text(encoding="utf-8"))["mcpServers"]
+
+
+def test_the_entry_is_written_under_the_new_name_and_the_old_one_is_known() -> None:
+ assert export.ENTRY_NAME == "dodaios-agents"
+ assert export.LEGACY_ENTRY_NAMES == ("jarvis-agents",)
+
+
[email protected]("transport", ["stdio", "http"])
+def test_an_entry_written_under_the_earlier_name_is_replaced_not_joined(
+ fake_home: Path, transport: str
+) -> None:
+ """Two entries for one server show the client every tool twice."""
+ earlier = export.entry_for(transport=transport)
+ path = _write_cursor(
+ fake_home, {"blender": {"command": "blender-mcp"}, "jarvis-agents": earlier}
+ )
+
+ result = export.install("cursor", transport=transport)
+
+ assert result["ok"] is True
+ assert result["replaced"] is True
+ assert result["renamed_from"] == ["jarvis-agents"]
+ assert set(_servers(path)) == {"blender", "dodaios-agents"}
+ assert _servers(path)["blender"] == {"command": "blender-mcp"}
+
+
+def test_an_earlier_entry_from_another_interpreter_or_port_is_still_ours(fake_home: Path) -> None:
+ """Ownership follows the target (the bridge module), not the exact command line."""
+ earlier = {
+ "command": "/opt/old-venv/bin/python",
+ "args": ["-I", "-m", "jarvis.mcp.agents.bridge"],
+ "env": {"JARVIS_API_URL": "http://127.0.0.1:50000"},
+ }
+ path = _write_cursor(fake_home, {"jarvis-agents": earlier})
+
+ assert export.install("cursor")["renamed_from"] == ["jarvis-agents"]
+ assert list(_servers(path)) == ["dodaios-agents"]
+
+
+ "handmade",
+ [
+ {"command": "node", "args": ["my-own-agents-server.js"]},
+ {"type": "http", "url": "https://example.test/mcp"},
+ {"command": "python", "args": ["-m", "jarvis.mcp.server"]},
+ "not even an object",
+ ],
+)
+def test_an_entry_somebody_else_put_under_the_earlier_name_is_never_touched(
+ fake_home: Path, handmade: object
+) -> None:
+ """The name alone proves nothing: only an entry aimed at our surface is ours."""
+ path = _write_cursor(fake_home, {"jarvis-agents": handmade})
+
+ result = export.install("cursor")
+
+ assert result["ok"] is True
+ assert result["replaced"] is False
+ assert result["renamed_from"] == []
+ assert _servers(path)["jarvis-agents"] == handmade
+ assert "dodaios-agents" in _servers(path)
+
+
+def test_an_entry_under_any_other_name_is_left_alone_even_when_it_targets_us(
+ fake_home: Path,
+) -> None:
+ """A name we never wrote is a name the person chose."""
+ theirs = export.entry_for(transport="stdio")
+ path = _write_cursor(fake_home, {"my-team": theirs})
+
+ export.install("cursor")
+
+ assert _servers(path)["my-team"] == theirs
+
+
+def test_an_untouched_registration_under_the_earlier_name_keeps_its_target(
+ fake_home: Path,
+) -> None:
+ """Nothing is rewritten until the person connects again: the old entry still
+ launches a module that exists and calls a path that is served."""
+ import importlib.util
+
+ from jarvis.mcp.agents.bridge import SURFACE_PATH
+
+ earlier = export.entry_for(transport="stdio")
+ assert earlier["args"] == ["-m", "jarvis.mcp.agents.bridge"]
+ assert importlib.util.find_spec("jarvis.mcp.agents.bridge") is not None
+ assert export.entry_for(transport="http")["url"].endswith(SURFACE_PATH)
diff --git a/tests/unit/mcp/test_agent_mcp_routes.py b/tests/unit/mcp/test_agent_mcp_routes.py
index 5d0430590a..67dfb86194 100644
--- a/tests/unit/mcp/test_agent_mcp_routes.py
+++ b/tests/unit/mcp/test_agent_mcp_routes.py
@@ -146,10 +146,10 @@ def test_snippet_route_returns_pasteable_config(connect_app: FastAPI) -> None:
with TestClient(connect_app) as client:
body = client.get("/api/agent-mcp/snippet", params={"client": "claude-desktop"}).json()
parsed = json.loads(body["snippet"])
- assert list(parsed["mcpServers"]) == ["jarvis-agents"]
+ assert list(parsed["mcpServers"]) == ["dodaios-agents"]
toml = client.get("/api/agent-mcp/snippet", params={"client": "codex"}).json()
- assert toml["snippet"].startswith("[mcp_servers.jarvis-agents]")
+ assert toml["snippet"].startswith("[mcp_servers.dodaios-agents]")
bad = client.get("/api/agent-mcp/snippet", params={"client": "emacs"})
assert bad.status_code == 404
@@ -169,7 +169,7 @@ def test_connect_writes_into_a_clients_config(
assert body["ok"] is True
assert body["restart_required"] is True
written = json.loads((tmp_path / ".cursor" / "mcp.json").read_text(encoding="utf-8"))
- assert "jarvis-agents" in written["mcpServers"]
+ assert list(written["mcpServers"]) == ["dodaios-agents"]
# ------------------------------------------------------- per-client tokens
@@ -271,11 +271,11 @@ def test_pair_returns_a_finished_config_with_its_own_credential(
assert secret.startswith("jarvis_mcp_")
# The config is finished: paste it, restart the client, done.
- entry = body["config"]["mcpServers"]["jarvis-agents"]
+ entry = body["config"]["mcpServers"]["dodaios-agents"]
assert entry["args"] == ["-m", "jarvis.mcp.agents.bridge"]
assert entry["env"]["JARVIS_MCP_TOKEN"] == secret
assert "JARVIS_CONTROL_KEY" not in entry["env"], "pairing must not hand out the master key"
- assert json.loads(body["config_text"])["mcpServers"]["jarvis-agents"] == entry
+ assert json.loads(body["config_text"])["mcpServers"]["dodaios-agents"] == entry
# And it really works as a credential.
assert token_store.verify(secret) is not None
@@ -292,7 +292,7 @@ def test_pair_for_another_machine_uses_that_address(connect_app: FastAPI, token_
},
).json()
- entry = body["config"]["mcpServers"]["jarvis-agents"]
+ entry = body["config"]["mcpServers"]["dodaios-agents"]
assert entry["url"] == "http://192.168.1.50:47821/api/control/mcp/agents"
assert entry["headers"]["Authorization"] == f"Bearer {body['secret']}"
diff --git a/tests/unit/mcp/test_tools_server_names.py b/tests/unit/mcp/test_tools_server_names.py
new file mode 100644
index 0000000000..7028170ca1
--- /dev/null
+++ b/tests/unit/mcp/test_tools_server_names.py
@@ -0,0 +1,256 @@
+"""The app's own MCP server answers to ``dodaios`` and, forever, to ``jarvis``.
+
+A coding CLI names a tool after the server it mounted, so the server's name is
+part of every tool name the app reads back: ``mcp__dodaios__gmail`` today,
+``mcp__jarvis__gmail`` in every transcript, registration and session written
+before the rename. One test per reader of such a name, each run under both
+server names, so a reader that knows only one of them fails here by name.
+"""
+
+from __future__ import annotations
+
+import ast
+import json
+import re
+import sqlite3
+from pathlib import Path
+
+import pytest
+
+import jarvis.core.branding as branding
+from jarvis.core import mcp_names
+
+_ROOT = Path(__file__).resolve().parents[3]
+
+SERVERS = pytest.mark.parametrize("server", list(mcp_names.TOOLS_SERVER_NAMES))
+
+
+# ---------------------------------------------------------------------------
+# The names
+# ---------------------------------------------------------------------------
+
+
+def test_the_current_name_comes_first_and_the_earlier_one_stays() -> None:
+ assert branding.MCP_TOOLS_SERVER_NAME == "dodaios"
+ assert branding.LEGACY_MCP_TOOLS_SERVER_NAMES == ("jarvis",)
+ assert mcp_names.TOOLS_SERVER_NAMES == ("dodaios", "jarvis")
+ assert mcp_names.own_cli_tool_prefixes() == ("mcp__dodaios__", "mcp__jarvis__")
+ assert mcp_names.cli_tool_name("gmail") == "mcp__dodaios__gmail"
+
+
+@SERVERS
+def test_a_call_to_the_apps_own_server_is_recognised(server: str) -> None:
+ assert mcp_names.is_tools_server(server)
+ assert mcp_names.own_cli_tool(f"mcp__{server}__gmail") == "gmail"
+ # Everything after the server belongs to the tool, double underscores included.
+ assert mcp_names.own_cli_tool(f"mcp__{server}__a__b") == "a__b"
+ assert mcp_names.split_cli_tool_name(f"mcp__{server}__gmail") == (server, "gmail")
+
+
+ "name", ["mcp__github__create_issue", "gmail", "mcp__dodaios", "mcp____x", "dodaios__gmail"]
+)
+def test_anything_else_is_not_the_apps_own_tool(name: str) -> None:
+ assert mcp_names.own_cli_tool(name) is None
+
+
+def test_the_frontend_restates_the_server_names() -> None:
+ source = (_ROOT / "jarvis/ui/web/frontend/src/lib/branding.ts").read_text(encoding="utf-8")
+ match = re.search(r"MCP_TOOLS_SERVER_NAMES[^=]*=\s*(\[[^\]]*\])", source)
+ assert match is not None
+ assert tuple(json.loads(match.group(1))) == mcp_names.TOOLS_SERVER_NAMES
+
+
+def test_no_shipped_module_spells_the_server_name_into_a_tool_prefix() -> None:
+ """A literal prefix knows one name; the helper knows every name."""
+ offenders: list[str] = []
+ for path in (_ROOT / "jarvis").rglob("*.py"):
+ if "node_modules" in path.parts:
+ continue
+ source = path.read_text(encoding="utf-8-sig")
+ if "jarvis" not in source and "dodaios" not in source:
+ continue
+ relative = path.relative_to(_ROOT).as_posix()
+ docstrings = _docstring_nodes(ast.parse(source))
+ for node in ast.walk(ast.parse(source)):
+ if not isinstance(node, ast.Constant) or not isinstance(node.value, str):
+ continue
+ if (node.lineno, node.col_offset) in docstrings:
+ continue
+ if _SPELLED_OUT.search(node.value):
+ offenders.append(f"{relative}:{node.lineno}: {node.value[:60]!r}")
+ assert not offenders, "use jarvis.core.mcp_names / branding:\n" + "\n".join(offenders)
+
+
+_SPELLED_OUT = re.compile(r"mcp__(?:jarvis|dodaios)__|mcp_servers\.(?:jarvis|dodaios)\b")
+
+
+def _docstring_nodes(tree: ast.AST) -> set[tuple[int, int]]:
+ found: set[tuple[int, int]] = set()
+ for node in ast.walk(tree):
+ if not isinstance(node, (ast.Module, ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)):
+ continue
+ body = getattr(node, "body", [])
+ if body and isinstance(body[0], ast.Expr) and isinstance(body[0].value, ast.Constant):
+ found.add((body[0].value.lineno, body[0].value.col_offset))
+ return found
+
+
+# ---------------------------------------------------------------------------
+# Readers that single out the app's own server
+# ---------------------------------------------------------------------------
+
+
+@SERVERS
+def test_a_runtimes_own_spelling_is_normalised(server: str) -> None:
+ """Hermes, OpenClaw and Grok each spell the same tool their own way."""
+ from jarvis.agent_runtimes.acp import normalize_tool_name
+
+ expected = f"mcp__{server}__society_memory_recall"
+ for spelled in (
+ f"mcp_{server}_society_memory_recall",
+ f"{server}__society_memory_recall",
+ f"{server}.society_memory_recall",
+ expected,
+ ):
+ assert normalize_tool_name(spelled) == expected
+ assert normalize_tool_name("terminal") == "terminal"
+ assert normalize_tool_name("mcp__github__create_issue") == "mcp__github__create_issue"
+
+
+@SERVERS
+def test_a_normalised_runtime_call_reaches_the_family_it_belongs_to(server: str) -> None:
+ """The two readers compose: what the runtime reports is what the island shows."""
+ from jarvis.agent_runtimes.acp import normalize_tool_name
+ from jarvis.society.checkpoints import family_of_tool
+
+ assert family_of_tool(normalize_tool_name(f"{server}__gmail"), cli_seat=True) == "comms"
+
+
+@SERVERS
+def test_the_society_classifies_a_call_by_the_tool_behind_the_server(server: str) -> None:
+ from jarvis.society.checkpoints import family_of_tool
+
+ assert family_of_tool(f"mcp__{server}__google_drive", cli_seat=True) == "plugin"
+ assert family_of_tool(f"mcp__{server}__society_run_skill", cli_seat=True) == "skill"
+ assert family_of_tool(f"mcp__{server}__gmail", cli_seat=True) == "comms"
+ # Any other server stays an MCP capability, whatever its tool is called.
+ assert family_of_tool("mcp__github__gmail", cli_seat=True) == "mcp"
+
+
+@SERVERS
[email protected]("hashed", [False, True])
+def test_a_resumed_hermes_conversation_drops_its_pinned_tool_list(
+ tmp_path: Path, server: str, hashed: bool
+) -> None:
+ """Without this a conversation resumed after the rename keeps offering dead tools."""
+ from jarvis.agent_runtimes.tool_snapshot import refresh_tool_search_cache
+
+ name = f"mcp__{server}__society_ask_user"
+ snapshot = (
+ json.dumps({"tools": [{"function": {"name": name}}, {"function": {"name": "tool_search"}}]})
+ if hashed
+ else json.dumps([name, "tool_search"])
+ )
+ pin = "snapshot-hash" if hashed else snapshot
+ with sqlite3.connect(tmp_path / "state.db") as db:
+ db.executescript(
+ "CREATE TABLE sessions (id TEXT PRIMARY KEY, tool_names TEXT);"
+ "CREATE TABLE system_prompts (hash TEXT PRIMARY KEY, prompt TEXT);"
+ )
+ db.execute("INSERT INTO sessions VALUES (?, ?)", ("selected", pin))
+ db.execute("INSERT INTO system_prompts VALUES (?, ?)", ("snapshot-hash", snapshot))
+
+ assert refresh_tool_search_cache(tmp_path, "selected")
+ with sqlite3.connect(tmp_path / "state.db") as db:
+ assert db.execute("SELECT tool_names FROM sessions").fetchone() == (None,)
+
+
+def test_a_hermes_tool_list_without_the_apps_tools_is_kept(tmp_path: Path) -> None:
+ from jarvis.agent_runtimes.tool_snapshot import refresh_tool_search_cache
+
+ pin = json.dumps(["mcp__github__create_issue", "terminal"])
+ with sqlite3.connect(tmp_path / "state.db") as db:
+ db.executescript(
+ "CREATE TABLE sessions (id TEXT PRIMARY KEY, tool_names TEXT);"
+ "CREATE TABLE system_prompts (hash TEXT PRIMARY KEY, prompt TEXT);"
+ )
+ db.execute("INSERT INTO sessions VALUES (?, ?)", ("selected", pin))
+
+ assert not refresh_tool_search_cache(tmp_path, "selected")
+
+
+# ---------------------------------------------------------------------------
+# Readers that strip any server: the bare tool decides
+# ---------------------------------------------------------------------------
+
+
+@SERVERS
+def test_an_approval_is_matched_on_the_bare_tool(server: str) -> None:
+ from jarvis.agent_chat.approval_bridge import _bare
+
+ assert _bare(f"mcp__{server}__open-app") == "open-app"
+
+
+@SERVERS
+def test_an_agents_ask_rule_still_gates_the_tool(
+ server: str, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """A permission rule must not fall away because the server was renamed."""
+ from types import SimpleNamespace
+
+ from jarvis.society import surface
+ from jarvis.society.capabilities import capability_id_for_tool
+
+ capability = capability_id_for_tool("gmail")
+ assert capability is not None
+ agent = SimpleNamespace(approval_rules={"require_approval": [capability]})
+ monkeypatch.setattr(
+ surface, "current_runtime", lambda: SimpleNamespace(cached_agent=lambda _id: agent)
+ )
+ monkeypatch.setattr(surface, "agent_id_of", lambda _session: "scout")
+
+ assert surface.requires_explicit_approval("society:scout", f"mcp__{server}__gmail", {})
+ assert surface.requires_explicit_approval("society:scout", "gmail", {})
+ assert not surface.requires_explicit_approval(
+ "society:scout", f"mcp__{server}__google_drive", {}
+ )
+
+
+@SERVERS
+def test_the_pet_reads_the_action_behind_the_server(server: str) -> None:
+ from jarvis.ui.pets.actions import action_for_tool
+
+ assert action_for_tool(f"mcp__{server}__web_search") == "searching"
+ assert action_for_tool(f"mcp__{server}__open-app") == "working"
+
+
+@SERVERS
+def test_the_tools_listing_marks_the_call_as_mcp(server: str) -> None:
+ from types import SimpleNamespace
+
+ from jarvis.ui.web.tools_routes import _tool_to_dict
+
+ assert _tool_to_dict(f"mcp__{server}__gmail", SimpleNamespace())["source"] == "mcp"
+
+
+@SERVERS
+def test_the_realtime_budget_files_the_call_under_mcp(server: str) -> None:
+ from jarvis.realtime.tools import _BUDGET_DROP_FAMILIES
+
+ name = f"mcp__{server}__gmail"
+ families = [family for family, pattern in _BUDGET_DROP_FAMILIES if pattern.search(name)]
+ assert families[:1] == ["mcp"]
+
+
+@SERVERS
+def test_mission_evidence_names_a_codex_call_after_its_server(server: str) -> None:
+ from jarvis.missions import stream_evidence
+
+ stream = json.dumps(
+ {
+ "type": "item.completed",
+ "item": {"type": "mcp_tool_call", "server": server, "tool": "gmail", "status": "ok"},
+ }
+ )
+ assert f"mcp__{server}__gmail" in stream_evidence.normalize_worker_stream(stream)
diff --git a/tests/unit/society/test_cli_routines.py b/tests/unit/society/test_cli_routines.py
index a875190eb9..9e56eaed94 100644
--- a/tests/unit/society/test_cli_routines.py
+++ b/tests/unit/society/test_cli_routines.py
@@ -246,11 +246,11 @@ def test_resumed_society_seat_refreshes_routine_contract(monkeypatch, tmp_path):
resume="existing-thread",
identity=identity,
)
- assert "mcp_servers.jarvis.required=true" in plan.argv
+ assert "mcp_servers.dodaios.required=true" in plan.argv
# Codex exec cannot answer its own MCP prompts; every Jarvis tool defers
# to the session catalog and ToolExecutor, which own the approval card.
- assert 'mcp_servers.jarvis.default_tools_approval_mode="approve"' in plan.argv
- assert 'mcp_servers.jarvis.tools.society_browser.approval_mode="approve"' in plan.argv
+ assert 'mcp_servers.dodaios.default_tools_approval_mode="approve"' in plan.argv
+ assert 'mcp_servers.dodaios.tools.society_browser.approval_mode="approve"' in plan.argv
# A society seat gets no vendor-native hands that would bypass that gate.
assert 'sandbox_mode="read-only"' in plan.argv
assert 'approval_policy="never"' in plan.argv
diff --git a/tests/unit/society/test_remote_tools.py b/tests/unit/society/test_remote_tools.py
index 8d4b5e7eba..4a0561227f 100644
--- a/tests/unit/society/test_remote_tools.py
+++ b/tests/unit/society/test_remote_tools.py
@@ -197,7 +197,7 @@ async def test_remote_cli_spawn_mounts_tools_and_reaps_without_caller_wait(
if line.startswith("exec ")))
config_path = parts[parts.index("--mcp-config") + 1]
config = json.loads((connection.root / config_path.lstrip("/")).read_text())
- server = config["mcpServers"]["jarvis"]
+ server = config["mcpServers"]["dodaios"]
async with httpx.AsyncClient() as client:
response = await client.post(server["url"], headers=server["headers"])
process.stdout.write(response.text + "\n")
@@ -278,10 +278,22 @@ async def test_runner_wiring_and_file_cleanup(connection, runner):
assert "fixture-owner-key" not in encoded
if runner == "claude-cli":
loaded = json.loads((connection.root / config.args[1].lstrip("/")).read_text())
- assert loaded["mcpServers"]["jarvis"]["type"] == "http"
+ assert list(loaded["mcpServers"]) == ["dodaios"]
+ assert loaded["mcpServers"]["dodaios"]["type"] == "http"
if runner == "codex-cli":
- assert "mcp_servers.jarvis.required=true" in config.args
- assert 'mcp_servers.jarvis.default_tools_approval_mode="approve"' in config.args
+ assert "mcp_servers.dodaios.required=true" in config.args
+ assert 'mcp_servers.dodaios.default_tools_approval_mode="approve"' in config.args
+ if runner == "opencode-cli":
+ mounted = json.loads(config.env["OPENCODE_CONFIG_CONTENT"])
+ assert list(mounted["mcp"]) == ["dodaios"]
+ # A session resumed from a mount under the earlier name still asks
+ # for `jarvis_<tool>`: both rules, or the rename costs it the allow.
+ assert mounted["permission"] == {"dodaios_*": "allow", "jarvis_*": "allow"}
+ if runner == "agy-cli":
+ (mount,) = [p for p in workspace.rglob("mcp_config.json")]
+ assert list(json.loads(mount.read_text())["mcpServers"]) == ["dodaios"]
+ if runner == "grok-cli":
+ assert "[mcp_servers.dodaios]" in content and "[mcp_servers.jarvis]" not in content
if runner == "cursor-cli":
assert '"other"' in content
if runner == "grok-cli":
@@ -294,6 +306,58 @@ async def test_runner_wiring_and_file_cleanup(connection, runner):
assert remaining == old_files
+async def _cursor_mount(connection, existing: dict) -> dict:
+ """What a Cursor turn finds in the project file while it runs."""
+ path = connection.root / "workspace/.cursor/mcp.json"
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(json.dumps({"mcpServers": existing}))
+ async with contextlib.AsyncExitStack() as stack:
+ await configure(
+ connection,
+ RemoteHost(),
+ stack,
+ runner="cursor-cli",
+ cwd="/workspace",
+ url="http://127.0.0.1:23456/mcp",
+ token="turn-only", # noqa: S106 — isolated fake SSH server
+ )
+ during = json.loads(path.read_text())["mcpServers"]
+ # Cleanup puts the person's file back exactly as it was.
+ assert json.loads(path.read_text())["mcpServers"] == existing
+ return during
+
+
+async def test_a_mount_left_under_the_earlier_name_is_not_served_twice(connection):
+ """A turn that crashed before cleanup left its mount behind as ``jarvis``."""
+ stale = {
+ "url": "http://127.0.0.1:40111/mcp",
+ "headers": {"Authorization": "Bearer expired-turn-token"},
+ }
+ during = await _cursor_mount(
+ connection, {"other": {"url": "https://example.test"}, "jarvis": stale}
+ )
+
+ assert set(during) == {"other", "dodaios"}
+ assert during["dodaios"]["url"] == "http://127.0.0.1:23456/mcp"
+
+
+ "theirs",
+ [
+ {"url": "https://jarvis.example.test/mcp", "headers": {"Authorization": "Bearer x"}},
+ {"url": "http://127.0.0.1:40111/mcp", "headers": {"X-Api-Key": "x"}},
+ {"url": "http://127.0.0.1:40111/mcp"},
+ {"command": "node", "args": ["jarvis.js"]},
+ ],
+)
+async def test_a_server_the_person_named_jarvis_survives_the_mount(connection, theirs):
+ """Only this app's own loopback mount is removed; the name alone proves nothing."""
+ during = await _cursor_mount(connection, {"jarvis": theirs})
+
+ assert during["jarvis"] == theirs
+ assert "dodaios" in during
+
+
async def test_cleanup_preserves_concurrent_changes(connection):
async with contextlib.AsyncExitStack() as stack:
await configure(