@aleph-alpha/lib-mcp (英语)
MCP(模式上下文协议)服务器,用于UI库和ChatKit组件发现工具.
概览
这个软件包提供了一个MCP服务器,可以让AI助手(如克洛德和Cursor)从中发现并理解组件:
@aleph-alpha/ui-library—— 说Ui*组件@aleph-alpha/chat-kit—— 说Ck*组件
它提供了列出现有部件和检索详细文件的工具,包括道具、示例和使用指南.
安装
安装 @aleph-alpha/lib-mcp 与您想要查询其文件的组件包一起。 需要UI 库; ChatKit 是可选的, 只有在您想要时才需要 Ck* 组件文件.
# UI Library only
pnpm add @aleph-alpha/lib-mcp @aleph-alpha/ui-library
# UI Library + ChatKit
pnpm add @aleph-alpha/lib-mcp @aleph-alpha/ui-library @aleph-alpha/chat-kit
ChatKit 文档需要
@aleph-alpha/chat-kit出版《公约》src/目录( 组件)types.ts财务报告和审定财务报表*.stories.ts文档). 若为get_chat_kit_docs返回“找不到 talk- kit 源目录”,升级@aleph-alpha/chat-kit改为包含src/在其公布的文件中.
使用量
配置 MCP 服务器
运行安装命令以配置您的 IDE :
# For Claude Code
npx @aleph-alpha/lib-mcp mcp-install
# For both Claude Code and Cursor
npx @aleph-alpha/lib-mcp mcp-install --cursor
# For VS Code
npx @aleph-alpha/lib-mcp mcp-install --vscode
安装后, 请重新启动您的 IDE 以激活 MCP 工具 .
可用的 MCP 工具
配置后, 您的 AI 助手可使用以下工具 :
UI 库工具
list_components
列出所有可用的 UI 库组件 。 支持按名称、类别或描述进行可选过滤.
list_components
list_components --filter="button"
list_components --filter="form"
get_component_docs
为特定UI图书馆部分检索全部文件,包括:
- 构成部分说明
- 带有类型、默认和描述的道具
- 次级构成部分(如适用)
- 使用指南
- 代码示例
get_component_docs UiButton
get_component_docs Button # "Ui" prefix is optional
ChatKit 工具
可用时间 @aleph-alpha/chat-kit 在此软件包旁边安装.
list_chat_kit_components
列出所有可用的 ChatKit (Ck*) 组件。 支持按名称、类别或描述进行可选过滤.
list_chat_kit_components
list_chat_kit_components --filter="history"
list_chat_kit_components --filter="message"
get_chat_kit_docs
为特定的 ChatKit 组件获取完整的文档,其形状与 get_component_docs数字 :
- 构成部分说明
- 带有类型、默认和描述的道具
- 次级构成部分(如适用)
- 使用指南
- 代码示例
get_chat_kit_docs CkHistory
get_chat_kit_docs History # "Ck" prefix is optional
设置工具
get_setup_guide
返回将 UI 库整合到项目中的设置和安装指南(UnoCSS config,Vite config,需要依赖,以及MCP设置指令).
get_setup_guide
发展
大楼
pnpm build
生成组件元数据
重现 components-meta.json (UI图书馆)和 chat-kit-components-meta.json (ChatKit)通过扫描每个软件包的源文件.
pnpm generate:component-meta
测试
pnpm test
如何运作
MCP服务器从每个软件包的源版式读取组件元数据:
types.ts: 提取道具、其类型、说明和组件级JSDoc标签(@category, (中文(简体) ),@useCases, (中文(简体) ),@keywords, (中文(简体) ),@related(中文(简体) )*.stories.ts: 从故事书故事中摘录代码示例和使用指导index.ts: 检测文件所列部件的子部件出口components-meta.json编号 :chat-kit-components-meta.json: 用于更快查找的预生成元数据
UI 库组件读取自 @aleph-alpha/ui-library/src/**,以及来自 @aleph-alpha/chat-kit/src/components/**。两个软件包必须发布 src/ 用于文档的目录,用于在从 node_modules。 。 。 .
CLI 命令
| 命令 | 说明 |
|---|---|
mcp-install | 为 IDE 配置 MCP 服务器 (S)--cursor, (中文(简体) ), --vscode 添加额外的IDE) |
serve | 启动 MCP 服务器( 由 IDE 内部使用) |
--help | 显示帮助消息 |
许可证
阿帕奇 - 2.0