Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,9 @@ private static string ValidateUrl(Uri serverUrl)
/// </para>
/// </remarks>
public HostedMcpServerToolApprovalMode? ApprovalMode { get; set; }

/// <summary>
/// Gets or sets additional headers to include in requests to the remote MCP server.
/// </summary>
public IDictionary<string, string>? Headers { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,12 @@ void IDisposable.Dispose()
mcpTool.ServerName,
url,
mcpTool.AuthorizationToken,
mcpTool.ServerDescription) :
mcpTool.ServerDescription, mcpTool.Headers) :
ResponseTool.CreateMcpTool(
mcpTool.ServerName,
new McpToolConnectorId(mcpTool.ServerAddress),
mcpTool.AuthorizationToken,
mcpTool.ServerDescription);
mcpTool.ServerDescription, mcpTool.Headers);

if (mcpTool.AllowedTools is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ public void Constructor_Roundtrips()
var customApprovalMode = new HostedMcpServerToolRequireSpecificApprovalMode(["tool1"], ["tool2"]);
tool.ApprovalMode = customApprovalMode;
Assert.Same(customApprovalMode, tool.ApprovalMode);

Assert.Null(tool.Headers);
IDictionary<string, string> headers = new Dictionary<string, string>
{
["X-Custom-Header"] = "value1",
};
tool.Headers = headers;
Assert.Same(headers, tool.Headers);

tool.Headers = null;
Assert.Null(tool.Headers);
}

[Fact]
Expand Down
Loading