What Happened

A detailed source- code walkthrough published on Juejin (掘金) diss ects how Anthropic's Claude Code implements its Model Context Protocol (MCP) plugin ecosystem. The analysis, part of an ongoing series on Claude Code internals, maps the full lifecycle from plugin discovery to transparent tool proxying — covering src/services /mcp/client.ts, src/tools/MCPTool/MCPTool.ts, and src/utils/plugins/mcpPluginIntegration.ts.

Why It Matters

The architectural choices documented here have direct implications for teams building on or competing with Claude Code. By decoupling external tool integ rations from the core TypeScript engine via a standardized protocol, Anthropic has made the plugin surface language-agnostic: MCP servers can be written in Python, Go, Rust, or any process-capable runtime.

  • Fault isolation by design: Each MCP server runs as an independent subprocess. A plugin crash does not affect the main Claude Code process — only that plugin becomes unavailable. This is enforced at the transport layer via stderr : 'pipe' in the StdioClientTransport config, which prevents plugin error output from polluting the user interface.
  • Transparent proxying means zero model- side changes: The large language model cannot distinguish between a built-in tool like BashTool and a remote MCP tool. Both implement the same interface. The query engine calls tool.call() without awareness of whether execution is local or serialized over stdio to a separate process .
  • Multi-scope config merging: Plugin-provided MCP servers are merged with user- scope and project-scope configurations from .claude/settings.json, enabling per-project tool isolation without global state contamination.

The Technical Detail

Transport Layer

Claude Code's client.ts supports three transport protocols: stdio (standard input/output), SSE, and HTTP. For local plugin development, stdio is the primary path . The transport initialization pattern is:

transport = new StdioClientTransport({ command: finalCommand, args: finalArgs, env: { ...subprocessEnv(), ...serverRef.env, }, stderr: 'pipe', })

Communication between Claude Code and MCP servers uses JSON-RPC over stdin/stdout. The subprocess model means the plugin runtime is fully decoupled from the Node.js host process.

Tool Naming and Proxy Pattern

Remote tools are registered with a nam espaced prefix generated by buildMcpToolName in src/services/mcp/mcpStringUtils.ts. A weather tool from a server named weather becomes mcp__weather__get_weather at registration time. At dispatch time, MCPTool.ts wraps remote tool definitions into the standard local tool interface:

export const MCPTool = buildT ool({ isMcp: true, name: 'mcp', maxResultSizeChars: 100_000, })

The maxResultSizeChars cap of 100,000 characters is the only structural constraint imposed on MCP tool responses before they enter the context window.

Plugin Loading Priority

The load PluginMcpServers function in mcpPluginIntegration.ts follows a defined resolution order : first, .mcp.json files in the plugin directory; second, mc pServers fields in manifest.json; third, .mcpb ( MCP Bundle) archives, which are downloaded, decompressed, cached, and opt ionally prompted for auth credentials such as API keys.

What M CP Servers Can Expose

Per the source analysis, MCP servers can surface three capability types to the model:

  • Tools: Executable functions the model can invoke
  • Resources: Static context data such as API documentation or database schemas
  • Prompt templates: Predefined prompt structures the model can reference

What To Watch

  • MCPB format adoption: The bundle format for distributing MCP plugins is documented in source but not yet widely covered in Anthropic's public docs. Watch for official tool ing or a plugin registry announcement in the next 30 days.
  • Competing tool-call architectures: Open AI's function calling and Google's tool-use in Gemini remain in- process by design. If MCP's subprocess isolation model gains adoption among enterprise teams prioritizing stability, expect competitive responses around sandboxing guarantees.
  • SS E and HTTP transport maturity: The analysis confirms SSE and HTTP transports exist alongside stdio but does not benchmark them. Remote MCP server support (vs. local subprocess) would unlock hosted plugin marketplaces — watch for Anthropic documentation updates on this path.
  • Plugin marketplace activity: The /plugin command is documented as pulling from a plugin market. No public registry URL or catalog size figure appears in the source article. A public launch or expanded catalog would be a significant distribution event for the Claude Code ecosystem.