fix(mcp): route console logs to stderr, replace git subprocess in check_fex_freshness#12
Merged
Merged
Conversation
…check_fex_freshness The MCP stdio server was routing all Console logger output to stdout, corrupting the newline-delimited JSON-RPC stream. Hosts would stall waiting for a valid JSON frame while log lines were interleaved. Added AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace) so all log output goes to stderr, leaving stdout exclusively for JSON-RPC. Also replaced the git rev-parse --short HEAD subprocess in CheckFreshness with a direct filesystem read of .git/HEAD and packed-refs. The subprocess was hanging under MCP stdio hosts due to inherited pipe handles, causing check_fex_freshness call latency >10s. The new implementation resolves HEAD from .git files in <1ms.
…r7-jv3q) Packages 2.1.2 and 2.1.11 have a known high-severity vulnerability. Pin globally in Directory.Build.props so TreatWarningsAsErrors does not promote NU1903 to a build error in FEx.EFCore, FEx.AzureDevOpsx, and FEx.Imaging.Windows.
…-2m69-gcr7-jv3q)" This reverts commit 63693c6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bug 1 (protocol corruption):
Host.CreateApplicationBuilderdefault Console logger was writing to stdout, interleavinginfo:log lines with JSON-RPC frames. MCP hosts stalled waiting for valid JSON.Fix:
builder.Logging.AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace)— all logs to stderr.Bug 2 (subprocess hang):
check_fex_freshnessspawnedgit rev-parse --short HEAD. Under an MCP stdio host the process inherits pipe handles, causing the subprocess to hang >10s.Fix: direct filesystem read of
.git/HEAD+packed-refs. Resolves HEAD in <1ms.Measured before/after
Test plan
fex-apiMCP server after mergecheck_fex_freshness— returns instantlypwsh .\Generate-ApiSurface.ps1