Skip to main content
Glama
Unity UIToolkit MCP Server

Unity UIToolkit MCP Server

by MarzLars

Unity UIToolkit MCP Server

A Vibe Coded Model Context Protocol (MCP) server that provides LLM agents with access to Unity UIToolkit documentation, code examples, and conversion tools for migrating HTML/CSS to UXML/USS.

Features

This MCP server provides the following tools for working with Unity UIToolkit:

  • list_prerendered_docs: Lists all available pre-rendered Markdown documentation

  • read_prerendered_docs: Reads clean, LLM-friendly Markdown documentation converted from Unity's HTML docs

Note: Pre-rendered documentation is automatically fetched and converted weekly via GitHub Actions using markitdown. This provides faster access, better LLM digestibility, and eliminates runtime dependencies on external sites.

Legacy Documentation Tools

  • get_uitoolkit_documentation: Provides Unity UIToolkit documentation reference with links and examples for specific topics (UXML, USS, VisualElement, etc.)

  • get_unity_script_reference: Access Unity Script API reference documentation for UIToolkit classes and methods

  • list_uitoolkit_components: List available UIToolkit components and controls by category

Code Examples

  • get_uitoolkit_code_example: Provides common Unity UIToolkit code example patterns with links to Unity's official examples repository

  • fetch_unity_example_code: Fetches actual source code from Unity's UI Toolkit examples repository. Use this to retrieve implementation samples referenced in documentation (e.g., from <code source="..."/> tags)

Conversion Tools

  • convert_html_to_uxml: Convert HTML markup to UXML format with guidance and best practices

  • convert_css_to_uss: Convert CSS styles to USS (Unity Style Sheets) format with property mappings

Related MCP server: Unity MCP Server

Documentation Pre-rendering

Unity UIToolkit documentation is automatically fetched and converted to Markdown:

  • Schedule: Weekly on Mondays at 00:00 UTC

  • Trigger: Can be manually triggered via GitHub Actions

  • Process:

    1. Fetches latest Unity UIToolkit HTML documentation

    2. Filters to UIToolkit-related pages only

    3. Converts to clean Markdown using markitdown

    4. Commits to docs/ directory

See .github/workflows/update-unity-docs.yml for implementation details.

Installation

npm install
npm run build

Usage

This MCP server uses the stdio transport and can be integrated with any MCP-compatible client.

Configuration

Add to your MCP client configuration (e.g., Claude Desktop config):

{
  "mcpServers": {
    "uitoolkit": {
      "command": "node",
      "args": ["/path/to/UIToolkitMCP/dist/index.js"]
    }
  }
}

Or use npx:

{
  "mcpServers": {
    "uitoolkit": {
      "command": "npx",
      "args": ["uitoolkit-mcp-server"]
    }
  }
}

Available Tools

1. list_prerendered_docs

Lists all available pre-rendered documentation files.

Parameters: None

Example:

{}

2. read_prerendered_docs

Reads pre-rendered Markdown documentation.

Parameters:

  • doc_type (string): Either "manual" or "script-api"

  • doc_name (string): Name of the documentation file (e.g., "UXML", "UIElements_VisualElement")

Example:

{
  "doc_type": "manual",
  "doc_name": "UXML"
}

3. get_uitoolkit_documentation

Retrieves Unity UIToolkit documentation for specific topics.

Parameters:

  • topic (string): The UIToolkit topic to search for (e.g., "UXML", "USS", "VisualElement")

Example:

{
  "topic": "UXML"
}

4. get_uitoolkit_code_example

Provides common Unity UIToolkit code example patterns with links to Unity's official repository.

Parameters:

  • example_name (string): Name or path of the example (e.g., "simple-list-view", "custom-control")

Example:

{
  "example_name": "simple-list-view"
}

5. fetch_unity_example_code

Fetches actual source code from Unity's UI Toolkit examples repository. This is particularly useful when you encounter <code source="..."/> tags in the script-api documentation and want to see the actual implementation.

Parameters:

  • file_path (string): Path to the code file (e.g., "Button_clicked.cs" or "Modules/UIElements/Tests/UIElementsExamples/Assets/Examples/Button_clicked.cs")

Example:

{
  "file_path": "Button_clicked.cs"
}

Note: The tool will automatically search multiple Unity repositories to find the code:

  • Unity's public UI Toolkit manual code examples repository

  • Unity's C# Reference repository (for internal test examples)

6. get_unity_script_reference

Retrieves Unity Script API reference for UIToolkit classes.

Parameters:

  • class_name (string): The Unity class name (e.g., "VisualElement", "ListView", "Button")

Example:

{
  "class_name": "ListView"
}

7. convert_html_to_uxml

Provides guidance for converting HTML to UXML.

Parameters:

  • html_snippet (string): HTML code to convert

Example:

{
  "html_snippet": "<div class='container'><button>Click Me</button></div>"
}

8. convert_css_to_uss

Provides guidance for converting CSS to USS.

Parameters:

  • css_snippet (string): CSS code to convert

Example:

{
  "css_snippet": ".button { background-color: blue; padding: 10px; }"
}

9. list_uitoolkit_components

Lists available UIToolkit components.

Parameters:

  • category (string, optional): Filter by category ("containers", "controls", "data-bound", "advanced")

Example:

{
  "category": "controls"
}

Resources

Development

Build

npm run build

Watch Mode

npm run watch

License

MIT

Available Tools

5 tools
convert_html_to_uxmlC

Provides guidance and examples for converting HTML markup to UXML format. Returns conversion patterns and best practices.

Inputs: html_snippet (required).

fetch_unity_example_codeA

Fetches the actual source code content from a specific file in Unity's UI Toolkit examples repository. Use this when you have a code source reference (e.g., from tags in documentation) and need to see the actual implementation.

Inputs: file_path (required).

get_uitoolkit_code_exampleA

Fetches actual code examples from Unity's official UI Toolkit manual code examples repository (https://github.com/Unity-Technologies/ui-toolkit-manual-code-examples). Use this to retrieve real implementation samples showing UIToolkit syntax and usage patterns.

Inputs: example_name (required).

get_unity_script_referenceB

Retrieves Unity Script API reference documentation for UIToolkit classes and methods. Use this to get detailed API information.

Inputs: class_name (required).

read_prerendered_docsA

Reads pre-rendered documentation for Unity UIToolkit. Returns documentation from either Unity's HTML manual (for UXML, USS, etc.) or from C# source code (for class API references).

Inputs: doc_name (required), doc_type (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 5 tools

    Disambiguation3/5

    Tools have some overlap: get_uitoolkit_code_example and fetch_unity_example_code both deal with code examples from the same repository, while get_unity_script_reference and read_prerendered_docs both provide API reference information, creating potential ambiguity for an agent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case (e.g., get_uitoolkit_code_example, fetch_unity_example_code, convert_html_to_uxml), making the naming uniform and predictable.

    Tool Count5/5

    With 5 tools, the server is well-scoped for its purpose of providing Unity UIToolkit documentation and code examples, avoiding unnecessary complexity while covering key functions.

    Completeness3/5

    The tool set covers code examples, API reference, HTML conversion, and documentation reading, but lacks search or listing capabilities, which could force agents to rely on exact references.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      C
      maintenance
      Provides AI assistants with structured access to Unity project metadata, build settings, and agent documentation directly from the filesystem. It enables querying project details and scene configurations without requiring the Unity Editor to be running.
      156
      246 npm
      7
      -
    • F
      license
      B
      quality
      A
      maintenance
      Provides AI assistants with comprehensive control over Unity Hub and Unity Editor through over 200 specialized tools for project management and scene manipulation. It enables users to perform complex tasks like script creation, asset management, and project builds using natural language commands.
      80
      201 npm
      549
      -
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Exposes Unity Editor project context and manipulation tools to AI coding agents, enabling automated scene hierarchy analysis, script inspection, and asset management. It supports both read and write operations including GameObject editing, component configuration, and animation authoring within the Unity environment.
      2
      -