fix(app): MCP discovery never blocks a turn; secrets masked as lines are written; TTS child gets no MCP secrets

- Discovery runs outside the MCP tool cache's lock (one at a time), so a turn reading the cached
  tools never waits for a slow server; a new conversation refreshes in the background.
- The log hub masks secrets before a line is kept or written, so a key replaced or removed later
  stays hidden on the screen, in copies, files and exports, also after a restart.
- The worker takes JARVIS_MCP_ENV out of its environment at start, before MeloTTS runs, and hands
  it to the brain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-13 10:07:52 +09:00
parent 3ef4281180
commit 8b3905f1c2
8 changed files with 191 additions and 31 deletions

View File

@@ -152,7 +152,7 @@ MCP_ENV_VAR = "JARVIS_MCP_ENV"
V2_HOST_TOOLS = ("localFiles", "screenshot")
def _take_mcp_env() -> dict:
def take_mcp_env() -> dict:
"""The app's MCP environment, removed from this process's environment so no child process
(MCP servers included) inherits another server's secrets."""
import json
@@ -209,7 +209,8 @@ class JarvisBrain:
tool carry-over follows the person who asked.
"""
def __init__(self, language: Optional[str] = "ko", reply_language: Optional[str] = "Korean"):
def __init__(self, language: Optional[str] = "ko", reply_language: Optional[str] = "Korean",
mcp_env: Optional[dict] = None):
from jarvis.config import load_settings
from jarvis.memory.db import Database
@@ -223,7 +224,7 @@ class JarvisBrain:
self.cfg = dataclasses.replace(
base, tts_engine="melo", stream_browser=False,
disabled_tools=tuple(dict.fromkeys((*base.disabled_tools, *V2_HOST_TOOLS))),
mcps=_with_mcp_env(base.mcps, _take_mcp_env()))
mcps=_with_mcp_env(base.mcps, take_mcp_env() if mcp_env is None else mcp_env))
self.db = Database(self.cfg.db_path, self.cfg.sqlite_vss_path)
# ``language``: the ISO code tools get (e.g. the Wikipedia host); ``reply_language``: replies
# come in it unless the asker explicitly asks for another language (None: the asker's).