fix(mcp): address review findings

- redact /mcp output, and stderr lines as they arrive (log, errors, tail)
- take host servers by name: configuration binding sorts keys anyway
- dispose kills the tree only without an exit code and only if the pid's
  start time matches the spawn (no kill of a reused pid)
- idle timer generation guards stale callbacks; catalogue check runs in
  the background with a 10 s cap; shutdown stops servers concurrently
- stop resets a failed status; /mcp shows an exited process; ordinal names
- spec: ${workspace} in command, ordering, dispose and /mcp wording
This commit is contained in:
EugeneTes
2026-09-26 21:18:12 +02:00
parent c9fd58372a
commit 2a201f7d95
15 changed files with 223 additions and 78 deletions

View File

@@ -9,9 +9,11 @@ SDK. (`ClaudeCode.Bridge` is the opposite, an MCP *server* that shows core tools
Servers come from two places. The first one wins a server name:
1. the host's `Mcp` section (`appsettings.json`, or `Mcp__Servers__<name>__Command` and friends in the environment),
in configuration order, then the Playwright preset;
sorted by name (configuration binding sorts keys, so the order in `appsettings.json` doesn't count), then the
Playwright preset;
2. `"mcpServers"` in `~/.volcanic/agent/settings.json` (`VOLCANIC_AGENT_DIR` moves it), with the same entry shape in
camelCase.
camelCase, in file order. The extension reads this file itself, so a host that sets `AgenticCoreOptions.AgentDir`
to another directory must also set `VOLCANIC_AGENT_DIR` for `mcpServers` to be found there.
There is no per-workspace source: a Telegram workspace is writable by the agent itself.
@@ -95,7 +97,8 @@ and `_2`, `_3` added to duplicates. The server is always called with its own nam
tools appear as `mcp__volcanic__<name>`.
- A tool named like a built-in (`read`, `bash`, ...) is **not** registered, and a warning suggests a `toolPrefix`.
- If two servers offer the same name, the first configured wins and a warning names both.
- If two servers offer the same name, the first in the order above wins (host servers by name) and a warning names
both. Give one of them a `toolPrefix` to keep both.
- MCP tools run one at a time unless the server sets `"parallel": true`: most servers (Playwright included) are stateful.
## Lifecycle
@@ -113,11 +116,11 @@ tools appear as `mcp__volcanic__<name>`.
| Command | |
|---|---|
| `/mcp` | Each server: `not started`, `running`, `failed: <reason>` or `disabled`, and its tool count |
| `/mcp` | Each server: `not started`, `running`, `exited`, `failed: <reason>` or `disabled`, and its tool count |
| `/mcp <name>` | Command line (without env values), env names, server version, tools, last error, stderr tail |
| `/mcp restart <name>` | Stop the chat's process; the next call starts a fresh one (clears a wedged browser) |
No model call is made.
No model call is made. Known secret values in the output (a server's stderr, say) are shown as `[REDACTED]`.
## Manual check (not in CI)