### Install Global MCP Server Tool Source: https://www.rahultr.dev/xamlmcp Install the XamlMcp server as a global .NET tool for permanent command-line access. ```bash dotnet tool install --global XamlMcp.Server --version 1.0.0-preview.2 ``` -------------------------------- ### Install Framework Agent Packages Source: https://www.rahultr.dev/xamlmcp Add the appropriate NuGet package for your specific XAML framework to your project. ```bash dotnet add package XamlMcp.Avalonia --version 1.0.0-preview.2 dotnet add package XamlMcp.Wpf --version 1.0.0-preview.2 dotnet add package XamlMcp.WinUI --version 1.0.0-preview.2 dotnet add package XamlMcp.Maui --version 1.0.0-preview.2 ``` -------------------------------- ### Configure XamlMcp for GitHub Copilot Source: https://www.rahultr.dev/xamlmcp Define the server configuration in the .vscode/mcp.json file within the repository. ```json { "servers": { "xamlmcp": { "command": "dnx", "args": ["XamlMcp.Server@1.0.0-preview.2"] } } } ``` -------------------------------- ### Register XamlMcp with Codex Source: https://www.rahultr.dev/xamlmcp Add the server via the Codex CLI to share configuration across the CLI, app, and IDE extension. ```bash codex mcp add xamlmcp -- dnx XamlMcp.Server@1.0.0-preview.2 ``` -------------------------------- ### Register XamlMcp with Claude Code Source: https://www.rahultr.dev/xamlmcp Use the Claude CLI to add the server to the user scope. Requires .NET 10 SDK. ```bash claude mcp add --scope user xamlmcp -- dnx XamlMcp.Server@1.0.0-preview.2 ``` -------------------------------- ### Attach XamlMcp to WPF Source: https://www.rahultr.dev/xamlmcp Initialize the MCP server within the Application.OnStartup method, ensuring it is wrapped in conditional compilation to exclude it from Release builds. ```csharp using XamlMcp.Wpf; protected override void OnStartup(StartupEventArgs e) { this.AttachXamlMcp(); base.OnStartup(e); } ``` -------------------------------- ### Enable Windows Driver for native dialogs Source: https://www.rahultr.dev/xamlmcp Register the XamlMcp server with the --enable-driver flag to allow interaction with native Win32 windows. ```bash claude mcp add --scope user xamlmcp -- dnx XamlMcp.Server@1.0.0-preview.2 --enable-driver codex mcp add xamlmcp -- dnx XamlMcp.Server@1.0.0-preview.2 --enable-driver ``` -------------------------------- ### Verify XamlMcp connection via AI prompt Source: https://www.rahultr.dev/xamlmcp Use this prompt in an AI client with the XamlMcp server enabled to verify the framework, transport, and configuration. ```text Use XamlMcp to list the running applications, attach to my app, and show its UI tree. ``` -------------------------------- ### Attach XamlMcp to WinUI 3 Source: https://www.rahultr.dev/xamlmcp Manage the session and window registration manually within the application, ensuring proper disposal when the window closes. ```csharp private WinUiXamlMcpSession? _xamlMcp; private IDisposable? _windowRegistration; #if DEBUG var session = WinUiXamlMcp.Attach(); _xamlMcp = session; _windowRegistration = session.RegisterWindow(window); window.Closed += async (_, _) => { _windowRegistration?.Dispose(); await session.DisposeAsync(); }; #endif ``` -------------------------------- ### Generic MCP Client Configuration Source: https://www.rahultr.dev/xamlmcp Standard configuration format for clients using the mcpServers key with stdio transport. ```json { "mcpServers": { "xamlmcp": { "command": "dnx", "args": ["XamlMcp.Server@1.0.0-preview.2"] } } } ``` -------------------------------- ### Attach XamlMcp to .NET MAUI Source: https://www.rahultr.dev/xamlmcp Register the MCP server in the MauiProgram builder, ensuring it is only active during debug builds. ```csharp using XamlMcp.Maui; #if DEBUG builder.UseXamlMcp(); #endif ``` -------------------------------- ### Attach XamlMcp to Avalonia Source: https://www.rahultr.dev/xamlmcp Configure the Avalonia AppBuilder to attach the MCP server, which remains inert unless the XAML_MCP environment variable is set. ```csharp using XamlMcp.Avalonia; AppBuilder.Configure() .UsePlatformDetect() .AttachXamlMcp(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.