ProComponents, templates & AI tooling
2.3k

MCP 服务器

在 AI 助手中直接访问 HeroUI Native 文档

HeroUI MCP 服务器让 AI 助手直接读取 HeroUI Native 组件文档,便于在 AI 驱动的开发流程中使用 HeroUI。

HeroUI Native MCP 服务器

当前 MCP 服务器支持 heroui-nativestdio 传输。npm 包名为 @heroui/native-mcp。源码见 GitHub

随着 HeroUI Native 组件增加,MCP 中的可用内容也会同步扩展。

快速配置

Cursor:

或手动添加到 Cursor 设置ToolsMCP Servers

.cursor/mcp.json
{
  "mcpServers": {
    "heroui-native": {
      "command": "npx",
      "args": ["-y", "@heroui/native-mcp@latest"]
    }
  }
}

也可将以下内容加入 ~/.cursor/mcp.json。详见 Cursor 文档

Claude Code: 在终端执行:

claude mcp add heroui-native -- npx -y @heroui/native-mcp@latest

或手动写入项目的 .mcp.json

.mcp.json
{
  "mcpServers": {
    "heroui-native": {
      "command": "npx",
      "args": ["-y", "@heroui/native-mcp@latest"]
    }
  }
}

添加配置后重启 Claude Code,运行 /mcp 查看列表;若显示 Connected 即可使用。

更多说明见 Claude Code MCP 文档

Windsurf: 在项目 .windsurf/mcp.json 中加入:

.windsurf/mcp.json
{
  "mcpServers": {
    "heroui-native": {
      "command": "npx",
      "args": ["-y", "@heroui/native-mcp@latest"]
    }
  }
}

保存后重启 Windsurf 以生效。

详见 Windsurf MCP 文档

Zed:settings.json 中配置(命令面板 zed: open settingsCmd-, / Ctrl-,):

settings.json
{
  "context_servers": {
    "heroui-native": {
      "command": "npx",
      "args": ["-y", "@heroui/native-mcp@latest"],
      "env": {}
    }
  }
}

重启 Zed 后,在 Agent 面板设置中确认 heroui-native 旁指示点为绿色,提示为「Server is active」。

详见 Zed MCP 文档

VS Code: 若配合 GitHub Copilot 使用 MCP,在项目 .vscode/mcp.json 中添加:

.vscode/mcp.json
{
  "servers": {
    "heroui-native": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@heroui/native-mcp@latest"]
    }
  }
}

打开 .vscode/mcp.json,在 heroui-native 旁点击 Start

详见 VS Code MCP 文档

Codex: 写入 ~/.codex/config.toml 或项目内 .codex/config.toml

config.toml
[mcp_servers.heroui-native]
command = "npx"
args = ["-y", "@heroui/native-mcp@latest"]

重启 Codex,在 TUI 中运行 /mcp 校验服务器已激活。

详见 Codex MCP 文档

OpenCode: 在项目 opencode.json 中添加:

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "heroui-native": {
      "type": "local",
      "command": ["npx", "-y", "@heroui/native-mcp@latest"]
    }
  }
}

重启 OpenCode 后生效。

详见 OpenCode MCP 文档

用法

配置完成后,可向 AI 提问,例如:

  • "Help me install HeroUI Native in my Expo app"
  • "Show me all HeroUI Native components"
  • "What props does the Button component have?"
  • "Give me an example of using the Card component"
  • "What are the theme variables for dark mode?"

自动升级

MCP 也可协助将 HeroUI Native 升级到最新版本,例如:

"Hey Cursor, update HeroUI Native to the latest version"

助手通常会:

  • 对比当前版本与最新发布
  • 阅读变更日志中的破坏性变更
  • 在项目中应用必要的代码更新

适用于升级到最新稳定版或预发布版本。

可用工具

MCP 向 AI 暴露以下工具:

工具说明
list_components列出全部 HeroUI Native 组件
get_component_docs获取一个或多个组件的完整文档(结构、props、示例与用法模式)
get_theme_variables读取颜色、排版、间距等主题变量,支持明暗模式
get_docs浏览 HeroUI Native 全部文档(指南与原则等);安装说明可使用路径 /docs/native/getting-started/quick-start

故障排除

环境要求: Node.js 22 及以上。使用 npx 时会自动下载包。

需要帮助? GitHub Issues | Discord 社区

链接

本页目录