Module 3 · AI Engineering English
🔥 15 day streak

Lesson 16: MCP Integration & Transport Debugging

2026-06-19 · ~20 min · B1 → C1 · Section 1 / 8
Section 1 Today's Scenario
#TKT-8902 P1 · Critical Investigating

CLAUDE CODE CLI / HALO PSA

MCP Server Handshake Timeout on Halo PSA Integration

We are integrating our Halo PSA system via an MCP server to allow the Claude Code CLI to query tickets. However, the connection intermittently hangs during the capability negotiation phase, resulting in a transport timeout. I need to debug the JSON-RPC payload over stdio to identify exactly where the handshake is dropping.

我们正在尝试通过 MCP 服务器集成 Halo PSA 系统,以便 Claude Code CLI 可以查询工单。然而,连接在协商 capability 阶段间歇性挂起,导致传输超时。我需要调试 stdio 上的 JSON-RPC payload,找出握手失败的具体环节。

Section 2 Core Vocabulary Click gray bar to reveal Chinese
Negotiation /nɪˌɡoʊʃiˈeɪʃən/ 协商 / 握手确认

The process where the client and server exchange supported protocol versions and features.

"The capability negotiation failed because the client doesn't support the latest protocol version."

Payload /ˈpeɪloʊd/ 有效载荷 / 实际数据包

The essential core data transmitted in a message, excluding transport headers.

"Check the JSON-RPC payload to ensure the arguments array isn't malformed."

Intermittent /ˌɪntərˈmɪtənt/ 间歇性的 / 偶发的

Occurring at irregular intervals; an issue that does not happen every time.

"We are seeing intermittent connection drops when the MCP server spins up."

Subprocess /ˈsʌbˌprɑsɛs/ 子进程

A process spawned and managed by a larger parent application.

"The orchestrator spawns the MCP server as a subprocess and communicates via standard I/O."

Workaround /ˈwɜrkəˌraʊnd/ 替代方案 / 变通方法

A temporary fix or alternative path used to bypass a known bug.

"As a temporary workaround, we can hardcode the capabilities until the handshake bug is patched."

Isolate /ˈaɪsəˌleɪt/ 隔离 / 定位(问题)

To separate a specific component from others to pinpoint the exact source of a problem.

"Let's isolate the transport layer to verify if the issue is in stdio or SSE."

Section 3 Native Engineer Expressions
JG

"The server is choking on the initialization request."

服务器在处理初始化请求时卡住了 · Use when a process hangs or crashes under load or specific input

JG

"Let's tail the logs to see where the handshake drops."

让我们追踪日志看看握手在哪一步断开 · Use in Slack/calls when suggesting real-time log debugging

JG

"It looks like a race condition between the client connecting and the server binding."

这看起来像是客户端连接和服务器绑定之间的竞争条件 · Use when diagnosing concurrent startup timing issues

JG

"Can we dump the JSON-RPC traffic to stderr?"

我们能把 JSON-RPC 流量转储到 stderr 吗? · Use when requesting lower-level protocol debugging output

JG

"The orchestrator needs to gracefully terminate the subprocess."

编排器需要优雅地终止子进程 · Use when discussing process lifecycle management

Section 4 Technical Reading

Model Context Protocol (MCP) establishes a standardized architecture for connecting AI models to external data sources and tools. In a typical stdio transport pattern, the MCP client spawns the server as a local subprocess. The lifecycle begins with a handshake, during which the client and server exchange initialization requests to negotiate capabilities, such as tool execution and resource discoverability.

If the server fails to respond within the expected window, the connection will drop, often manifesting as an intermittent transport timeout. To troubleshoot these issues, developers should isolate the JSON-RPC payload by redirecting debug output to stderr. Doing so ensures that arbitrary logging does not pollute the stdout stream, which is strictly reserved for core protocol communication.

Comprehension Check

1. What happens during the MCP handshake phase?

The client and server negotiate supported capabilities.
The server executes the initial AI prompt payload.
The client terminates the background subprocess.
The stdout stream is automatically redirected to stderr.

2. Why might the transport connection drop during initialization?

The JSON-RPC payload is heavily encrypted.
The client requests too many external tools.
The server fails to respond within the expected time window.
The target database schema lacks proper discoverability.

3. According to the passage, how should developers debug transport issues in stdio mode?

By skipping the capability initialization request.
By redirecting debug output to stderr to avoid polluting stdout.
By spawning a secondary subprocess to monitor the network.
By converting the JSON-RPC payload to XML before logging.
Section 5 Writing Task

Write a brief update for the Jira ticket (#TKT-8902) explaining your current debugging progress on the MCP server timeout issue.

  • 1.State that you have isolated the transport layer.
  • 2.Mention that you dumped the JSON-RPC traffic to stderr to inspect the payload.
  • 3.Provide a temporary workaround (e.g., hardcoding capabilities).
  • 4.Keep it under 80 words.
0 words
Section 6 AI Review Rubric
Grammar / 20 pts
Correct tense usage for past debugging actions (e.g., "I dumped", "isolated") and present states.
Vocabulary / 20 pts
Accurate use of terms like "isolate", "payload", "stderr", and "workaround".
Clarity / 20 pts
The debugging steps and the temporary workaround are logically sequenced.
Professionalism / 20 pts
Tone is concise, objective, and appropriate for a Jira ticket update.
Native-like Expression / 20 pts
Uses natural phrasing (e.g., "dump the traffic", "isolate the layer") from the lesson.
Total 100 pts
Section 7 Spaced Repetition Review Tap card to flip

3 Words from Previous Lessons

Ephemeral

短暂的 / 易失的

Short-lived and temporary.

Introspection

自省 / 内省

Examining system capabilities.

Proxy

代理

An intermediary that forwards requests.

2 Expressions from Previous Lessons

"It's polluting the stdout stream."

"The server failed to negotiate capabilities."

Section 8 Challenge Zone ⚡ Above current level

In an MCP architecture using the stdio transport, why is it critical to strictly separate protocol messages (JSON-RPC) from general application logs? What architectural pattern or stream redirection strategy would you implement to ensure this separation, and what happens if you fail to do so?

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