xslt-mcp
1.4.0.1
dotnet tool install --global xslt-mcp --version 1.4.0.1
dotnet new tool-manifest
dotnet tool install --local xslt-mcp --version 1.4.0.1
#tool dotnet:?package=xslt-mcp&version=1.4.0.1
nuke :add-package xslt-mcp --version 1.4.0.1
xslt-mcp
An MCP server for XSLT — spec reference lookup, stylesheet validation, and XSLT/XPath execution powered by the PhoenixmlDb engine.
Install
Option 1: Self-contained binary (no .NET required)
Download the latest release for your platform from GitHub Releases:
| Platform | Download |
|---|---|
| Linux x64 | xslt-mcp-linux-x64 |
| Linux ARM64 | xslt-mcp-linux-arm64 |
| macOS x64 | xslt-mcp-osx-x64 |
| macOS ARM64 | xslt-mcp-osx-arm64 |
| Windows x64 | xslt-mcp-win-x64.exe |
# Linux/macOS
chmod +x xslt-mcp-linux-x64
./xslt-mcp-linux-x64
Option 2: .NET tool (requires .NET 10 SDK)
dotnet tool install -g xslt-mcp
Configure
Add to your MCP client configuration:
Claude Code (.mcp.json):
{
"mcpServers": {
"xslt": {
"command": "xslt-mcp"
}
}
}
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"xslt": {
"command": "xslt-mcp",
"args": []
}
}
}
Tools
Spec Reference
| Tool | Description |
|---|---|
xslt_lookup_instruction |
Look up any XSLT instruction — attributes, content model, examples |
xslt_lookup_function |
Look up XPath/XSLT functions — signature, parameters, return type |
xslt_lookup_output_method |
Look up output methods (xml, html, json, text, etc.) |
xslt_lookup_error_code |
Look up error codes with descriptions and fix suggestions |
xslt_search |
Full-text search across all spec entries |
xslt_list_instructions |
List all XSLT instructions |
xslt_list_functions |
List all functions by category |
xslt_compare_versions |
Report which spec version introduced an instruction or function |
xslt_find_examples |
Find curated working examples by topic (xsl:merge, streaming, fn:transform, …) |
Execution
| Tool | Description |
|---|---|
xslt_transform |
Run an XSLT transformation — returns structured JSON with errors and source locations |
xslt_validate |
Compile a stylesheet without executing — returns structured JSON errors |
xpath_evaluate |
Evaluate an XPath expression against XML — returns structured JSON |
xslt_explain_error |
Explain an error code with causes and fixes |
xslt_compile |
Compile a stylesheet once and get a SHA256 handle for reuse |
xslt_apply |
Apply a compiled handle to source XML — skips re-compilation |
xslt_test |
Assertion runner — apply a stylesheet and compare output to expected XML |
Spec-Aware Analysis
| Tool | Description |
|---|---|
xslt_explain_streamability |
Analyze each xsl:mode and xsl:template for streamability |
xslt_suggest_fix |
Given an error code, return a spec-grounded actionable suggestion |
server_capabilities |
Report engine version, spec coverage, and the complete tool list |
Utilities
| Tool | Description |
|---|---|
xml_validate_schema |
Validate XML against an XSD schema |
xml_format |
Pretty-print XML |
How It Works
The MCP server is built from two things: spec reference files and the PhoenixmlDb XSLT engine.
Spec Files
The spec/ directory contains Markdown files with YAML frontmatter covering XSLT 3.0/4.0, XPath 3.1, and Functions & Operators. Each file documents one instruction, function, error code, or concept:
spec/
instructions/ # 74 files — xsl:template, xsl:for-each-group, xsl:stream, ...
xpath/
functions/ # 160+ files — fn:tokenize, map:merge, math:sqrt, ...
axes/ # 13 files — child, descendant, following-sibling, ...
concepts/ # 15 files — streaming-rules, patterns, serialization, ...
error-codes/ # 23 files — XTSE0010, XTDE0640, FODC0002, ...
output-methods/ # 7 files — xml, html, json, text, xhtml, csv, adaptive
Every file has this structure:
---
name: xsl:for-each-group
category: instruction
since: "2.0"
spec_url: https://www.w3.org/TR/xslt-30/#for-each-group
---
# xsl:for-each-group
Groups items in a sequence and processes each group.
## Attributes
...
At startup, the server loads all Markdown files, parses the YAML frontmatter, and builds an in-memory index. The lookup tools search this index by name, category, or full-text keywords. The content is returned directly to the AI agent as Markdown.
Execution Engine
The execution tools (xslt_transform, xslt_validate, xpath_evaluate) delegate to the PhoenixmlDb.Xslt engine — a .NET implementation of XSLT 3.0/4.0. This means the MCP server can not only look up how a feature should work, but also run it and show you the actual output.
Embedded Resources
When installed as a dotnet tool or self-contained binary, the spec files are embedded as assembly resources — no external files needed. For local development, you can override the spec path:
XSLT_SPEC_PATH=/path/to/spec xslt-mcp
# or
xslt-mcp --spec-path /path/to/spec
Spec Coverage and Contributing
The spec reference files were AI-generated from the W3C XSLT 3.0, XPath 3.1, and Functions & Operators specifications. They are interpretive summaries derived from the published standards — useful as reference for AI agents, but not a verbatim reproduction of the spec text. Every entry includes a spec_url linking to the authoritative W3C source.
We're actively filling gaps and improving accuracy. The initial release was generated from an LLM's training data without systematically checking against the spec's table of contents, which means coverage skewed toward frequently-discussed features and missed advanced/niche areas. We've since audited against the full spec and filled the major gaps (streaming, merge, accumulators, 100+ functions), but there's always room to improve.
Areas where we'd welcome help
- Streaming rules — The streamability categories (grounded, striding, climbing, etc.) are complex. Our
streaming-rules.mdcovers the fundamentals but the full spec has nuances we may have simplified. - Output serialization parameters — The interaction between
xsl:output,xsl:result-document, and character maps across all output methods has many edge cases. - Schema-aware processing — Type annotations,
xsl:import-schema, and validation interactions are lightly covered. - Error code completeness — The XSLT 3.0 spec defines 100+ error codes. We have 23. Each one matters when you're debugging.
- XSLT 4.0 additions — xsl:map, xsl:map-entry, and other 4.0 features need coverage as the spec stabilizes.
How to contribute
- Fork this repo
- Add or edit files in
spec/— follow the existing YAML frontmatter + Markdown format - Submit a PR
The only requirements are: the name, category, and since frontmatter fields must be present, and the content should be accurate to the W3C spec. If you're unsure about a detail, include a note and link to the relevant spec section — an incomplete-but-honest entry is better than a confident-but-wrong one.
License
Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Major release — every execution tool now returns structured JSON instead of plain strings, plus new tools for compile-once-apply-many, parameter binding, secondary documents, spec-aware streamability analysis, and MCP discoverability. AI agents can now parse failures and self-correct using source-location-aware errors. Highlights: xslt_compile + xslt_apply with SHA256 handle cache; stylesheet parameter binding via JSON; secondary-document registration for doc()/document() against in-memory XML; xslt_explain_streamability with per-mode and per-template streamability analysis (catches the streaming mistakes models make most often); xslt_find_examples with 8 curated working examples (xsl:merge, xsl:fork, xsl:accumulator, xsl:iterate, streaming-mode, xsl:package, fn:transform, xsl:evaluate); xslt_suggest_fix with top-10 error-code rules; xslt_compare_versions; xslt_test assertion runner; server_capabilities; 4 MCP prompts for guided workflows; browsable spec corpus via xslt:// resources. Runtime exception handling narrowed to engine-specific types — no more silently swallowed OOM/cancellation. Structured error codes XMCP0001 (unknown handle), XMCP0002 (bad parameters JSON), XMCP0003 (bad documents JSON). Fixed: invalid XPath in xpath_evaluate previously leaked XQueryParseException; relative URIs in doc() now work in xslt_apply. See RELEASES.md for the full per-phase changelog.