From 5b74ee21e4d8a0e759860706ccbedc8a22c2adcb Mon Sep 17 00:00:00 2001
From: Copilot <198982749+Copilot@users.noreply.github.com>
Date: Mon, 15 Dec 2025 07:16:18 -0600
Subject: [PATCH] Document HttpRequestException thrown by McpClient.CreateAsync
(#1095)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
---
.../Client/McpClient.Methods.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs b/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs
index 7a87bac..d7da898 100644
--- a/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs
+++ b/src/ModelContextProtocol.Core/Client/McpClient.Methods.cs
@@ -21,6 +21,19 @@ public abstract partial class McpClient : McpSession
/// The to monitor for cancellation requests. The default is .
/// An that's connected to the specified server.
/// is .
+ /// An error occurred while connecting to the server over HTTP.
+ ///
+ ///
+ /// When using an HTTP-based transport (such as ), this method may throw
+ /// if there is a problem establishing the connection to the MCP server.
+ ///
+ ///
+ /// If the server requires authentication and credentials are not provided or are invalid, an
+ /// with an HTTP 401 Unauthorized status code will be thrown.
+ /// To authenticate with a protected server, configure the
+ /// property of the transport with appropriate credentials before calling this method.
+ ///
+ ///
public static async Task CreateAsync(
IClientTransport clientTransport,
McpClientOptions? clientOptions = null,