Home/Wiki Errors/Claude Code
Claude Code / MCP

MCP servers failed to connect - Claude Code

Claude Code started, but one or more MCP server processes or remote transports failed during discovery, authentication, schema validation, or streaming.

Claude Code MCP failed to connectInvalid MCP configuration Claude CodeSSE stream disconnected MCP
Paste an error to match it against the wiki. / 粘贴报错后自动匹配。

Error text / 报错原文

  • MCP servers failed to connect
  • Invalid MCP configuration
  • SSE stream disconnected
  • TypeError: terminated

What it means

Claude Code started, but one or more MCP server processes or remote transports failed during discovery, authentication, schema validation, or streaming.

Most common causes

  • The MCP command works in an interactive shell but not in Claude Code environment
  • Invalid JSON or wrong schema in .mcp.json
  • Remote MCP OAuth token expired
  • SSE server timeout or reverse proxy buffering

Fastest fix

  • Run claude mcp list and identify the failing server
  • Temporarily disable the failing server and retry the task
  • Test the MCP command directly from the same terminal
  • Validate .mcp.json as strict JSON

Safe fix

  • Use absolute command paths for local MCP servers
  • Keep secrets in environment variables, not checked-in JSON
  • Set explicit timeouts for remote servers
  • Reduce tool count for large coding sessions

What not to do

  • Do not hardcode personal access tokens in shared configs
  • Do not enable every MCP server globally
  • Do not ignore stderr from local MCP processes

How to confirm the fix

Run the smallest reproducible command first, then retry the agent task only after authentication, quota, and tool discovery are stable.

claude mcp list
node --version
npx --version

Related errors

Related tools

Sources