Fix McpWeatherApp deployment: infra, prepackage hook, and file resolution#25
Open
ahmedmuhsin wants to merge 3 commits intoAzure-Samples:mainfrom
Open
Fix McpWeatherApp deployment: infra, prepackage hook, and file resolution#25ahmedmuhsin wants to merge 3 commits intoAzure-Samples:mainfrom
ahmedmuhsin wants to merge 3 commits intoAzure-Samples:mainfrom
Conversation
… jar-relative file resolution - Add separate Flex Consumption plan and function app for weather service in main.bicep - Add FUNCTIONS_EXTENSIONBUNDLE_SOURCE_URI staging CDN setting for MCP extension - Add prepackage hook in azure.yaml to run npm build before Maven packaging - Fix WeatherFunction.java to resolve app/dist/index.html relative to jar location (required on Azure where CWD differs from function root) - Update mcp.json to support system key for remote MCP endpoint
There was a problem hiding this comment.
Pull request overview
Fixes the McpWeatherApp sample’s local + azd up Azure deployment by aligning infra/resources with azure.yaml, ensuring the UI is built during deployment, and making UI file resolution work under Azure Functions Flex Consumption.
Changes:
- Adds a dedicated Flex Consumption plan + Function App for the
weatherservice and required storage container + outputs. - Adds an
azdprepackagehook to build the Vite UI before Maven packaging. - Updates the widget resource handler to resolve
app/dist/index.htmlrelative to the deployed artifact location (with local fallbacks), and updates remote MCP config to accept a system key.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
samples/McpWeatherApp/src/main/java/com/function/weather/WeatherFunction.java |
Adjusts widget HTML resolution to work on Azure where CWD differs. |
infra/main.bicep |
Provisions separate weather Function App + plan, adds staging extension bundle setting, storage container, and output. |
azure.yaml |
Adds a prepackage hook for weather service to build the UI before mvn package. |
.vscode/mcp.json |
Prompts for a system key and appends it to the remote MCP webhook URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Extension bundle 4.32.0 with MCP support is already published to the production CDN (identical zip on both CDNs), so the staging override is no longer needed.
…wsh hook - Split try/catch in WeatherFunction.java to separate path resolution from file read, with distinct error messages for each - Wrap function app names in toLower() for storage container names to avoid invalid mixed-case container names - Use && instead of ; in Windows pwsh prepackage hook so failures propagate correctly
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.
Fix McpWeatherApp deployment: infra, prepackage hook, and file resolution
This PR fixes the McpWeatherApp sample so it works both locally and when deployed to Azure via
azd up.Problems Fixed
No infrastructure for weather service – The Bicep only provisioned one function app (
api), butazure.yamldefines aweatherservice. Added a separate Flex Consumption plan and function app for the weather service (Flex Consumption allows only one site per plan).UI not built during deployment –
azd deployrunsmvn packagebut the Vite UI (app/dist/index.html) was never built, so the resource endpoint returned "Widget not found". Added aprepackagehook inazure.yamlthat runsnpm installandnpm run buildbefore Maven packaging.File not found on Azure – The widget code used a CWD-relative file path. On Azure Flex Consumption, the CWD differs from the function app root, so the file was never found. Fixed to resolve the path relative to the jar location.
Remote MCP auth – Updated
mcp.jsonto accept a system key for authenticated remote MCP connections.Testing
azd deploy