```html Lesson 09 — Model Context Protocol (MCP) Integration
Module 3 · AI Engineering English
🔥 8 day streak

Lesson 09: Model Context Protocol (MCP) Integration

2026-06-15 · ~20 min · B1 → C1 · Section 1 / 8
Section 1 Today's Scenario
#TKT-8902 P2 · High Needs Investigation

DAILY LAB AGENT · CLAUDE CODE CLI

Claude Code CLI fails to discover tools from local MCP server

We are trying to orchestrate multiple tools using a local MCP server for the Daily English Lab Agent. However, the Claude Code CLI occasionally hangs during the initialization handshake and fails to expose the custom tools to the LLM context window.

我们正尝试使用本地 MCP 服务器为 Daily English Lab Agent 编排多个工具。但是,Claude Code CLI 在初始化握手阶段偶尔会卡住,导致无法将自定义工具暴露给大模型的上下文窗口。

Section 2 Core Vocabulary Click gray bar to reveal Chinese
Orchestrate /ˈɔːrkɪstreɪt/ 编排 / 协同工作

To coordinate multiple systems, services, or agents to work together seamlessly.

"We use LangGraph to orchestrate the multi-agent workflow before passing context to the MCP server."

Handshake /ˈhændʃeɪk/ 握手 (协议协商阶段)

An automated process of negotiation that sets the parameters of a communications channel.

"The MCP client must complete the protocol handshake before any tool invocations can occur."

Capability /ˌkeɪpəˈbɪləti/ 能力 / 特性 (服务端对外声明的)

A specific feature, function, or access scope that a system or server officially supports.

"The MCP server advertises its resource reading capability during the initial discovery phase."

Stdio /ˈstændiːoʊ/ 标准输入输出流

Standard input and output streams, often used as a direct local transport layer for tools.

"We configured the Claude Code CLI to communicate with our Java MCP server directly via stdio transport."

Advertise /ˈædvərtaɪz/ 广播 / 通告 (服务或功能)

To broadcast or announce available functions or schemas to a client application.

"Make sure the custom agent server properly advertises the 'generate_lesson' tool during startup."

Seamlessly /ˈsiːmləsli/ 无缝地 / 平滑地

Functioning smoothly without any noticeable interruptions, friction, or errors.

"The new integration allows the external MSP tools to plug seamlessly into the Anthropic ecosystem."

Section 3 Native Engineer Expressions
JG

"The server is hanging during the handshake phase."

服务器在握手阶段卡住了。 · Use when describing initialization timeouts

JG

"Are we exposing the tools correctly over stdio?"

我们是否通过 stdio 正确暴露了这些工具? · Use when debugging transport or tool discovery

JG

"It looks like the MCP client isn't picking up the advertised schema."

看起来 MCP 客户端没有获取到已广播的 schema。 · Use when tool parameters fail to load in the LLM

JG

"Let's isolate the transport layer to see if packets are dropping."

让我们隔离传输层,看看是否丢包。 · Use when debugging intermittent connection issues

JG

"We need to ensure the payload fits within the model's context window."

我们需要确保有效载荷适合模型的上下文窗口。 · Use when optimizing inputs for the LLM

Section 4 Technical Reading

The Model Context Protocol (MCP) provides a standardized architecture for connecting AI models to external data sources and tools. A typical MCP integration consists of an MCP Host (like the Claude Desktop or Claude Code CLI), an MCP Client, and one or more MCP Servers.

When initialized, the client and server negotiate their respective capabilities through a protocol handshake over a designated transport layer, such as stdio or SSE (Server-Sent Events). Once successfully connected, the server advertises its available resources, prompts, and tools. The host LLM can then seamlessly orchestrate these tools by generating specific invocations that the client routes to the server. Proper schema definitions are critical during this discovery phase to ensure that the LLM understands exactly what arguments the tool requires before execution.

Comprehension Check

1. What is the primary purpose of the protocol handshake in MCP?

To encrypt all data sent to the LLM.
To negotiate capabilities between the client and server.
To bypass the LLM's context window limit.
To compile the custom tools into native code.

2. Which of the following is commonly used as a transport layer for local MCP servers?

HTML5 Canvas
UDP multicast
stdio
FTP

3. Why are proper schema definitions critical during tool discovery?

They ensure the LLM understands the exact arguments a tool requires.
They reduce the latency of the stdio transport layer.
They allow the host to bypass authentication.
They prevent the server from crashing on startup.
Section 5 Writing Task

Reply to #TKT-8902 in Jira. Explain your investigation into why the Claude Code CLI hangs during initialization and propose your next step.

  • 1.State that the root cause is a stdio transport conflict.
  • 2.Mention that the server fails to advertise its tools properly.
  • 3.Propose switching the transport layer to SSE (Server-Sent Events) for debugging.
  • 4.Keep it under 80 words
0 words
Section 6 AI Review Rubric
Grammar / 20 pts
Correct verb tenses when describing the root cause and proposed action. No fragmented sentences.
Vocabulary / 20 pts
Accurately uses technical terms like "stdio", "transport layer", "advertise", and "SSE".
Clarity / 20 pts
Directly addresses the issue and solution within the first 2-3 sentences. No ambiguity.
Professionalism / 20 pts
Engineering-first tone. Concise and factual without unnecessary fluff.
Native-like Expression / 20 pts
Incorporates phrasing like "hanging during" or "root cause is..." naturally.
Total 100 pts
Section 7 Spaced Repetition Review Tap card to flip

3 Words from Previous Lessons

Discoverability

可发现性

The degree to which a client can find and understand available tools.

Subprocess

子进程

A process launched and managed by another main process.

Protocol

协议

A defined set of rules and formats for data exchange.

2 Expressions from Previous Lessons

"The CLI is hanging during the tool discovery phase."

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

Section 8 Challenge Zone ⚡ Above current level

When building an MCP server that exposes database queries as tools, why is it dangerous to let the LLM generate raw SQL payloads directly? Describe an alternative design to expose this capability safely.

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

```