From cdcf134e7a5b0de5bfc821b8ef886be08069f2e7 Mon Sep 17 00:00:00 2001 From: Clay Upton Date: Thu, 13 Mar 2025 00:26:53 -0500 Subject: [PATCH] Update StdioClientTransport.cs (#68) --- src/mcpdotnet/Protocol/Transport/StdioClientTransport.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mcpdotnet/Protocol/Transport/StdioClientTransport.cs b/src/mcpdotnet/Protocol/Transport/StdioClientTransport.cs index 0aa4293..c084960 100644 --- a/src/mcpdotnet/Protocol/Transport/StdioClientTransport.cs +++ b/src/mcpdotnet/Protocol/Transport/StdioClientTransport.cs @@ -209,7 +209,8 @@ public sealed class StdioClientTransport : TransportBase, IClientTransport private async Task ProcessMessageAsync(string line, CancellationToken cancellationToken) { try - { + { + line=line.Trim();//Fixes an error when the service prefixes nonprintable characters var message = JsonSerializer.Deserialize(line, _jsonOptions); if (message != null) { @@ -296,4 +297,4 @@ public sealed class StdioClientTransport : TransportBase, IClientTransport _logger.TransportCleanedUp(EndpointName); } -} \ No newline at end of file +}