xquery-mcp 1.4.0

dotnet tool install --global xquery-mcp --version 1.4.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local xquery-mcp --version 1.4.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=xquery-mcp&version=1.4.0
                    
nuke :add-package xquery-mcp --version 1.4.0
                    

xquery-mcp

An MCP (Model Context Protocol) server that gives AI coding assistants first-class XQuery 3.1 / XQuery 4.0 support: spec lookup, expression and function reference, error-code explanation, and live XQuery/XPath execution against a real engine.

Powered by PhoenixmlDb.XQuery — a .NET XQuery 3.1/4.0 engine with 99.7% QT3 conformance.

What it does

When wired into an MCP-aware client (Claude Code, Claude Desktop, Cursor, Windsurf, etc.), the agent gains tools to:

  • Look up any XQuery expression, function, prolog declaration, or error code against the W3C specs.
  • Search the spec corpus by keyword.
  • Evaluate XQuery 3.1/4.0 expressions and XPath expressions against XML input — no temp files or shelling out.
  • Validate XQuery for static errors.
  • Explain error codes (e.g., XPST0003, FORG0001) with spec citations.
  • Format & validate XML using a real XML parser and XSD validator.

This means an AI assistant can write XQuery, run it, see the actual result, and self-correct — instead of guessing at syntax from training data that's almost certainly missing XQuery 4.0.

Install

Requires the .NET 10 SDK (or runtime).

dotnet tool install --global xquery-mcp

Upgrade later with dotnet tool update --global xquery-mcp.

Configure your MCP client

Claude Code

claude mcp add xquery xquery-mcp

Or edit ~/.claude.json (or the project-local .mcp.json):

{
  "mcpServers": {
    "xquery": {
      "command": "xquery-mcp"
    }
  }
}

Claude Desktop / Cursor / Windsurf

Add to the client's MCP config file:

{
  "mcpServers": {
    "xquery": {
      "command": "xquery-mcp"
    }
  }
}

After restarting the client, the XQuery tools appear in the tool list.

Tools exposed

Spec lookup

Tool Purpose
xquery_lookup_expression Look up an XQuery expression (flwor, path, if-then-else, …)
xquery_lookup_function Look up a function (fn:tokenize, map:merge, array:flatten, …)
xquery_lookup_prolog Look up a prolog declaration (namespace-declaration, function-declaration, …)
xquery_lookup_error_code Look up an error code (XPST0003, FORG0001, …)
xquery_search Full-text search across the spec corpus
xquery_list_expressions Enumerate every documented expression
xquery_list_functions Enumerate every documented function

Execution

Tool Purpose
xquery_evaluate Run an XQuery expression (optionally against an XML input) and return the result
xquery_validate Static-validate an XQuery expression
xquery_explain_error Explain an error code with spec context
xpath_evaluate Evaluate an XPath expression against an XML document

XML utility

Tool Purpose
xml_validate_schema Validate an XML document against an XSD
xml_format Pretty-print an XML document

Specs covered

Security

xquery_evaluate and xpath_evaluate run user-supplied expressions against a sandboxed engine: DTD processing is disabled, external entity resolution is blocked, and result size is bounded. Suitable for agent-driven exploration; not intended for hosting hostile multi-tenant workloads.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.4.0 107 5/23/2026
1.0.1 106 5/22/2026
1.0.0.3 118 3/31/2026
1.0.0 153 3/28/2026

Major release — every execution tool now returns structured JSON instead of plain strings, plus new tools for compile-once-run-many, parameter binding, spec-aware analysis, and MCP discoverability. AI agents can now parse failures and self-correct using source-location-aware errors. Highlights: xquery_compile + xquery_run with SHA256 handle cache and external variable binding; xquery_find_examples with 8 curated working examples (FLWOR, try-catch, window-clause, maps/arrays, update facility, fn:transform, module-import); xquery_suggest_fix with top-10 error-code rules; xquery_compare_versions; xquery_test assertion runner; server_capabilities; 4 MCP prompts for guided workflows; browsable spec corpus via xquery://index resources. Runtime exception handling narrowed to engine-specific types — no more silently swallowed OOM/cancellation. Structured error codes XMCP0001 (unknown handle), XMCP0002 (bad JSON args). See RELEASES.md for the full per-phase changelog.