Module 3 · AI Engineering English
🔥 5 day streak

Lesson 06: Model Context Protocol (MCP) Integration

2026-06-14 · ~20 min · B1 → C1 · Section 1 / 8
Section 1 Today's Scenario
#TKT-8921 P2 · High Investigating

CLAUDE CODE CLI / LOCAL MCP

MCP Server Handshake Failure during Initialization

We are attempting to integrate our custom local tools via a Model Context Protocol (MCP) server. However, the Claude Code CLI hangs during the initialization phase, and the server fails to expose the required tool schema to the client.

我们正试图通过模型上下文协议 (MCP) 服务器集成我们的本地自定义工具。但是,Claude Code CLI 在初始化阶段挂起,并且服务器未能向客户端暴露所需的工具 Schema。

Section 2 Core Vocabulary Click gray bar to reveal Chinese
Protocol /ˈproʊtəkɑːl/ 协议

A standard set of rules determining how data is transmitted between different devices or components.

"The Model Context Protocol standardizes how AI agents communicate with external data sources."

Expose /ɪkˈspoʊz/ 暴露 / 公开接口

To make a service, port, or function accessible to external clients.

"Ensure the local MCP server exposes the tool schema correctly so the client can read it."

Schema /ˈskiːmə/ 模式 / 架构 / 数据规范

A structured framework defining the format and expected parameters of data.

"The agent failed to parse the JSON schema returned by the MCP endpoint."

Context Window /ˈkɑːntɛkst ˈwɪndoʊ/ 上下文窗口

The maximum amount of tokens or text an AI model can process in a single request.

"Passing the entire database dump will exceed the model's context window; we need to truncate the payload."

Discoverability /dɪˌskʌvərəˈbɪləti/ 可发现性

The ability of a client to dynamically find and list available tools, prompts, or endpoints.

"We rely on the MCP initialization handshake to handle tool discoverability dynamically."

Stdio /ˈstændiːoʊ/ 标准输入/输出 (Standard I/O)

The default data streams for command-line inputs and outputs, commonly used for local IPC.

"For local CLI agents, we strictly use stdio instead of HTTP for the MCP transport layer."

Capability /ˌkeɪpəˈbɪləti/ 能力 / 客户端或服务端支持的功能

A specific function or feature an entity possesses and declares to the other party.

"The client and server negotiate capabilities during the initial MCP handshake to ensure compatibility."

Section 3 Native Engineer Expressions
JG

"The MCP server is failing to advertise its tools."

MCP服务器未能广播/注册其工具 · Use when debugging tool discoverability issues

JG

"Let's check if the client and server agree on the protocol version."

我们检查一下客户端和服务器端协议版本是否一致 · Use during handshake debugging

JG

"I suspect the transport layer is dropping packets over stdio."

我怀疑传输层在通过stdio通信时丢包了 · Use when local IPC/CLI integration fails

JG

"Can you verify the payload matches the expected schema?"

你能确认载荷符合预期的schema规范吗? · Use during API or MCP payload debugging

JG

"The context is getting truncated before reaching the LLM."

上下文在到达大模型之前被截断了 · Use when context window limits cause data loss

Section 4 Technical Reading

The Model Context Protocol (MCP) defines a standardized architecture for connecting AI models to external tools and data sources. When an MCP client initializes a connection, it must perform a handshake to negotiate capabilities. During this critical phase, the MCP server is responsible for exposing a set of tools, each rigidly defined by a JSON schema.

If the transport layer—typically stdio for local command-line interfaces or SSE for remote orchestration—experiences a bottleneck, the initialization sequence may stall. Developers must ensure that all tools are properly advertised and that the resulting payload size does not risk truncating data against the model's context window. Failing to establish a robust protocol connection immediately leads to intermittent discoverability issues, requiring manual intervention to trace the root cause.

Comprehension Check

1. What is the primary purpose of the MCP client's handshake?

To expand the model's context window infinitely.
To negotiate capabilities between the client and server.
To bypass the strict JSON schema requirement.
To forcefully restart the transport layer.

2. Which transport layer is typically used for local command-line interfaces?

Server-Sent Events (SSE)
WebSockets
stdio
HTTP/2 API endpoints

3. What is a direct consequence if tools are not properly advertised by the server?

The client will experience intermittent discoverability issues.
The payload is automatically truncated to save memory.
The JSON schema auto-generates default definitions.
The server forcefully disconnects the transport layer.
Section 5 Writing Task

Write a short technical update to your team via Slack. You are integrating a local MCP server with the Claude Code CLI, but the CLI is hanging during the startup process.

  • 1.Mention the specific phase where it fails (initialization handshake).
  • 2.State the transport layer you are using (stdio).
  • 3.Propose an actionable next step (e.g., verifying the tool schema).
  • 4.Keep it under 80 words.
0 words
Section 6 AI Review Rubric
Grammar / 20 pts
Correct tense usage for ongoing debugging; flawless subject-verb agreement.
Vocabulary / 20 pts
Accurate usage of technical terms (initialization handshake, stdio, schema, transport).
Clarity / 20 pts
The exact point of failure and the proposed next step are immediately obvious.
Professionalism / 20 pts
Tone is proactive, collaborative, and typical of an engineering-first update.
Native-like Expression / 20 pts
Uses concise phrasing (e.g. "hanging on," "dropping packets," or "verify the payload").
Total 100 pts
Section 7 Spaced Repetition Review Tap card to flip

3 Words from Previous Lessons

Orchestration

编排

Automated configuration and coordination of systems.

Isolate

隔离

To identify and separate the specific cause of a bug.

Payload

有效载荷 / 数据包主体

The actual data transmitted, excluding headers.

2 Expressions from Previous Lessons

"The handshake is hanging on the server side."

"I'm escalating this to the infra team as we've exhausted all L1/L2 troubleshooting steps."

Section 8 Challenge Zone ⚡ Above current level

When designing an architecture utilizing the Model Context Protocol (MCP), what are the fundamental trade-offs between using standard input/output (`stdio`) for local tool integration versus using `SSE` (Server-Sent Events) for remote service orchestration?

Answer in English. Use technical vocabulary from this lesson. No word limit.