Skip to content

Repository files navigation

Format XAML from your agent.

NuGet NuGet downloads Pack and Publish License: MIT

🌐 English | 한국어

xaml-styler-mcp is a .NET global tool that exposes XamlStyler through a stdio MCP server. Local coding agents can call it to format XAML strings, format XAML files, or check whether a file would change.

Highlights

  • Format XAML through MCP tools from Codex, Claude Code, GitHub Copilot CLI, Gemini CLI, OpenCode, or any provider that supports stdio MCP servers.
  • Register or remove the server with supported provider CLIs using mcp-install, mcp-remove, or mcp-uninstall.
  • Edit arbitrary mcp.json files directly for providers that do not have a built-in installer command.
  • Reuse Settings.XamlStyler configuration files and automatically discover them from file paths.
  • Preserve file encoding when formatting files on disk.

Install

dotnet tool install --global xaml-styler-mcp

Update an existing install:

dotnet tool update --global xaml-styler-mcp

Provider Setup

Use a supported provider CLI:

xaml-styler-mcp mcp-install --provider codex
xaml-styler-mcp mcp-install --provider claude
xaml-styler-mcp mcp-install --provider copilot
xaml-styler-mcp mcp-install --provider gemini
xaml-styler-mcp mcp-install --provider opencode
xaml-styler-mcp mcp-install --provider all

Remove the registration:

xaml-styler-mcp mcp-remove --provider codex
xaml-styler-mcp mcp-uninstall --provider claude
xaml-styler-mcp mcp-remove --provider all

The default MCP server name is xaml-styler. Override it when needed:

xaml-styler-mcp mcp-install --provider codex --name xaml-styler

The opencode provider edits ~/.config/opencode/opencode.json directly instead of using a CLI command.

Custom mcp.json

For other providers, pass the target MCP config file directly:

xaml-styler-mcp mcp-install --config "C:\path\to\mcp.json"

This adds:

{
  "mcpServers": {
    "xaml-styler": {
      "command": "xaml-styler-mcp",
      "args": []
    }
  }
}

The config editor accepts JSON comments and trailing commas when reading. It writes standard formatted JSON and creates a .bak file before modifying an existing config.

MCP Tools

  • format_xaml: Formats a XAML string and returns the formatted content.
  • format_xaml_file: Formats a .xaml or .axaml file and writes changes by default.
  • format_xaml_directory: Formats .xaml and .axaml files in a directory. Set recursive to include subdirectories, excluding bin and obj folders.
  • check_xaml_file: Checks whether a .xaml or .axaml file would change.
  • check_xaml_directory: Checks whether .xaml and .axaml files in a directory would change. Set recursive to include subdirectories, excluding bin and obj folders.

Each tool accepts an optional configPath pointing to a XamlStyler settings file. File-based tools search parent directories for Settings.XamlStyler when configPath is omitted.

Manual Server Command

Running without arguments starts the stdio MCP server:

xaml-styler-mcp

Show CLI help:

xaml-styler-mcp help
xaml-styler-mcp --help

Package Development

dotnet restore
dotnet build
dotnet test
dotnet pack

License

xaml-styler-mcp is licensed under the MIT License.

XAML formatting is powered by XamlStyler, licensed under Apache-2.0. See THIRD-PARTY-NOTICES.md and licenses/XamlStyler-Apache-2.0.txt.

Author

Created by Howon Lee (airtaxi).

Built with help from OpenAI Codex.

About

MCP server and .NET tool for formatting XAML with XamlStyler.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages