Skip to content

MCP client mode#155

Merged
stippi merged 8 commits into
mainfrom
feature/mcp-client-mode
Jul 6, 2026
Merged

MCP client mode#155
stippi merged 8 commits into
mainfrom
feature/mcp-client-mode

Conversation

@stippi

@stippi stippi commented Jul 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

stippi added 8 commits July 5, 2026 21:05
…n/capabilities

Tools discovered at runtime (upcoming MCP client mode) only know their
name, description and capability tags as owned strings. name and
description become Cow<'static, str>, capabilities becomes
Vec<Cow<'static, str>> with a ToolSpec::capabilities() helper for the
literal case. All built-in tools updated mechanically.
McpServersConfig/McpServerConfig: stdio command/args/env, per-server
enabled flag, per-tool enabled_tools allowlist + disabled_tools denylist
(denylist wins). Registry names follow the mcp__<server>__<tool>
convention, sanitized and capped at 64 bytes with a deterministic
fnv1a suffix.
McpServerConnection wraps the official SDK's RunningService (stdio via
TokioChildProcess, arbitrary transports for tests). McpTool implements
DynTool: schema passed through from the MCP descriptor, invoke is a
tools/call round-trip; transport failures degrade to error outputs, not
agent crashes. register_mcp_tools connects every enabled server and
registers its enabled tools with mcp + scope:mcp-<server> + embedder
tags. discover_tools provides ephemeral discovery for settings UIs.
Tested end-to-end against an in-process rmcp server over duplex I/O.
mcp-servers.json in the config dir (with ${ENV} substitution in server
env values) feeds default_registry_with_mcp(): defaults plus every
enabled server's enabled tools, tagged scope:agent/scope:agent-diff.
The acp and terminal frontends await the full registry directly; the
gpui wiring builds it on the backend runtime and swaps it into the
SessionManager before the service worker starts, so the window opens
without waiting for MCP handshakes. Includes an ignored smoke test
driving a real child process (code-assistant's own MCP server mode).
New settings section with one expandable card per configured server:
header shows name, launch command and an enable switch; the expanded
body discovers the server's tools over the protocol (on a background
thread with its own tokio runtime) and offers a per-tool toggle
persisted to disabled_tools. Add/edit via inline form (name, command,
args, env with ${VAR} placeholders kept raw), delete, retry on failed
connections. Backed by mcp-servers.json.
AGENTS.md gains the mcp_client crate and a Configuration section for
the client mode; the design note records what landed and what remains
(additive scope selection, outward-confirmation interceptor). Adds an
ignored end-to-end test: mcp-servers.json -> default_registry_with_mcp
-> namespaced, scope-tagged tools served by a real child process.
Embedders other than code-assistant (pal) load the servers config from
their own settings file and need the same secret-substitution semantics.
McpServersConfig::substitute_env_values takes a lookup closure so tests
and embedders control resolution; the core loader delegates to it.
@stippi stippi merged commit 05d126a into main Jul 6, 2026
4 of 5 checks passed
@stippi stippi deleted the feature/mcp-client-mode branch July 6, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant