Skip to content

Codex issue: MCP client for X failed to start: handshaking with MCP server failed: connection closed: initialize response #7

@kentkost

Description

@kentkost

Related Issue

I get the following errors:

⚠ MCP client for avalonia failed to start: MCP startup failed: handshaking with MCP server failed: connection closed: initialize response 
⚠ MCP startup incomplete (failed: avalonia)

After a lot of Trial and error me and AI figured out the reason for it was that the logger in AvaloniaUI.MCP vomits logs to STDOUT.
So Codex receives garbage before the JSON handshake.

A fix is to edit:

builder.Logging.AddConsole();

to

builder.Logging.AddConsole(o =>
{
    o.LogToStandardErrorThreshold = LogLevel.Trace;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions