shadcn/ui MCP Server 是官方的 shadcn MCP 吗?
不是。它是 Jpisnice 开发的社区项目。官方 shadcn MCP 服务器内置于 shadcn CLI,文档见 ui.shadcn.com/docs/mcp。
@Jpisnice
基本信息
一个 MCP 服务器,让 LLM 获取有关 shadcn ui 组件结构、用法和安装方式的上下文,兼容 React、Svelte 5、Vue 和 React Native
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"shadcn-ui-mcp-unofficial": {
"command": "npx",
"args": [
"@jpisnice/shadcn-ui-mcp-server"
]
}
}
}Get the source code for a specific shadcn/ui v4 component
Get demo code illustrating how a shadcn/ui v4 component should be used
Get all available shadcn/ui v4 components
Get metadata for a specific shadcn/ui v4 component
Get the directory structure of the shadcn-ui v4 repository
Get source code for a specific shadcn/ui v4 block (e.g., dashboard-01, login-02, sidebar-01)
Get all available shadcn/ui v4 blocks with categorization
Apply a TweakCN theme preset to the project
List available tweakcn themes
Get details of a specific tweakcn theme
shadcn/ui MCP Server 是一个社区开发的 shadcn MCP 服务器,可为 AI 助手提供 shadcn/ui v4 组件的源代码、示例、区块(blocks)和元数据,并支持 Svelte、Vue 和 React Native 移植版本。它是由 Janardhan Polle(Jpisnice)维护的非官方开源项目,采用 MIT 许可证。
该服务器从上游 GitHub 仓库读取组件代码,因此你的 AI 助手可以基于真实、最新的 shadcn ui MCP 源码编写界面,而不是凭训练数据猜测。它默认通过 stdio 在本地运行,也可以提供 Streamable HTTP 服务以支持多客户端部署。
需要 Node.js 20 或更高版本。GitHub 个人访问令牌(personal access token)是可选的,但推荐配置:不使用令牌时,服务器每小时最多发起 60 次 GitHub API 请求;使用令牌后为 5,000 次。该令牌无需任何权限范围(scopes),可在 https://github.com/settings/tokens 创建,并通过 --github-api-key 参数或 GITHUB_PERSONAL_ACCESS_TOKEN 环境变量传入。
直接用 npx 运行:
npx @jpisnice/shadcn-ui-mcp-server --github-api-key ghp_your_token_here
# Other frameworks
npx @jpisnice/shadcn-ui-mcp-server --framework svelte
npx @jpisnice/shadcn-ui-mcp-server --framework vue
npx @jpisnice/shadcn-ui-mcp-server --framework react-native
# Base UI instead of Radix (React only)
npx @jpisnice/shadcn-ui-mcp-server --ui-library base
claude mcp add shadcn -- bunx -y @jpisnice/shadcn-ui-mcp-server --github-api-key YOUR_TOKEN
如果服务器以 HTTP 模式运行:
node build/index.js --mode http --port 7423
claude mcp add --scope user --transport http shadcn-mcp-server http://localhost:7423/mcp
从项目的 GitHub Releases 下载 shadcn-ui-mcp-server.mcpb 并双击安装,或将以下内容添加到 claude_desktop_config.json:
{
"mcpServers": {
"shadcn-ui": {
"command": "npx",
"args": ["@jpisnice/shadcn-ui-mcp-server"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
}
}
}
}
打开 Cursor 设置,搜索 MCP,然后添加:
{
"mcpServers": {
"shadcn-ui": {
"command": "npx",
"args": [
"@jpisnice/shadcn-ui-mcp-server",
"--github-api-key",
"ghp_your_token_here"
]
}
}
}
运行 “MCP: Add Server...”,选择 “NPM Package”,并输入 @jpisnice/shadcn-ui-mcp-server。生成的 mcp.json 配置如下(可配合 Copilot Chat 使用):
{
"servers": {
"shadcn-ui-mcp-server": {
"command": "npx",
"args": ["@jpisnice/shadcn-ui-mcp-server", "--framework", "react", "--ui-library", "radix"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" },
"type": "stdio"
}
},
"inputs": [
{ "id": "github_token", "type": "promptString", "description": "GitHub Personal Access Token" }
]
}
--framework 选择。--ui-library 或 UI_LIBRARY 选择 Radix UI 或 Base UI 原语。dashboard-01 和 calendar-01。stdio(默认)、http(位于 /mcp 的无状态 Streamable HTTP,默认端口 7423)和 dual;附带 Docker 和 Docker Compose 文件。.mcpb。list_components 返回所有可用组件,get_component 返回组件源码,get_component_demo 返回示例用法,get_component_metadata 返回依赖和描述信息。list_blocks 按分类列出区块,get_block 返回某个区块(如 dashboard-01)的完整代码。get_directory_structure 用于浏览上游仓库的目录结构。list_themes 和 get_theme 读取 tweakcn 主题;apply_theme 将主题预设的 CSS 写入你的项目,并支持 dryRun 选项。apply_theme 的 dry-run 模式预览 tweakcn 预设,再写入 CSS。/mcp。shadcn 现已在其 CLI 中提供官方 shadcn MCP 服务器(文档)。它专注于 registry(组件注册表):浏览、搜索并安装 components.json 中所配置 registry 的条目,可通过 npx shadcn@latest mcp init --client claude 配置(也支持 cursor、vscode、codex、opencode)。如果你主要想把 registry 组件安装到项目中,选择官方服务器;如果你需要原始组件和区块源码、示例、tweakcn 主题,或 Svelte、Vue、React Native 移植版本,选择这个社区版 shadcn mcp server。两者可以同时使用。
--github-api-key 或 GITHUB_PERSONAL_ACCESS_TOKEN 添加 GitHub 令牌,可将限额从每小时 60 次提高到 5,000 次。node --version(自 3.0.0 起需要 20 及以上版本)和 npx --version。INFO: MCP Server configured for SVELTE framework。日志输出到 stderr,请查看客户端的 MCP 日志。/sse 返回 404: 旧版 SSE 传输已被移除;请使用 http 传输连接 http://<host>:7423/mcp。-32022 Unsupported protocol version: 客户端使用 2025 年版本的协议,而服务器以 --protocol modern 运行;请使用 --protocol any(默认值)。不是。它是 Jpisnice 开发的社区项目。官方 shadcn MCP 服务器内置于 shadcn CLI,文档见 ui.shadcn.com/docs/mcp。
免费。它基于 MIT 许可证开源,通过 npx 在本地运行,唯一使用的外部服务是 GitHub API。
不需要。但推荐使用一个无需任何权限范围的 GitHub 个人访问令牌,把 GitHub 速率限制从每小时 60 次提高到 5,000 次。
支持。项目文档提供了 Claude Code、Claude Desktop、Cursor、VS Code(包括 Copilot Chat)和 Continue.dev 的配置方法。
React(默认)、Svelte、Vue 和 React Native,可通过 `--framework` 切换。React 可通过 `--ui-library` 选择 Radix UI(默认)或 Base UI。
可以。使用 `--mode http` 启动,即可在 7423 端口的 `/mcp` 提供 Streamable HTTP 服务;也可以使用附带的 Docker Compose 文件,并通过 `http://localhost:7423/health` 检查运行状态。
大多数工具只从 GitHub 读取数据。`apply_theme` 会将主题 CSS 写入你的项目;可先使用其 `dryRun` 选项预览。
`@jpisnice/shadcn-ui-mcp-server`。GitHub 仓库现已更名为 Jpisnice/shadcn-ui-mcp-server。

Model Context Protocol Servers
MCP Toolbox for Databases is an open source MCP server for databases.
A search tool helps dev to solve the naming things problem.
PickFu MCP is a Model Context Protocol (MCP) server that connects AI assistants, developers, marketers, product managers, and AI agents to PickFu's consumer research platform. It enables users to create surveys, conduct
YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
评论