MCP client mode#155
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.