eca icon indicating copy to clipboard operation
eca copied to clipboard

MCP servers fail to start when non-JSON output is written to stdout (e.g. console.log)

Open Kaspazza opened this issue 9 months ago • 2 comments

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

When using the TailwindCSS MCP server with ECA, the server fails to start if it writes non-JSON output to stdout. Any log line printed to stdout (e.g. via console.log) is interpreted as an MCP message and causes a JSON parse error, crashing the connection.

This happens even though the server otherwise starts correctly. Redirecting logs from stdout to stderr resolves the issue.

Other MCP clients (Claude Code, Windsurf, Cursor, etc.) appear to handle this more defensively and do not crash in this scenario.

To Reproduce Add to eca config.json TailwindCSS MCP server: https://github.com/CarbonoDev/tailwindcss-mcp-server

when starting eca mcp fails with error:

[MCP] [tailwindcss-server] TailwindCSS MCP server running on stdio [MCP] Error processing inbound message for line: DocumentationScraperService initialized com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'DocumentationScraperService': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 28] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2596) at com.fasterxml.jackson.core.JsonParser._constructReadException(JsonParser.java:2622) at com.fasterxml.jackson.core.JsonParser._constructReadException(JsonParser.java:2630) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:830) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:3017) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:2051) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:780) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:5058) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4961) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3887) at io.modelcontextprotocol.json.jackson.JacksonMcpJsonMapper.readValue(JacksonMcpJsonMapper.java:57) at io.modelcontextprotocol.spec.McpSchema.deserializeJsonRpcMessage(McpSchema.java:208) at io.modelcontextprotocol.client.transport.StdioClientTransport.lambda$startInboundProcessing$6(StdioClientTransport.java:253) at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:328) at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095) at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619) at [email protected]/java.lang.Thread.runWith(Thread.java:1460) at [email protected]/java.lang.Thread.run(Thread.java:1447) at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832) at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:808)

Expected behavior

ECA should:

Ignore non-JSON lines on stdout defensively.

Additional context:

A fix was applied in the TailwindCSS MCP server by replacing console.log with console.error, which makes it work correctly: fixes to tailwindcss mcp server

The same issue was reported with Amazon Q CLI tool.

This appears to be a common MCP pitfall: stdout is reserved strictly for protocol messages, but many servers still log to it.

While this is technically a server-side bug, other MCP clients seem to tolerate or filter such output (e.g. this tailwindcss mcp server works with claude code, windsurf, cursor ide)

Question is if mcp-java-sdk which is used in eca allows to control that.

Kaspazza avatar Feb 10 '26 12:02 Kaspazza

@Kaspazza can you test if latest eca still happens? I bumped to latest mcp java sdk

ericdallo avatar Feb 10 '26 22:02 ericdallo

I believe this is fixed and we use plumcp now, so it should be easy to fix too if a problem

ericdallo avatar Mar 15 '26 14:03 ericdallo