Claude Code Architecture: Deep MCP and LSP Integration
中文What
Claude Code integrates the Model Context Protocol (MCP) directly into its core runtime instead of treating it as an external plugin, standardizing external tools, resources, prompts, and skills while using LSP (Language Server Protocol) to supply deep local code semantics.
How
1. Establishes connections via stdio, HTTP, SSE, or WebSockets. 2. Standardizes capacities into native tools by translating tools/list into a uniform Tool interface. 3. Dynamically updates capabilities mid-loop by listening to change events like tools/list_changed. 4. Bridges external resources using ListMcpResourcesTool and ReadMcpResourceTool (which saves binary files to disk to preserve LLM context). 5. Handles user-interaction prompts through protocol-defined elicitation.
Why
This allows the AI agent to dynamically expand its operational boundaries at runtime, enabling secure, standardized interaction with proprietary enterprise systems and external APIs without bloating the model's prompt limits.
Other
Security boundary: MCP skills are flagged as remote and untrusted, blocking inline shell execution. Distinguishing roles: MCP is for outward capacity expansion, whereas LSP is for inward semantic enrichment (diagnostics, symbols, and references).