-
Notifications
You must be signed in to change notification settings - Fork 4k
.Net: Sample using OAuth to access a protected MCP server #12680
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
.Net: Sample using OAuth to access a protected MCP server #12680
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 a new .NET sample demonstrating how to authenticate via OAuth 2.0 to access a protected Model Context Protocol (MCP) server and invoke its tools through Semantic Kernel.
- Introduces a browser-based authorization code flow and SSE transport for MCP.
- Includes detailed README for prerequisites, configuration, and running steps.
- Registers the new sample in the solution and configures its project dependencies.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
dotnet/samples/Demos/ModelContextProtocolPluginAuth/README.md | Added comprehensive setup, OAuth flow explanation, and usage guide. |
dotnet/samples/Demos/ModelContextProtocolPluginAuth/Program.cs | Implemented OAuth 2.0 authorization code flow and MCP tool invocation. |
dotnet/samples/Demos/ModelContextProtocolPluginAuth/ModelContextProtocolPluginAuth.csproj | Configured project target framework and package references. |
dotnet/SK-dotnet.slnx | Added the new sample project to the solution. |
Comments suppressed due to low confidence (3)
dotnet/samples/Demos/ModelContextProtocolPluginAuth/README.md:39
- This line appears to be stray or incomplete; remove it or replace with the intended content.
"..."
dotnet/samples/Demos/ModelContextProtocolPluginAuth/README.md:20
- The project targets .NET 8.0 in the csproj but README lists .NET 9.0; update one of them to ensure consistency.
- .NET 9.0 or later
dotnet/samples/Demos/ModelContextProtocolPluginAuth/Program.cs:47
- [nitpick] Casing inconsistency: consider using 'ProtectedMCPClient' to match the 'MCP' acronym and other sample naming conventions.
ClientName = "ProtectedMcpClient",
837e5ba
to
7fdca5a
Compare
Motivation and Context
Description
Contribution Checklist