跳到正文
Hacker News-首页· rwilinski·· 3 小时前AI 评分57

MCP Explained:Model Context Protocol 规范与架构详解

MCP Explained

AI 导读

MCP Explained 详细梳理了 Model Context Protocol 的 JSON-RPC 规范、核心生命周期、传输层及客户端与服务端特性。文章涵盖了协议的最新版本变化、安全攻防边界以及即将推出的扩展功能路线图。

正文 · 原文

MCP Explained

by

Model Context Protocol

JSON-RPC Spec 2025-11-25

Spec version2025-11-25 · default

Nov ’24 Mar ’25 Jun ’25 Nov ’25 Jul ’26

Core protocol

JSON-RPC has deprecated partsThe message format

  1. 1Request
  2. 2Result
  3. 3Error
  4. 4Notification
  5. 5Batch deprecated

LifecycleInitialize, operate, shut down

Transports has deprecated partsstdio and Streamable HTTP

Authorization has deprecated partsOAuth 2.1 for remote servers

Server features

ToolsFunctions the model can call

ResourcesData the app can read

PromptsTemplates the user picks

Client features

Sampling has deprecated partsThe server borrows the model

ElicitationThe server asks the user

RootsWhere the server may work

Utilities

ProgressProgress, cancel and logs

Tasks experimentalCall now, collect later

Not in the spec: harness techniques

Tool searchFind the right tool among thousands

CodemodeWrite a program, not 20 tool calls

Break it: attacks and defenses

Tool poisoningInstructions hidden in a tool

Tool shadowingOne server bends another's tool

PassthroughToken passthrough and the confused deputy

InjectionPrompt injection through tool results

PhishingElicitation phishing

Coming to MCP: extensions

Skills over MCP beta extensionAgent Skills served by a server

MCP Apps stable extensionInteractive UI from a tool

Server Cards beta extensionKnow a server before connecting

What's next

Spec 2026-07-28 ↗Stateless, no handshake, multi round-tripExtensions ↗Apps, Skills, Tasks, Server Cards, authSkills over MCP →Agent Skills as an MCP extension · lessonProgressive disclosure ↗Tool search and code mode, in the protocolRegistry ↗registry.modelcontextprotocol.io, in previewRoadmap ↗Next release planned for March 2027

Step 1 of 5

Request

Asks for something and expects exactly one response with the same id.

Network Sequence

Message flow 7 messages · 5 steps

Play Step Reset

# From To Method Info
1 MCP client MCP server tools/list id 1 · list the tools
2 MCP server MCP client result id 1 · 1 tool
3 MCP client MCP server tools/cal id 2 · tools/cal (typo)
4 MCP server MCP client error -32601 id 2 · -32601 Method not found
5 MCP server MCP client notifications/tools/list_changed tools changed, no reply expected
6 MCP client MCP server batch [2]deprecated array of 2 requests
7 MCP server MCP client batch [2]deprecated array of 2 responses

JSON-RPC

The message format

Not in the MCP spec A harness implementation detail, not part of MCP. Nothing new on the wire: the client and servers still speak plain tools/list and tools/call.

Every MCP message is JSON-RPC 2.0. There are only three shapes: a request (has an id, wants an answer), a response (same id, carries a result or an error) and a notification (no id, no answer). Everything else in MCP is a method name on top of these.

| Encoding | UTF-8 JSON, one message per frame | | --- | | Shapes | request, response, notification | | Direction | both ways: servers send requests too | | Removed deprecated | batching: arrays of messages (2025-06-18) | | Error codes | -32700 parse, -32600 invalid, -32601 no method, -32602 bad params, -32603 internal | | Defined in | MCP spec 2025-11-25, Base protocol |

SpecBase protocol ↗JSON-RPC 2.0 ↗schema.ts ↗

What changes in 2026-07-28

  • Every result carries a required resultType: "complete" or "input_required".
  • Servers no longer send requests to clients: they return input_required and the client retries with the answers (multi round-trip).
  • Resource not found moves from -32002 to -32602; new MCP codes -32020 to -32022.

Changelog ↗

Message

tools/list 58 B

MCP client → MCP server · Request · #1

{ "jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {} }id String or integer, never null. Not reused by the sender within the session.method What to do. MCP defines the method names.params Optional arguments object.

MCP spec 2025-11-25. Token counts are illustrative.
Made by Runlayer, the operating layer for AI.

Log 1/7 Lifecycle

来源:Hacker News-首页 · mcp-explained.com