modelcontextprotocol/java-sdk

Support non-JSON stdout for legacy MCP servers in Java SDK

Opened this issue · 1 comments

Currently, the Java MCP SDK requires servers to output valid JSON-RPC messages for initialization and connection. However, some legacy MCP servers (e.g., java-class-analyzer-mcp) output plain text like "running on stdio" instead of JSON during startup.

The Java SDK fails to connect to these servers, throwing TimeoutException or EPIPE errors, whereas the JavaScript SDK can successfully connect to the same servers.

The Java SDK should be able to connect to servers that output plain text messages during startup, similar to how the JS SDK handles it. For example, "running on stdio" should be accepted as a valid initialization signal.