Architecture
Model Context Protocol(MCP)は、各 host が複数の client instance を実行できる client-host-server architecture を採用しています。この architecture により、明確な security boundary を維持し、関心事を分離しながら、ユーザーはアプリケーション間で AI capabilities を統合できます。JSON-RPC 上に構築された MCP は、client と server の間での context exchange と sampling coordination に重点を置いた、stateful session protocol を提供します。
Core Components
Host
host process は、コンテナおよびコーディネーターとして機能します。
- 複数の client instance を作成し、管理する
- client connection の permission と lifecycle を制御する
- security policy と consent requirement を強制する
- ユーザーの authorization 判断を処理する
- AI/LLM integration と sampling を調整する
- client 間の context aggregation を管理する
Clients
各 client は host によって作成され、分離された server connection を維持します。
- server ごとに 1 つの stateful session を確立する
- protocol negotiation と capability exchange を処理する
- protocol message を双方向にルーティングする
- subscription と notification を管理する
- server 間の security boundary を維持する
host application は複数の client を作成・管理し、各 client は特定の server と 1:1 の関係を持ちます。
Servers
server は、特化した context と capability を提供します。
- MCP primitive を通じて resources、tools、prompts を公開する
- 焦点の絞られた責務を持って独立して動作する
- client interface を通じて sampling を要求する
- security constraint を尊重しなければならない
- local process にも remote service にもなれる
Design Principles
MCP は、その architecture と implementation を方向づける、いくつかの重要な design principle に基づいています。
-
Servers should be extremely easy to build
- host application が複雑な orchestration responsibility を担う
- server は、具体的で明確に定義された capability に集中する
- 単純な interface により implementation overhead を最小化する
- 明確な分離により保守しやすい code を実現する
-
Servers should be highly composable
- 各 server は、分離された状態で焦点の絞られた機能を提供する
- 複数の server をシームレスに組み合わせられる
- 共有された protocol が interoperability を可能にする
- modular design が extensibility を支える
-
Servers should not be able to read the whole conversation, nor "see into" other servers
- server は必要な contextual information のみを受け取る
- 完全な conversation history は host に保持される
- 各 server connection は分離を維持する
- server 間の相互作用は host によって制御される
- host process が security boundary を強制する
-
Features can be added to servers and clients progressively
- core protocol は最小限必要な機能を提供する
- 追加 capability は必要に応じて negotiation できる
- server と client は独立して進化できる
- protocol は将来的な extensibility を考慮して設計されている
- backwards compatibility は維持される
Capability Negotiation
Model Context Protocol は、capability に基づく negotiation system を使用します。この system では、client と server が初期化時にサポートする feature を明示的に宣言します。capability は、session 中に利用可能な protocol feature と primitive を決定します。
- server は、resource subscription、tool support、prompt template などの capability を宣言する
- client は、sampling support や notification handling などの capability を宣言する
- 両者は session 全体を通して、宣言した capability を尊重しなければならない
- 追加 capability は、protocol の extension を通じて negotiation できる
各 capability は、session 中に使用する特定の protocol feature を有効にします。たとえば、次のようになります。
- 実装された server features は、server の capabilities 内で広告されなければならない
- resource subscription notification を送出するには、server が subscription support を宣言する必要がある
- tool invocation には、server が tool capability を宣言する必要がある
- Sampling には、client が capabilities 内で support を宣言する必要がある
この capability negotiation により、protocol の extensibility を維持しながら、client と server はサポートされる機能について明確に理解できます。