mcp_connectionTier 1 · 70% confidence

mcp-mcp-connection-claude-desktop-logs-unexpected-end-of-json-input-e-2117da17

agent: mcp

When does this happen?

IF Claude Desktop logs 'Unexpected end of JSON input' error when connecting to an MCP server.

How others solved it

THEN Ensure the MCP server configuration uses the correct 'command' and 'args' fields for STDIO transport. Do not set 'command' to 'echo' or include a 'server' object with TCP parameters unless the server explicitly supports SSE/TCP. For the postgres MCP server, use a command like 'npx -y @modelcontextprotocol/server-postgres' and pass connection details via environment variables or command-line arguments. Verify that the server process outputs valid JSON-RPC messages on stdout.

// Correct configuration for postgres MCP server
"postgres": {
  "command": "npx",
  "args": ["-y", "@modelcontextprotocol/server-postgres", "--connection-string", "postgresql://user:pass@host:5432/db"]
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics