s

shadcn-ui-mcp-server 工具(组件文档服务器)

@ymadd/shadcn-ui-mcp-server
Hosted
4 Stars 1.2k 次浏览 ymadd 更新于 2026-08-23

帮助人工智能助手通过基于 TypeScript 的 MCP 服务器访问 shadcn/ui 组件的文档和示例,该服务器为组件详情、使用示例和搜索功能提供参考信息。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "shadcn-ui-server": {
      "args": [
        "-y",
        "shadcn-ui-mcp-server"
      ],
      "command": "npx"
    }
  }
}

服务介绍

shadcn-ui MCP 服务器

用于 shadcn/ui 组件引用的 MCP 服务器

这是一个基于 TypeScript 的 MCP 服务器,为 shadcn/ui 组件提供参考信息。它实现了一个模型上下文协议 (MCP) 服务器,帮助 AI 助手访问 shadcn/ui 组件文档和示例。

特性

工具

  • list_shadcn_components - 获取所有可用的 shadcn/ui 组件列表
  • get_component_details - 获取特定组件的详细信息
  • get_component_examples - 获取特定组件的使用示例
  • search_components - 按关键词搜索组件

功能

此服务器从以下位置抓取并缓存信息:

它提供了结构化的数据,包括:

  • 组件描述
  • 安装说明
  • 使用示例
  • 属性和变体
  • 代码示例

开发

安装依赖:

npm install

构建服务器:

npm run build

对于带有自动重建的开发:

npm run watch

安装

Claude Desktop 配置

要与 Claude Desktop 一起使用,请添加服务器配置:

在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

选项 1:使用本地构建

{
  "mcpServers": {
    "shadcn-ui-server": {
      "command": "/path/to/shadcn-ui-server/build/index.js"
    }
  }
}

选项 2:使用 npx 命令

{
  "mcpServers": {
    "shadcn-ui-server": {
      "command": "npx",
      "args": ["-y", "shadcn-ui-mcp-server"]
    }
  }
}

Windsurf 配置

将以下内容添加到你的 ./codeium/windsurf/model_config.json 文件中:

{
  "mcpServers": {
    "shadcn-ui-server": {
      "command": "npx",
      "args": ["-y", "shadcn-ui-mcp-server"]
    }
  }
}

Cursor 配置

将以下内容添加到你的 .cursor/mcp.json 文件中:

{
  "mcpServers": {
    "shadcn-ui-server": {
      "command": "npx",
      "args": ["-y", "shadcn-ui-mcp-server"]
    }
  }
}

调试

由于 MCP 服务器通过 stdio 进行通信,调试可能会很困难。我们建议使用 MCP Inspector,它作为一个包脚本提供:

npm run inspector

Inspector 将提供一个 URL,以便在浏览器中访问调试工具。

相关 MCP 服务