From 1be0904506294251cc7238adfaf37f0beac1bb14 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 22 Sep 2026 13:02:28 -0400 Subject: [PATCH] fix(mcp): make opennest server launchable on any machine .mcp.json pointed at C:/Users/AJ/.claude/mcp/OpenNest.Mcp/run.cmd, a profile path and wrapper script that only existed on one machine, so the server failed with CONNECTION_CLOSED everywhere else. Launch the published exe via ${USERPROFILE} instead. Also route console logging to stderr: the host's default console logger wrote to stdout, interleaving log lines with the JSON-RPC stream. Co-Authored-By: Claude Opus 5.5 --- .mcp.json | 4 ++-- OpenNest.Mcp/Program.cs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.mcp.json b/.mcp.json index 633400b..48a1660 100644 --- a/.mcp.json +++ b/.mcp.json @@ -1,8 +1,8 @@ { "mcpServers": { "opennest": { - "command": "cmd", - "args": ["/c", "C:/Users/AJ/.claude/mcp/OpenNest.Mcp/run.cmd"] + "command": "${USERPROFILE}/.claude/mcp/OpenNest.Mcp/OpenNest.Mcp.exe", + "args": [] } } } diff --git a/OpenNest.Mcp/Program.cs b/OpenNest.Mcp/Program.cs index 35e27d4..692cd43 100644 --- a/OpenNest.Mcp/Program.cs +++ b/OpenNest.Mcp/Program.cs @@ -1,9 +1,13 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; using OpenNest.Mcp; var builder = Host.CreateApplicationBuilder(args); +// stdout carries the JSON-RPC stream; console logs must go to stderr or they corrupt it. +builder.Logging.AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace); + builder.Services.AddSingleton(); builder .Services.AddMcpServer()