Repository navigation
Conversation
Co-authored-by: Copilot App <[email protected]>
Contributor
|
Hey @dotnet/aspnet-build, looks like this PR is something you want to take a look at. |
This was referenced Nov 6, 2026
15 tasks
This branch has not been deployed
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.
Add Razor component hosting for MCP Apps
Add stateless Razor component forms and action handling over standard MCP Apps.
Description
Adds the standalone
Microsoft.AspNetCore.Components.Mcppackage so applications can expose ordinary Razor component forms through MCP Apps, using the C# MCP SDK over Streamable HTTP.App.razorowns the document and explicitly declares<script src="blazor.mcp.js"></script>. The host cascadesMcpComponentRequestContext;IsShellRenderinglets the root defer required-data content during standardresources/readwithout weakening full-render validation. The packaged static web asset is served at the application asset root, including an HTTP PathBase, without an old_contentalias or hidden script injection.EditForm,SupplyParameterFromForm, form-mapping scopes, binding, server validation, native constraint validation, submitter overrides, and URL-encoded/multipart input semantics. Internal navigation resolves server-side to final HTML without replaying POST mutations.The bounded protocol view registry retains opaque capabilities, principal associations, serialized initial parameters, and cancellation/completion bookkeeping separately from the scoped execution pipeline. Application business persistence belongs in application-owned singleton services or storage.
Scope is forms/actions, not general HTTP SSR parity. Streaming, session/TempData, broad navigation/history/focus/initializer parity, arbitrary remote
@onclick, producer circuits, interactive render modes, and JavaScript interop are excluded.ConfigureBrowseris a no-op; MCP-owned browser options apply.CacheViewis non-caching. Components.Endpoints and lower-level component assemblies are unchanged. Other SDK transports are not claimed as validated.N/A — no linked originating issue. Separate API proposal filing is deferred at the author's request; this PR does not claim API approval. Approval covering the final API shape is still required before RTM inclusion.
Validation
Commands were run from the repository root after
. .\activate.ps1; test runs usedASPNETCORE_TEST_LOG_MAXPATH=32767.dotnet test src\Components\Mcp\test\Microsoft.AspNetCore.Components.Mcp.Tests.csproj --no-restore --disable-build-servers -nr:false -p:UseIisNativeAssets=false --logger "trx;LogFileName=mcp-managed-shell.trx" -v:qdotnet build src\Components\Mcp\testassets\Components.McpTestApp.E2E.Tests\Components.McpTestApp.E2E.Tests.csproj --no-restore --disable-build-servers -nr:false -p:UseIisNativeAssets=false -v:qdotnet run --project src\Components\Mcp\testassets\Components.McpTestApp.E2E.Tests\Components.McpTestApp.E2E.Tests.csproj --no-build -- --minimum-expected-tests 40 --report-trx --report-trx-filename mcp-shell-all.trxnpm run build --workspace @microsoft/aspnetcore-components-mcpnpm run build --workspace @microsoft/aspnetcore-components-mcp-test-consumernode node_modules\typescript\bin\tsc --noEmit -p src\Components\Mcp\src\JS\tsconfig.jsonnode node_modules\typescript\bin\tsc --noEmit -p src\Components\Mcp\testassets\Components.McpTestApp\JS\tsconfig.jsondotnet build src\Components\Mcp\src\Microsoft.AspNetCore.Components.Mcp.csproj -c Release --no-restore --disable-build-servers -nr:false -p:UseIisNativeAssets=false -v:qdotnet pack src\Components\Mcp\src\Microsoft.AspNetCore.Components.Mcp.csproj -c Release --no-build --no-restore --disable-build-servers -nr:false -p:UseIisNativeAssets=false -o <artifact-directory> -v:q.\eng\scripts\CodeCheck.ps1git diff --cached --check,git diff --exit-code,git ls-files --others --exclude-standardA separate PackageReference-only consumer restored the actual produced package into a fresh isolated cache, then built and published successfully. A real C# SDK client probe passed against its built Development app, published Production app, and published app under
/app:blazor.mcp.jsreturned HTTP 200 (436,259 bytes), the old prefix returned HTTP 404, the resource contained the authored shell/script, and discovery/read/open/binding/POST/render/CLOSE succeeded. Published JavaScript matched the current Release bundle. This package-consumption probe is additional validation; its disposable harness is not repository source.Permanent tests include authored script fetch/initialization exactly once across document updates in both DOM modes, script omission, required typed data deferred only during shell rendering, real native form inputs and effects, cancellation/disposal gates, per-view parameter isolation, SDK response-filter ordering, and redirects. The confirmed relative-action, filter-ordering, and authored-resource regressions were reproduced with failing assertions before their fixes and pass afterward.
A final independent, fresh-context source review covered all 72 changed paths and found no significant correctness, lifetime, data-integrity, compatibility, or test-validity blocker. This is a bounded readiness review, not a claim of exhaustive verification. The PR remains draft for maintainer and API review.