Skip to content

Conversation

jozkee
Copy link
Member

@jozkee jozkee commented Oct 2, 2025

Contributes to #6492.

  • Add support for connector ID.
  • Add AuthorizationToken to HostedMcpServerTool since its now promoted in both OpenAI and Anthropic.
  • Remove HostedMcpServerTool.Headers
  • Relax McpServerToolCallContent.ServerName
  • Messages with user role can also create approval responses.

@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Oct 2, 2025
jozkee added 3 commits October 8, 2025 11:50
* Add AuthorizationToken property since it is now promoted in both OpenAI and Anthropic
* Relax McpServerToolCallContent ToolName and ServerName
@jozkee jozkee changed the title Add support for Connector ID Add support for Connector ID and other follow ups Oct 8, 2025
@jozkee jozkee marked this pull request as ready for review October 8, 2025 23:20
@jozkee jozkee requested a review from a team as a code owner October 8, 2025 23:20
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 23:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for connector ID in MCP (Model Context Protocol) tools and implements several related improvements. The changes enable the use of connector identifiers instead of just URLs for MCP servers, add OAuth authorization support, and relax validation requirements for tool properties.

  • Add connector ID support to HostedMcpServerTool allowing string addresses that can be either URLs or connector IDs
  • Add AuthorizationToken property to HostedMcpServerTool for OAuth authentication with MCP servers
  • Relax validation in McpServerToolCallContent by making ToolName and ServerName optional properties
  • Enable user role messages to create approval responses for MCP tool calls

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs Updated constructor to accept string addresses, added AuthorizationToken property, simplified API
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/McpServerToolCallContent.cs Made ToolName and ServerName optional settable properties, simplified constructor validation
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs Updated to handle connector IDs vs URLs, support authorization tokens, and allow user role approval responses
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Tools/HostedMcpServerToolTests.cs Updated tests to reflect new constructor signature and added AuthorizationToken property tests
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/McpServerToolCallContentTests.cs Updated tests for simplified constructor and optional properties
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs Added comprehensive test for MCP tool approval workflow with both user and tool roles
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs Added integration test for connector-based MCP servers with authorization

…ol ServerAddress property summary to match the ctor argument.
@jozkee jozkee merged commit de0f507 into dotnet:main Oct 13, 2025
6 checks passed
@jozkee jozkee deleted the connector_id branch October 13, 2025 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants