Unity UIToolkit MCP Server

Unity UIToolkit MCP Server

Provides LLM agents with access to Unity UIToolkit documentation, code examples, and HTML/CSS to UXML/USS conversion tools.

Category
访问服务器

README

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:

Pre-rendered Documentation (Recommended)

  • 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

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选