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 在初始化握手阶段偶尔会卡住,导致无法将自定义工具暴露给大模型的上下文窗口。
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."
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."
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."
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."
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."
Functioning smoothly without any noticeable interruptions, friction, or errors.
"The new integration allows the external MSP tools to plug seamlessly into the Anthropic ecosystem."
"The server is hanging during the handshake phase."
服务器在握手阶段卡住了。 · Use when describing initialization timeouts
"Are we exposing the tools correctly over stdio?"
我们是否通过 stdio 正确暴露了这些工具? · Use when debugging transport or tool discovery
"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
"Let's isolate the transport layer to see if packets are dropping."
让我们隔离传输层,看看是否丢包。 · Use when debugging intermittent connection issues
"We need to ensure the payload fits within the model's context window."
我们需要确保有效载荷适合模型的上下文窗口。 · Use when optimizing inputs for the LLM
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?
2. Which of the following is commonly used as a transport layer for local MCP servers?
3. Why are proper schema definitions critical during tool discovery?
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
3 Words from Previous Lessons
可发现性
The degree to which a client can find and understand available tools.
子进程
A process launched and managed by another main process.
协议
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."
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.