Add initial, rough support for Streamable HTTP for remote hosted MCP servers#1020
Merged
Add initial, rough support for Streamable HTTP for remote hosted MCP servers#1020
Conversation
…token acquisition. (#910) Add remote HTTP server mode with OAuth authentication and downstream token acquisition - Add RunAsRemoteHttpService and OutgoingAuthStrategy options to enable MCP server to run as a remote HTTP service - Introduce ITokenProvider abstraction for dependency injection of downstream authentication tokens and credentials - Add support for On-Behalf-Of (OBO) token flow and hosting environment identity modes for outgoing authentication - Implement OAuth Protected Resource Metadata endpoint at /.well-known/oauth-protected-resource with WWW-Authenticate challenge - Add Visual Studio and dotnet run launch profile for debugging remote MCP server with Microsoft.Identity.Web configuration - Modernize HTTP host creation using WebApplicationBuilder with authentication and authorization middleware
…functionality only in non-trimmed builds (#1008) * Exclude Obo roots when building in trim mode given the AOT violations in Obo apis * Use aot safe apis for incoming auth * unblock template cli, fix CreateArmClientAsync_CreatesAndUsesCachedClient * dotnet format * Define ENABLE_REMOTE build property for untrimmed build
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces authentication abstraction and remote HTTP MCP server support with on-behalf-of (OBO) authentication flow. The changes refactor credential management to use a provider pattern and add support for running the MCP server as an authenticated HTTP service.
- Introduces
IAzureTokenCredentialProviderinterface with two implementations:SingleIdentityTokenCredentialProvider(for single-identity scenarios) andHttpOnBehalfOfTokenCredentialProvider(for OBO flow in multi-user scenarios) - Adds remote HTTP service support with Azure AD authentication, including OAuth metadata endpoints and authorization policies
- Refactors
TenantServiceto use the new credential provider pattern and adds extension methods for DI registration
Reviewed Changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| IAzureTokenCredentialProvider.cs | New interface defining token credential provider contract |
| SingleIdentityTokenCredentialProvider.cs | Implementation for single-identity credential scenarios |
| HttpOnBehalfOfTokenCredentialProvider.cs | Implementation for OBO authentication in HTTP contexts |
| AuthenticationServiceCollectionExtensions.cs | DI registration extensions for authentication providers |
| TenantService.cs | Refactored to use credential provider and support new authentication pattern |
| TenantServiceCollectionExtensions.cs | New DI registration extension for tenant service |
| ITenantService.cs | Updated with new method signatures and comprehensive documentation |
| BaseAzureService.cs | Refactored credential management to use TenantService |
| ServiceStartCommand.cs | Added remote HTTP server hosting with authentication/authorization |
| OAuthProtectedResourceMetadata.cs | New model for OAuth 2.0 protected resource metadata endpoint |
| OutgoingAuthStrategy.cs | New enum defining outgoing authentication strategies |
| ServiceStartOptions.cs | Added options for remote HTTP service configuration |
| ServiceOptionDefinitions.cs | Added CLI option definitions for remote HTTP mode |
| Directory.Build.props | Added ENABLE_REMOTE conditional compilation symbol |
| Directory.Packages.props | Added Microsoft.Identity.* package references |
| Multiple test files | Updated to use new authentication provider pattern |
| launchSettings.json | Added debug profile for remote HTTP development |
| CONTRIBUTING.md / TROUBLESHOOTING.md | Added documentation for HTTP mode |
…ure all derived types can make authenticated Azure calls always. Fixes product, live tests, and unit tests. (#1029) Require non-null ITenantService parameter to BaseAzureService to ensure all derived types can make authenticated Azure calls always. Fixes product, live tests, and unit tests.
Member
|
/azp run mcp - pullrequest - live |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…ments (#1005) * Update contributing guide and troubleshooting guide to address PR comments * move launchSettings instructions to wiki * minor update * update doc * address pr comments * change endpoint placeholder
vukelich
added a commit
that referenced
this pull request
Nov 1, 2025
anuchandy
approved these changes
Nov 1, 2025
srnagar
approved these changes
Nov 1, 2025
Member
|
Hi @vukelich @srnagar @anuchandy, thanks for the PR. I'm sooo interested to learn about remote MCP. May I ask two quick questions to confirm my understanding? I'm sorry I may be lack of context. Thank you in advance for your patience!
|
Merged
19 tasks
19 tasks
colbytimm
pushed a commit
to colbytimm/microsoft-mcp
that referenced
this pull request
Dec 8, 2025
…servers (microsoft#1020) * Add remote HTTP server mode with OAuth authentication and downstream token acquisition. (microsoft#910) Add remote HTTP server mode with OAuth authentication and downstream token acquisition - Add RunAsRemoteHttpService and OutgoingAuthStrategy options to enable MCP server to run as a remote HTTP service - Introduce ITokenProvider abstraction for dependency injection of downstream authentication tokens and credentials - Add support for On-Behalf-Of (OBO) token flow and hosting environment identity modes for outgoing authentication - Implement OAuth Protected Resource Metadata endpoint at /.well-known/oauth-protected-resource with WWW-Authenticate challenge - Add Visual Studio and dotnet run launch profile for debugging remote MCP server with Microsoft.Identity.Web configuration - Modernize HTTP host creation using WebApplicationBuilder with authentication and authorization middleware * Update contributing guide for HTTP mode (microsoft#962) * Add support for ENABLE_REMOTE compilation constant to include remote functionality only in non-trimmed builds (microsoft#1008) * Exclude Obo roots when building in trim mode given the AOT violations in Obo apis * Use aot safe apis for incoming auth * unblock template cli, fix CreateArmClientAsync_CreatesAndUsesCachedClient * dotnet format * Define ENABLE_REMOTE build property for untrimmed build * Require non-null ITenantService parameter to BaseAzureService to ensure all derived types can make authenticated Azure calls always. Fixes product, live tests, and unit tests. (microsoft#1029) Require non-null ITenantService parameter to BaseAzureService to ensure all derived types can make authenticated Azure calls always. Fixes product, live tests, and unit tests. * Update contributing guide and troubleshooting guide to address PR comments (microsoft#1005) * Update contributing guide and troubleshooting guide to address PR comments * move launchSettings instructions to wiki * minor update * update doc * address pr comments * change endpoint placeholder --------- Co-authored-by: Srikanta <51379715+srnagar@users.noreply.github.com> Co-authored-by: Anu Thomas <anuamd@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This work is a collaboration with @anuchandy and @srnagar.
Remote MCP server
server start --run-as-remote-http-serviceto start the server as a remote HTTP service expecting incoming Entra authenticated calls. IncomingAuthorizationheaders are expected to have the correctly configured audience as determined by owner of the remote MCP server's deployment infrastructure, however,Bearertokens are required to have theMcp.Tools.ReadWritescpclaim for user principals orMcp.Tools.ReadWrite.Allrolesclaim for service principals. These claim values are hardcoded and will be configurable if additional scopes or app roles are needed in the future.server start --run-as-remote-http-servicewithserver start --transport http.Microsoft.Identity.Weblibraries. See/servers/Azure.Mcp.Server/src/TROUBLESHOOTING.mdfor details.ENABLE_REMOTEMSBuild constant is used to#ifsections of code dependent on the non-trimmableMicrosoft.Identity.Weblibrary. Work is planned for how to build a CLI vs a remote server with build pipelines. This constant is enabled within/Directory.Build.propswhenPublishTrimmedis nottrue.Outgoing authentication
IAzureTokenCredentialProviderabstracts how to get outgoing Entra OAuth access tokens, and a singleton implementation is injected into dependency injection containers. Two strategies exist as represented byOutgoingAuthStrategy:CustomChainedCredentialthat uses the identity of the signed in user or a managed identity. TheSingleIdentityTokenCredentialProviderimplementsIAzureTokenCredentialProviderusing this strategy.server startoption--outgoing-auth-strategy UseHostingEnvironmentIdentity.HttpOnBehalfOfTokenCredentialProviderimplementsIAzureTokenCredentialProviderusing this strategy.server startoption--outgoing-auth-strategy UseOnBehalfOf.Refactoring
BaseAzureService:nullITenantServicein its constructor. This type is used as a step to get toIAzureTokenCredentialProvider.TenantService(which implementsITenantService) inherits fromBaseAzureService. An uglyinternalmitigation is in place forTenantServiceto set its ownITenantServicedependency after construction.ILoggerFactory. This was not needed sinceBaseAzureServiceis not creating instances ofCustomChainedCredentialdirectly anymore.Testing
Azure.Mcp.Server.Documentation
GitHub issue number?
[Link to the GitHub issue this PR addresses]Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.mdand/orservers/Fabric.Mcp.Server/CHANGELOG.mdfor product changes (features, bug fixes, UI/UX, updated dependencies)servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationeng/scripts/Process-PackageReadMe.ps1. See Package README/servers/Azure.Mcp.Server/docs/azmcp-commands.mdand/or/docs/fabric-commands.md.\eng\scripts\Update-AzCommandsMetadata.ps1to update tool metadata in azmcp-commands.md (required for CI)ToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test prompts/servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline