minorum/avalonia-headless-mcp
If you are the rightful owner of avalonia-headless-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Avalonia.Headless MCP Server is a minimal C# server designed to run headless and expose tools/resources for AI applications via the Model Context Protocol (MCP).
Autonia MCP - UI Automation Server
An AI-powered development assistant for Avalonia applications. This MCP (Model Context Protocol) server enables AI agents to discover, connect to, and interact with running Avalonia applications during development workflows.
Purpose
This server transforms AI agents into Avalonia development assistants that can:
- š Discover running Avalonia applications on your system
- š Connect to your applications during development
- šø Capture screenshots for visual testing and documentation
- š±ļø Interact with UI elements for automated testing
- š Analyze your application's UI in real-time
Perfect for prototyping, testing, and validating Avalonia applications with AI assistance.
Architecture
Unlike traditional UI automation tools, this server connects to external running applications rather than creating isolated UIs. This enables AI agents to work directly with your actual development projects.
āāāāāāāāāāāāāāāāāāā MCP Protocol āāāāāāāāāāāāāāāāāāāāāāāā
ā AI Agent ā āāāāāāāāāāāāāāāāāāāŗ ā MCP Server ā
ā (Claude Code) ā ā (This Project) ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāā
ā
ā Process Discovery
ā & Connection
ā¼
āāāāāāāāāāāāāāāāāāāāāāāā
ā Your Avalonia Apps ā
ā (Running Processes) ā
āāāāāāāāāāāāāāāāāāāāāāāā
Getting Started
Prerequisites
- .NET 9.0 or higher
- Claude Code (for AI interaction)
Quick Setup with Claude Code
-
Add Autonia to your Avalonia app (one line):
public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>() .UsePlatformDetect() .WithInterFont() .UseAutonia(); // ā Add this line
-
Add to Claude Code (one command):
# Generic command for any Avalonia project: claude mcp add my-avalonia-app dotnet "run --project YourApp.csproj" --cwd "/path/to/your/project" # Or use the provided script: ./add-to-claude.sh YourApp.csproj my-app-name
-
Start using in Claude Code:
- "Take a screenshot of my Avalonia app"
- "Click the Submit button and show me the result"
- "Type 'test@example.com' in the email field"
Alternative: Manual Configuration
Add this server to your MCP client configuration:
{
"mcpServers": {
"my-avalonia-app": {
"command": "dotnet",
"args": ["run", "--project", "YourApp.csproj"],
"cwd": "/path/to/your/project"
}
}
}
Available MCP Tools
š Application Discovery
DiscoverAvaloniaApplications
- Find all running Avalonia applicationsConnectToApplication
- Connect to a specific application by process IDListConnectedApplications
- Show active connectionsDisconnectFromApplication
- Clean up connections
šø Visual Testing
CaptureWindowScreenshot
- Take screenshots of connected applicationsSaveImageToFile
- Save screenshots to diskCompareImages
- Visual regression testing with pixel-perfect comparison
š±ļø UI Interaction
ClickElement
- Click UI elements by name or coordinatesTypeText
- Type text into input fieldsGetElementProperty
/SetElementProperty
- Read/write element propertiesWaitForElement
- Wait for elements to appear or meet conditions
Example Workflow
// 1. Discover running Avalonia applications
{
"tool": "DiscoverAvaloniaApplications"
}
// 2. Connect to your application
{
"tool": "ConnectToApplication",
"parameters": {
"processId": 1234
}
}
// 3. Take a screenshot
{
"tool": "CaptureWindowScreenshot",
"parameters": {
"connectionId": "abc123",
"format": "png"
}
}
// 4. Interact with UI elements
{
"tool": "ClickElement",
"parameters": {
"connectionId": "abc123",
"elementName": "SubmitButton"
}
}
Development Benefits
For AI-Assisted Development
- Real-time feedback on your actual applications
- Automated testing during development iterations
- Visual documentation generation
- UI accessibility analysis and suggestions
For Team Workflows
- Consistent testing across development environments
- Automated screenshots for design reviews
- Regression testing during rapid prototyping
- Integration with CI/CD pipelines
Technical Details
- Framework: .NET 9.0 with C# 13
- Protocol: Model Context Protocol (latest specification)
- Transport: STDIO for MCP communication
- Dependencies: Minimal - no external APIs or configuration required
- Process Safety: Proper connection management and cleanup
No Configuration Required
This server requires no setup:
- ā No API keys or environment variables
- ā No external service dependencies
- ā No complex configuration files
- ā
Just build and run with
dotnet run
Contributing
This project focuses on AI development assistance for Avalonia applications. Contributions should enhance the ability for AI agents to discover, connect to, and interact with running Avalonia applications.