First-Party HTML Context Tooling for Aspire MCP #13646
Closed
michellee4445
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
See https://devblogs.microsoft.com/aspire/aspire-13-1-holiday-gift/ to see how we are already integrating with the playwright mcp (configuring both mcp servers). We don't need to be any more native than that IMO. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Guys, using AI here to make a suggestion π‘π‘π‘
Integrate Microsoft.Playwright into the .NET Aspire MCP (Model Context Protocol) server. This allows AI agents to programmatically request the live HTML state of any orchestrated service, providing "visual" context to the LLM during a debugging or development session.
Technical Stack
Orchestrator: .NET Aspire AppHost
Extraction Engine: Microsoft.Playwright
Communication: Model Context Protocol (MCP)
Proposed Implementation
The Aspire AppHost would register a tool within its MCP server. When an AI (like Claude, Github Copilot or an OpenAI agent) asks "What does the current frontend look like?", the MCP server executes a headless capture using the Microsoft Playwright library.
`using Microsoft.Playwright;
using Aspire.Hosting;
// Logic within the Aspire MCP Server implementation
public async Task GetActivePageHtml(string serviceName)
{
// 1. Resolve the internal Aspire URL for the service
var service = _appModel.Resources.OfType()
.FirstOrDefault(r => r.Name == serviceName);
var url = service?.GetEndpoint("http").Url;
}`
Why Microsoft.Playwright?
By using the Microsoft.Playwright package, the Aspire team can ensure:
Consistency: Native support for modern web standards (Shadow DOM, Single Page Apps).
Reliability: First-party support within the Microsoft ecosystem.
Performance: Fast, headless execution that doesn't significantly bloat the AppHost footprint.
Impact on Developer Workflow
AI Debugging: A developer says to the AI: "The button on the login page is misaligned."
2. Autonomous Inspection: The AI calls the MCP tool get_html, receives the raw Microsoft.Playwright output, and identifies that a CSS class is missing or a div is unclosed.
Correction: The AI generates a fix based on the actual rendered output, not just the source code.
Beta Was this translation helpful? Give feedback.
All reactions