Repository navigation
feat(mcp): add built-in MCP host - #162
Merged
Merged
Conversation
Merge MCP bootstrap and session injection foundation from PR #158.
7 tasks
This was referenced May 16, 2026
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.
Summary
Closes #155.
Adds Agent Code's built-in MCP host: a loopback Streamable HTTP MCP server owned by the main process, plus session launch wiring so Claude/Codex agents can be started with scoped Agent Code MCP access.
This PR only adds the foundation and the
pingdomain. It does not add orchestration tools; those live in the stacked orchestration PR.Behavior
127.0.0.1.--mcp-configJSON.--config mcp_servers.*flags.ping, exposingagent_code_pingso a launched agent can confirm its scoped session id, cwd, and domains.Design
The host lives in Electron main instead of a separate stdio helper process. That avoids packaged-app problems where Agent Code would need to locate a separate Node binary just to run its own MCP server, and it gives future built-in domains direct access to app services through typed dependencies rather than rediscovery.
The session metadata remains the policy source (
builtInMcpDomains). Providers only receive the minted URL/header config for the current process, so a provider runtime does not need to know about long-lived domain policy.Files
src/mcp/shared/types.ts— built-in domain/config types and domain normalization.src/mcp/runtime/BuiltInMcpHttpHost.ts— loopback HTTP host, token registry, request authentication, per-requestMcpServerlifecycle.src/mcp/runtime/createBuiltInMcpServer.ts— builds the scoped MCP server and registersagent_code_ping.src/main/sessionManager.ts— registers/revokes built-in MCP configs during session spawn/stop.src/providers/claude/runtime/claudeSession.tsandsrc/providers/codex/runtime/codexSession.ts— inject provider-specific MCP launch flags.src/renderer/src/workspace/types.ts,src/shared/types/session.ts, preload/session API wiring — carriesbuiltInMcpDomains/builtInMcpServersthrough the existing spawn path.Verification
agent_code_pingwas live-exercised from an MCP-enabled agent during development and returned the expected scoped session/cwd/domain payload.tsc -bwas attempted on the branch. The MCP files typecheck, but the repo still reports unrelated pre-existing errors from submodule type resolution andBlockRow.tsx/mergedEntries.tsissues already present outside this PR.Test Plan
builtInMcpDomains: ['ping']; confirmagent_code_pingis available and returns the current session id/cwd.builtInMcpDomains: ['ping']; confirm the same.401.Follow-Up
The stacked orchestration PR builds on this foundation by adding an
orchestrationdomain and the tools that create/list/prompt child agents. The AI Workspace work in #157 should also build on this host, but this PR leaves #157 for a separate implementation.