Add first-class guidance + libraries for WebMCP in ASP.NET Core / Blazor
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
[WebMCP](https://github.com/webmachinelearning/webmcp) is an emerging web platform API that allows web pages to expose **in‑page “tools”** (with natural‑language descriptions and structured schemas) to AI agents and assistive technologies via a browser surface (`navigator.modelContext`). The tools are registered and executed **in the client page context**, enabling human‑in‑the‑loop, cooperative workflows where users and agents share UI state.
Today, ASP.NET Core developers who want to experiment with or adopt WebMCP patterns must piece together:
- ad‑hoc JavaScript for tool registration and lifecycle management,
- custom schema generation for tool inputs/outputs,
- inconsistent security, confirmation, and authorization patterns,
- and framework‑specific glue for Razor Pages/MVC vs. Blazor (especially Blazor WASM and interactive components).
This results in:
- **Duplicated, fragile implementations** across apps and teams
- **Unclear guidance** on safe and idiomatic usage within ASP.NET Core
- A missed opportunity to align WebMCP with **Blazor’s strengths** as a client‑side, stateful UI framework
ASP.NET Core does not need to implement the WebMCP browser API itself, but it currently lacks **first‑class guidance and primitives** to make WebMCP adoption straightforward, consistent, and secure across its supported frontend models.
> **NOTE:** Filed as a result of a question at MVP Summit in the C# MCP SDK presentation.
### Describe the solution you'd like
At a high level, introduce **first‑class guidance (and optionally lightweight libraries)** that make ASP.NET Core a strong platform for *authoring* WebMCP‑enabled applications.
Specifically:
### A. Official guidance
Provide documentation that explains:
- What WebMCP is (and is not), and how it differs from backend MCP / API integrations
- How WebMCP concepts (tools, schemas, lifecycle) map onto ASP.NET Core patterns
- When to prefer Razor Pages/MVC vs. Blazor (especially WASM and interactive components)
### B. Blazor‑first authoring patterns
Because WebMCP tools run in the page’s client context, Blazor is a particularly strong fit. Consider:
- An idiomatic way to register WebMCP tools from Blazor components or services
- Mapping tool handlers to .NET methods via JS interop
- Clear lifecycle semantics (register/unregister on render/dispose)
- Hosting‑model considerations (WASM vs. Server vs. hybrid Web Apps)
### C. Razor Pages / MVC declarative story
For server‑rendered apps:
- Explore Tag Helpers or conventions that align HTML forms/actions with WebMCP’s declarative approach
- Provide guidance on schema generation, validation, and anti‑forgery considerations
### D. Secure‑by‑default recommendations
At a minimum, documentation (and possibly helpers) for:
- Differentiating read‑only vs. mutating tools
- User confirmation patterns for agent‑initiated actions
- Avoiding unintended tool exposure (iframes, embedded contexts, etc.)
- Logging and observability for tool invocation
### E. Samples over deep framework changes
This could initially ship as:
- Documentation plus samples
- An experimental or opt‑in package
- A small set of framework‑owned helpers
rather than committing to deep framework integration before the WebMCP specification stabilizes.
**Alternative considered:** Waiting until WebMCP is further along the standards track. The downside is fragmented experimentation and lost opportunity for early feedback from ASP.NET Core developers during the spec’s formative phase.
### Additional context
- WebMCP is currently a **W3C Web Machine Learning Community Group draft**, and the API surface is still evolving.
- This proposal is intentionally scoped to **authoring support**, not implementing or polyfilling the browser API.
- This aligns with ASP.NET Core’s historical approach to emerging web platform features: provide clear guidance, good defaults, and opt‑in helpers without forcing adoption.
- Early alignment would allow ASP.NET Core (especially Blazor) apps to participate in and help shape emerging “agentic web” patterns while keeping humans firmly in control.
- [WebMCP is available for early preview (Chrome)](https://developer.chrome.com/blog/webmcp-epp)
Contributor guide
Research direction
The issue names no repository files, tests, or concrete entry points. Start by reviewing the WebMCP draft and the ASP.NET Core integration areas it identifies: Blazor components and services, JS interop, Razor Pages/MVC, and interactive hosting models. Done would require an agreed scope for guidance, samples, or opt-in helpers, with security and lifecycle behavior documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, javascript
- Domain
- documentation, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100