ExplainThis 全端開發雙週報 #85 從 MCP 核心協定轉為無狀態,談有狀態與無狀態的設計如何取捨
This section introduces the latest edition of the ExplainThis Full-Stack Development Bi-weekly newsletter and announces the launch of a new course on the E+ membership platform. The course, titled 'Writing Maintainable Code (Part 2) — Practical Methods in Everyday Development,' provides actionable daily coding techniques to complement the theoretical foundations presented in Part 1. It also highlights that subscribers can utilize corporate education subsidies to fund their E+ memberships. Software development frequently requires evaluating trade-offs between stateful and stateless architectures across frontend and backend systems. Common examples of this distinction include choosing between session-based versus token-based authentication and WebSockets versus HTTP for communication. The Model Context Protocol (MCP) recently officially transitioned its core protocol from stateful to stateless. Understanding this transition helps engineers navigate architectural decision-making and common system design interview questions. In 1990s web development, session-based authentication was the mainstream approach, requiring server-side session management. However, this creates scaling challenges when horizontally expanding servers to handle high traffic. Using sticky sessions to pin users to specific servers introduces a single point of failure if a server crashes without shared storage. Consequently, this stateful architecture poses risks such as lost shopping cart contents or interrupted form submissions.
Read the original ↗Contents
ExplainThis 全端開發雙週報 #85 從 MCP 核心協定轉為無狀態,談有狀態與無狀態的設計如何取捨
This section introduces the latest edition of the ExplainThis Full-Stack Development Bi-weekly newsletter and announces the launch of a new course on the E+ membership platform. The course, titled 'Writing Maintainable Code (Part 2) — Practical Methods in Everyday Development,' provides actionable daily coding techniques to complement the theoretical foundations presented in Part 1. It also highlights that subscribers can utilize corporate education subsidies to fund their E+ memberships.
- ExplainThis launched 'Writing Maintainable Code (Part 2) — Practical Methods in Everyday Development' on its E+ membership platform.
- Unlike the theoretical focus of Part 1, Part 2 concentrates on practical, day-to-day methods to improve code maintainability.
- E+ memberships can be reimbursed via corporate training subsidies with formal tax-ID receipts provided.
- More than half of the new E+ subscribers in the previous month utilized company educational subsidies to join.
從 MCP 核心協定轉為無狀態,談有狀態與無狀態的設計如何取捨
Software development frequently requires evaluating trade-offs between stateful and stateless architectures across frontend and backend systems. Common examples of this distinction include choosing between session-based versus token-based authentication and WebSockets versus HTTP for communication. The Model Context Protocol (MCP) recently officially transitioned its core protocol from stateful to stateless. Understanding this transition helps engineers navigate architectural decision-making and common system design interview questions.
- Choosing between stateful and stateless design is a fundamental trade-off in both frontend and backend software engineering.
- Authentication systems typically balance stateful session-based approaches against stateless token-based alternatives.
- Network communication commonly contrasts stateful WebSockets with stateless HTTP protocols.
- MCP recently migrated its core protocol from a stateful design to a stateless design.
從驗證的角度看有狀態與無狀態
In 1990s web development, session-based authentication was the mainstream approach, requiring server-side session management. However, this creates scaling challenges when horizontally expanding servers to handle high traffic. Using sticky sessions to pin users to specific servers introduces a single point of failure if a server crashes without shared storage. Consequently, this stateful architecture poses risks such as lost shopping cart contents or interrupted form submissions.
- Session-based authentication relies on server-side management, creating challenges for horizontal scaling across multiple servers.
- Sticky sessions route a user's requests to the same server, coupling user state to a specific server instance.
- A server crash under a sticky session setup can lead to a single point of failure if session data is not synchronized to shared storage.
- Practical e-commerce implementations avoid keeping state solely in single-server memory by utilizing shared storage, databases, or caches.
- Architecture that depends on server-stored session information is classified as stateful design.
有狀態與無狀態的差別是什麼?
In software design, a stateful component retains session information needed for interaction, whereas a stateless component holds no internal context and requires each incoming request to provide complete information. This distinction parallels medical records, shifting from local paper files restricted to a single clinic to centralized, cloud-accessible electronic health records. In authentication, self-contained tokens such as JWT enable stateless architectures because servers only need to verify token signatures rather than store user sessions. Consequently, any server instance can independently handle client requests, significantly improving fault tolerance and horizontal scalability.
- Stateful components preserve user session details, whereas stateless components require clients to submit all necessary information with every request.
- Analogous to local paper charts moving to cloud-based electronic health records, stateless systems remove reliance on state stored on specific local nodes.
- Token-based authentication utilizing self-contained tokens (such as JWT) enables stateless authentication flows by eliminating server-side session storage.
- In a stateless token architecture, servers validate token signatures and contents directly without tracking state between requests.
- Stateless designs increase system resilience, allowing any alternate server to fulfill a request if the primary server fails.
MCP 該是有狀態還是無狀態?
Model Context Protocol (MCP) was originally designed as a stateful protocol inspired by LSP to minimize connection overhead for local client-server communication over stdio. As adoption expanded to remote and multi-machine deployments, stateful connections created scalability bottlenecks, prevented straightforward load balancing, and increased state-loss risks. Following community feedback and proposals like SEP-1442 co-authored by Google Cloud representatives, the protocol adapted to these evolving requirements. The latest version of MCP officially transitioned its core protocol to stateless, allowing load balancers to distribute requests flexibly across instances.
- MCP initially adopted a stateful design modeled after LSP to reduce handshake costs for local AI agents running tools over stdio.
- Stateful architecture hindered remote multi-machine scaling, as it made simple load balancing impractical and created state-loss risks if a server crashed.
- SEP-1442, backed by companies including Google Cloud, proposed transitioning MCP toward a stateless architecture for better scalability.
- On 2026-07-28, MCP officially updated its core protocol to be stateless, facilitating horizontal scaling and multi-instance load balancing.
閱讀更多
ExplainThis offers a membership tier called E+ for readers interested in more comprehensive content. The subscription provides access to exclusive in-depth articles and videos focused on frontend and backend development, AI engineering, and career growth. Additionally, subscribers gain access to a dedicated Discord community for networking and peer exchange.
- ExplainThis provides an E+ membership program featuring exclusive in-depth content.
- The membership curriculum covers frontend and backend development, AI engineering, and career development.
- E+ members receive access to a dedicated Discord community for networking and peer collaboration.
本期推薦
This newsletter curation highlights several software engineering resources, industry developments, and notable community figures. It features technical insights including the Octane framework, practical PostgreSQL operations, software architecture philosophy from Gregor Hohpe, and Jeff Atwood's timeless advice on minimizing code. In artificial intelligence, Thinking Machines Lab co-founder Lilian Weng stepped down for health reasons following the release of the Inkling model, while Kimi launched its K3 model. Additionally, the section covers Hong Wang becoming the first Chinese female recipient of the Fields Medal.
- Octane is an open-source project that retains React syntax such as Hooks and Suspense but directly updates the DOM via a compiler.
- A startup operational guide details practical PostgreSQL management spanning schema design, indexing, transactions, vacuuming, and large-scale data migrations.
- Lilian Weng stepped down from Thinking Machines Lab due to health reasons shortly after the team released its first open-weight model, Inkling.
- Hong Wang became the third woman and first Chinese woman to win the Fields Medal in mathematics.
- Kimi launched the K3 model, which outperforms Claude Fable in specific benchmark evaluations, prompting discussions on self-directed learning highlighted by founder Zhilin Yang's former advisor Russ Salakhutdinov.