-
Notifications
You must be signed in to change notification settings - Fork 839
Add abstraction for remote MCP servers #6664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 abstraction for remote MCP (Model Context Protocol) servers, providing types to represent hosted MCP server tools and their associated content types. The changes introduce new classes for configuring and interacting with remote MCP servers through AI services.
- Introduces
HostedMcpServerTool
class for representing remote MCP server configurations - Adds content types for MCP tool calls and results (
HostedMcpServerToolCallContent
,HostedMcpServerToolResultContent
) - Implements approval mode configuration for MCP server tool calls
Reviewed Changes
Copilot reviewed 9 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs | Main abstraction class for configuring hosted MCP servers with URL, approval modes, and headers |
src/Libraries/Microsoft.Extensions.AI.Abstractions/HostedMcpServerToolApprovalMode.cs | Approval mode configuration class with Always/Never predefined modes and custom tool-specific rules |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs | Content type representing MCP tool call requests with call ID, tool name, and arguments |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolResultContent.cs | Content type representing MCP tool call results with output and error information |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Tools/HostedMcpServerToolTests.cs | Unit tests for HostedMcpServerTool functionality |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/HostedMcpServerToolApprovalModeTests.cs | Unit tests for approval mode configuration |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/HostedMcpServerToolCallContentTests.cs | Unit tests for tool call content type |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/HostedMcpServerToolResultContentTests.cs | Unit tests for tool result content type |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs | Integration tests demonstrating MCP server usage with OpenAI client |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/HostedMcpServerToolApprovalMode.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/HostedMcpServerToolApprovalMode.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/HostedMcpServerToolApprovalMode.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolResultContent.cs
Outdated
Show resolved
Hide resolved
...aries/Microsoft.Extensions.AI.Abstractions/HostedMcpServerToolRequireSpecificApprovalMode.cs
Show resolved
Hide resolved
...aries/Microsoft.Extensions.AI.Abstractions/HostedMcpServerToolRequireSpecificApprovalMode.cs
Show resolved
Hide resolved
...aries/Microsoft.Extensions.AI.Abstractions/HostedMcpServerToolRequireSpecificApprovalMode.cs
Outdated
Show resolved
Hide resolved
This should be ready for another round. |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolResultContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolResultContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/HostedMcpServerToolCallContent.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Abstractions/Tools/HostedMcpServerTool.cs
Show resolved
Hide resolved
6ea1e5c
to
ca83310
Compare
ca83310
to
3a72393
Compare
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs
Show resolved
Hide resolved
Thanks, @stephentoub. |
* Simpfliy Responses streaming handling * Add abstraction for remote MCP servers * Update MCP support to accomodate responses and approvals --------- Co-authored-by: Stephen Toub <[email protected]>
Contributes to #6492; addresses 1. and 2.
Microsoft Reviewers: Open in CodeFlow