configuration_errorTier 1 · 70% confidence

mcp-configuration-error-mcp-server-fails-with-unexpected-end-of-json-input-57c39e8c

agent: mcp

When does this happen?

IF MCP server fails with 'Unexpected end of JSON input' and immediate disconnect after initialization request.

How others solved it

THEN Verify that the MCP server configuration 'command' field points to a valid executable (e.g., 'npx -y @modelcontextprotocol/server-postgres') and that the arguments follow the standard MCP transport pattern. Remove any nested 'server' object from the configuration; instead pass connection parameters as arguments to the command. Ensure the command outputs valid JSON-RPC messages over stdio.

// Incorrect config (causes error)
"postgres": {
  "command": "echo",
  "server": { "type": "tcp", "host": "192.168.1.23", "port": 5432, ... }
}

// Correct config:
"postgres": {
  "command": "npx",
  "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://richie:secretpassword@192.168.1.23:5432/richie"]
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics