Skip to content

MCP & Bridge

MCP integration and Bridge cross-interface connectivity form the two core channels of Claude Code’s extension fabric — one reaching outward to external tool capabilities, one connecting inward to multi-surface interfaces.

Core Question

How does an agent system gain external capabilities without modifying core code? How does the same agent simultaneously support CLI, IDE, Desktop, and Mobile? MCP and Bridge answer these two questions respectively.

MCP Integration

Transport Layer

Claude Code supports 6 MCP transport methods:

TransportDescription
stdioStandard I/O, local process communication
SSEServer-Sent Events, HTTP long polling
HTTPStandard HTTP request/response
WebSocketFull-duplex communication
SDKAnthropic SDK native integration
claude.ai proxyRelay through claude.ai

Configuration Scopes

MCP servers can be registered across 7 configuration scopes:

ScopeCoverageTypical Use
Global user configAll projectsUniversal tools (search, browser)
Project .mcp.jsonSingle projectProject-specific tools
CLAUDE.md declarationProject/localLightweight tool declarations
Plugin-embeddedPlugin scopeMCP servers bundled with plugins
Environment variablesSession-levelTemporary overrides
SDK modeProgrammatic useSDK client-provided
IDE configIDE scopeVS Code / JetBrains integration

Tool Naming and Registration

MCP tools follow the mcp__<server>__<tool> naming pattern, dynamically registered into the tool system. This means MCP tools share with built-in tools:

  • The same permission check flow
  • The same execution orchestration (parallel/serial partitioning)
  • The same result budget mechanism
  • The same hook interception points

This “unified tool surface” design prevents external tools from bypassing the governance system.

OAuth 2.0 + PKCE

Remote MCP server authentication uses OAuth 2.0 + PKCE, supporting:

  • Authorization code flow (for environments with a browser)
  • Device code flow (for pure CLI environments)
  • Token caching and refresh

Bridge Cross-Interface Connectivity

Multi-Surface Architecture

Bridge is not an experimental feature but an integrated cross-interface connection capability. It lets the same Claude Code instance be accessed through multiple interfaces:

SurfaceCommand EntryPurpose
IDEsrc/commands/ideVS Code, JetBrains editors
Desktopsrc/commands/desktopElectron desktop application
Mobilesrc/commands/mobileMobile control
Chromesrc/commands/chromeBrowser extension

Mailbox Mechanism

Bridge implements cross-interface messaging through Mailbox:

  • src/utils/mailbox.ts — Message mailbox core
  • src/context/mailbox.tsx — Mailbox UI context

The message mailbox is asynchronous — senders don’t need receivers to be online. This lets the CLI run in the background while IDE interfaces connect/disconnect at will.

    flowchart TB
    subgraph Core ["Claude Code Core"]
        Agent["Agent Loop"]
        Bridge["Bridge Service<br/>src/bridge/"]
        Mailbox["Mailbox<br/>Message Queue"]
    end

    subgraph MCP_Layer ["MCP Channel"]
        MCP1["stdio MCP Server"]
        MCP2["HTTP MCP Server"]
        MCP3["claude.ai Proxy"]
    end

    subgraph UI_Layer ["Interface Channel"]
        CLI["CLI Terminal"]
        IDE["VS Code / JetBrains"]
        Desktop["Desktop App"]
        Mobile["Mobile"]
    end

    Agent --> Bridge
    Agent --> MCP1
    Agent --> MCP2
    Agent --> MCP3

    Bridge --> Mailbox
    Mailbox --> CLI
    Mailbox --> IDE
    Mailbox --> Desktop
    Mailbox --> Mobile
  

Where the Two Channels Meet

MCP and Bridge play different but complementary roles in the extension fabric:

DimensionMCPBridge
DirectionOutward: connecting external capabilitiesInward: connecting multi-surface interfaces
Registration timingAt config time or runtime discoveryAt process startup
Communication patternRequest/responseMessage mailbox (async)
GovernanceUnified tool surfaceIndependent connection management

The two channels intersect in some scenarios: an IDE can connect to Claude Code via Bridge, while Claude Code connects back to the IDE’s LSP service via MCP.

Lessons for Agent Builders

PatternDescription
Unified tool surfaceExternal tools (MCP) and built-in tools share the same governance — no backdoors
Multi-transport adaptationDon’t assume users have only one network environment — support from stdio to WebSocket
Async mailboxCross-interface communication shouldn’t require both parties online — message queues are more robust
Layered configurationGlobal → project → plugin → session, letting users override at the appropriate scope

Path Evidence

PathRole
src/services/mcp/MCP integration core
src/bridge/Bridge service core
src/utils/mailbox.tsMessage mailbox mechanism
src/context/mailbox.tsxMailbox UI context
src/commands/bridgeBridge command entry
src/commands/ideIDE integration commands

Further Reading

  1. Architecture Map — Extension fabric in the six-layer structure
  2. Tool Plane — MCP tool registration and governance
  3. Plugin System — How plugins embed MCP servers
  4. Signals & Extensions — Bridge maturity assessment