MCP Server Stdio transport: configure all logs to go to stderr - #3959
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Updates the MCP Server’s stdio transport behavior to avoid tool deserialization issues by ensuring logs are written to stderr instead of stdout.
Changes:
- Configures console logging to route all log levels to stderr via
LogToStandardErrorThreshold. - Minor reordering of
usingdirectives.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3959 +/- ##
==========================================
- Coverage 76.21% 76.20% -0.01%
==========================================
Files 1202 1202
Lines 171601 171601
Branches 29666 29666
==========================================
- Hits 130778 130769 -9
- Misses 29778 29794 +16
+ Partials 11045 11038 -7 🚀 New features to boost your workflow:
|
marcschier
left a comment
There was a problem hiding this comment.
Please fix the review comments, the ConfigureLogging is probably the better place to conditionally change the logging to stderr (when stdio is configured)
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Brings in 5 upstream commits: OPCFoundation#3957 (expand DI/Fluent API injectability + one-shot ergonomics across client/server/PubSub/discovery/bindings), OPCFoundation#3968 (fix false-positive MODELGEN010), OPCFoundation#3966 (fix source generator dropping BaseAnalogType EURange/EngineeringUnits), OPCFoundation#3949 (Apache Kafka PubSub transport, Part 14 Annex B.2), and OPCFoundation#3959 (MCP server stdio logs to stderr). Resolved one conflict in Directory.Packages.props (three regions), all from our UaLens-specific package entries interleaving with upstream's new Kafka dependency and a Microsoft.Extensions.* version bump: * Kept CommunityToolkit.Mvvm 8.4.2 and added upstream's new Confluent.Kafka 2.15.0. * Accepted upstream's Microsoft.Extensions.* bump (10.0.8 -> 10.0.9, 10.6.0 -> 10.7.0) while re-inserting our Microsoft.Extensions.Diagnostics.ResourceMonitoring 10.5.0 (a UaLens dependency absent from master) in alphabetical position. * Kept ScottPlot.Avalonia 5.1.58 and took upstream's SharpFuzz 2.2.0 -> 2.3.0 bump. UA.slnx auto-merged and retained our McpServer project path. UaLens build clean (0 warnings / 0 errors). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
In the Stdio transport mode of the MCP server, logging is redirected to stderr in order to avoid deserialization exceptions when calling tools
Related Issues
Checklist
Put an
xin the boxes that apply. You can complete these step by step after opening the PR.