Skip to content

Add support for ENABLE_REMOTE compilation constant to include remote functionality only in non-trimmed builds#1008

Merged
joshfree merged 5 commits intomicrosoft:feature/2.0beta-remotefrom
anuchandy:build-remote
Oct 30, 2025
Merged

Add support for ENABLE_REMOTE compilation constant to include remote functionality only in non-trimmed builds#1008
joshfree merged 5 commits intomicrosoft:feature/2.0beta-remotefrom
anuchandy:build-remote

Conversation

@anuchandy
Copy link
Copy Markdown
Member

What does this PR do?

This PR introduces conditional compilation support to exclude remote HTTP service functionality from trimmed builds of the Azure MCP Server.

When built with the PublishTrimmed=true option (via -Trimmed), the server will not include remote functionality

./eng/scripts/Build-Code.ps1 -SelfContained -SingleFile -Trimmed  -Server "Azure.Mcp.Server"
image

When built with the PublishTrimmed=false option (without -Trimmed), the server will include remote functionality

./eng/scripts/Build-Code.ps1 -SelfContained -SingleFile  -Server "Azure.Mcp.Server"
image

GitHub issue number?

[Link to the GitHub issue this PR addresses]

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

@anuchandy anuchandy self-assigned this Oct 30, 2025
@anuchandy anuchandy requested review from a team as code owners October 30, 2025 01:48
@anuchandy anuchandy requested review from g2vinay, jongio, joshfree and wbreza and removed request for a team October 30, 2025 01:48
Copy link
Copy Markdown
Member

@joshfree joshfree left a comment

Choose a reason for hiding this comment

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

Please add a CHANGELOG entry under Other Changes

@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure MCP Server Oct 30, 2025
@joshfree joshfree added this to the 2025-11 milestone Oct 30, 2025
@joshfree joshfree merged commit b8a62b5 into microsoft:feature/2.0beta-remote Oct 30, 2025
24 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Oct 30, 2025
vukelich added a commit that referenced this pull request Nov 3, 2025
…servers (#1020)

* Add remote HTTP server mode with OAuth authentication and downstream 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

* Update contributing guide for HTTP mode (#962)

* Add support for ENABLE_REMOTE compilation constant to include remote 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

* 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. (#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 (#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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants