Claude Code CLI / MCP Orchestrator
MCP server initialization failing during custom tool discovery
We are integrating a custom MCP server with the Claude Code CLI to expose our internal MSP automation tools. However, the agent orchestrator is failing during the tool discovery phase. We need to debug the JSON-RPC payload and ensure the server correctly defines its capabilities.
我们正在将自定义的 MCP 服务器与 Claude Code CLI 集成,以暴露内部的 MSP 自动化工具。然而,Agent 编排器在工具发现阶段失败了。我们需要调试 JSON-RPC 负载,确保服务器正确定义了它的 capabilities。
A feature supported by the MCP server, declared during the handshake phase.
"The server must declare its tool execution capability before the client can trigger any actions."
A structured declaration of the tools, prompts, and resources exposed by the server.
"We need to update the MCP manifest file to include the new deployment endpoints."
The phase where the client queries the server to list all available tools.
"The agent fails during tool discovery because the server is returning an empty JSON array."
A one-way HTTP transport mechanism used by MCP for real-time updates.
"We are switching the transport layer from stdio to SSE to support remote client connections."
The JSON specification that dictates exactly what parameters a tool accepts.
"The model hallucinated parameters because our tool schema was missing the required fields array."
To mimic the behavior of a client or server to isolate testing.
"Use the MCP inspector CLI to emulate the Claude Code client and test your local tools."
"The server is dropping the connection before the tool list is fully fetched."
服务器在完全获取工具列表前断开了连接。 · Use when debugging transport timeouts
"Let's mock the MCP client to isolate the tool execution logic."
我们 mock 一下 MCP 客户端来隔离工具执行逻辑。 · Use when suggesting a testing strategy
"Are we validating the tool input schema on the server side?"
我们在服务端验证工具输入的 schema 了吗? · Use during code review or architecture discussion
"The agent is hallucinating parameters not defined in the tool manifest."
Agent 虚构了未在工具清单中定义的参数。 · Use when reporting LLM behavior issues
"We need to migrate the transport layer from stdio to SSE for the distributed architecture."
我们需要将传输层从 stdio 迁移到 SSE 以支持分布式架构。 · Use when proposing architectural changes
The Model Context Protocol (MCP) standardizes how AI agents interact with external data sources and execution environments. During the initial handshake, the MCP client and server exchange capabilities. Once connected, the client performs discovery to fetch a manifest of available tools, prompts, and resources.
If a client utilizes stdio transport, it spins up the server locally as a subprocess. For distributed setups, the SSE (Server-Sent Events) transport is preferred, allowing remote clients to maintain an ephemeral HTTP connection. When the LLM decides to trigger a tool, the client sends a JSON-RPC request containing the tool name and arguments matching the predefined schema. Strict server-side validation is critical during this phase to prevent malicious prompt injections or malformed inputs generated by the agent orchestrator.
Comprehension Check
1. What is the primary difference between stdio and SSE transport in this context?
2. When does the client learn which tools are available?
3. Why is server-side validation emphasized in the passage?
Write a short Slack update to your team regarding the MCP integration issue with Claude Code.
- 1.State that the local MCP server starts, but fails during tool discovery.
- 2.Mention that you suspect an issue with the JSON tool schema.
- 3.Propose using the MCP Inspector CLI to isolate the problem.
- 4.Keep it under 80 words.
3 Words from Previous Lessons
编排器
The system managing multi-agent workflows.
协商
The exchange of capabilities during handshake.
子进程
A secondary process launched by the main client.
2 Expressions from Previous Lessons
"The client is hanging during the init phase."
"It looks like a race condition between the client connecting and the server binding."
When designing a multi-agent system, what are the security trade-offs between running an MCP server via stdio (as a local subprocess) versus exposing it over a network via SSE? How would you mitigate the risks of the SSE approach?
Answer in English. Use technical vocabulary from this lesson. No word limit.