How Claude Code Connects to the Outside World: Models, Auth, MCP, Editors, and Remote Control
The adapter pattern means a team can switch model providers or add a new one without touching application logic—critical when costs, latency, or regional availability change. MCP and ACP turn the assistant into a composable component that plugs into existing editor workflows and internal toolchains, not a standalone app that demands its own silo.
The core agent loop only understands one internal event format. Model-provider adapters translate that common language into each vendor's proprietary API dialect—OpenAI, Gemini, or otherwise—and translate streaming responses, tool calls, and billing data back. Adding a new model means writing one adapter; the core, UI, and tool system never change. Authentication spans API keys, OAuth flows with automatic token refresh, and cloud-provider signatures, all unified behind a single auth state that the core loop never sees. Credentials land in the OS keychain first, falling back to encrypted files.
External tools, databases, and services connect through MCP, a socket standard that lets any compliant server offer tools, resources, and prompt templates to any compliant client. Configuration stacks across five levels—from company-wide admin policy down to per-project personal overrides—and external tools pass through the same permission gate as built-in ones. Editors drive the assistant via ACP, where the agent runs headless, reporting thinking streams, plan progress, and permission requests as structured messages; the editor owns all UI rendering. Remote control works the same way: the phone is a display and remote, the computer does the work, connected through a relay with QR-code pairing, encrypted channels, message throttling, and sleep prevention.
The adapter pattern is not just about model portability—it quarantines compatibility quirks so they never leak into the core loop, tool system, or UI.
Treating tool failures as normal agent-loop feedback rather than system errors is a design choice that keeps conversations resilient; the model often self-corrects without user intervention.
MCP and ACP share the same architectural instinct: the assistant kernel is a headless engine that reports state, and every frontend—terminal, editor, phone—is an interchangeable rendering layer.
The five-level MCP config stack solves a real enterprise tension: IT can lock down which services are allowed, teams can share project defaults, and individuals can still add personal tools without breaking policy.