@aleph-alpha/lib-mcp

中文文档
5.4.0发布于 2026/10/06Apache-2.0TypeScriptES Module近 30 天下载 1.5万

MCP Server for UI Library and ChatKit component discovery tools.

原始使用文档
文档目录12 节
  1. Overview
  2. Installation
  3. Usage
  4. Configure MCP Server
  5. Available MCP Tools
  6. Development
  7. Building
  8. Generating Component Metadata
  9. Testing
  10. How It Works
  11. CLI Commands
  12. License

@aleph-alpha/lib-mcp

MCP (Model Context Protocol) Server for UI Library and ChatKit component discovery tools.

Overview

This package provides an MCP server that enables AI assistants (like Claude and Cursor) to discover and understand components from:

It offers tools to list available components and retrieve detailed documentation including props, examples, and usage guidance.

Installation

Install @aleph-alpha/lib-mcp together with the component packages whose docs you want to query. UI Library is required; ChatKit is optional and only needed if you want Ck* component docs.

# 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 docs require @aleph-alpha/chat-kit to publish its src/ directory (component types.ts and *.stories.ts files). If get_chat_kit_docs returns "Could not find chat-kit source directory", upgrade @aleph-alpha/chat-kit to a version that includes src/ in its published files.

Usage

Configure MCP Server

Run the install command to configure your 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

After installation, restart your IDE to activate the MCP tools.

Available MCP Tools

Once configured, the following tools are available to your AI assistant:

UI Library tools

list_components

Lists all available UI Library components. Supports optional filtering by name, category, or description.

list_components
list_components --filter="button"
list_components --filter="form"
get_component_docs

Retrieves full documentation for a specific UI Library component including:

  • Component description
  • Props with types, defaults, and descriptions
  • Sub-components (if applicable)
  • Usage guidance
  • Code examples
get_component_docs UiButton
get_component_docs Button  # "Ui" prefix is optional

ChatKit tools

Available when @aleph-alpha/chat-kit is installed alongside this package.

list_chat_kit_components

Lists all available ChatKit (Ck*) components. Supports optional filtering by name, category, or description.

list_chat_kit_components
list_chat_kit_components --filter="history"
list_chat_kit_components --filter="message"
get_chat_kit_docs

Retrieves full documentation for a specific ChatKit component, with the same shape as get_component_docs:

  • Component description
  • Props with types, defaults, and descriptions
  • Sub-components (if applicable)
  • Usage guidance
  • Code examples
get_chat_kit_docs CkHistory
get_chat_kit_docs History  # "Ck" prefix is optional

Setup tool

get_setup_guide

Returns the setup and installation guide for integrating the UI library into a project (UnoCSS config, Vite config, required dependencies, and MCP setup instructions).

get_setup_guide

Development

Building

pnpm build

Generating Component Metadata

Regenerates components-meta.json (UI Library) and chat-kit-components-meta.json (ChatKit) by scanning each package's source files.

pnpm generate:component-meta

Testing

pnpm test

How It Works

The MCP server reads component metadata from each package's source layout:

  1. types.ts: Extracts props, their types, descriptions, and component-level JSDoc tags (@category, @useCases, @keywords, @related)
  2. *.stories.ts: Extracts code examples and usage guidance from Storybook stories
  3. index.ts: Detects sub-component exports for the documented component
  4. components-meta.json / chat-kit-components-meta.json: Pre-generated metadata for faster lookups

UI Library components are read from @aleph-alpha/ui-library/src/**, and ChatKit components from @aleph-alpha/chat-kit/src/components/**. Both packages must publish their src/ directory for docs to resolve when consumed from node_modules.

CLI Commands

CommandDescription
mcp-installConfigure MCP server for IDE (--cursor, --vscode to add extra IDEs)
serveStart the MCP server (used internally by IDE)
--helpShow help message

License

Apache-2.0

版本与发布记录

@aleph-alpha/lib-mcp 共发布 21 个版本,首次发布于 2026/02/03;过去 12 个月发布了 21 个版本。

版本发布日期距今
5.4.0latest2026/10/061 个月前
5.3.02026/09/241 个月前
5.2.02026/09/231 个月前
5.1.02026/09/221 个月前
5.0.02026/09/072 个月前
4.1.12026/08/102 个月前

关于 @aleph-alpha/lib-mcp 的常见问题

@aleph-alpha/lib-mcp 是什么?

MCP Server for UI Library and ChatKit component discovery tools.

如何安装 @aleph-alpha/lib-mcp?

在项目目录运行 npm install @aleph-alpha/lib-mcp,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@aleph-alpha/chat-kit(~5.4.0)、@aleph-alpha/ui-library(~5.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 ui-library-mcp,可以用 npx ui-library-mcp 直接运行。

@aleph-alpha/lib-mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aleph-alpha/lib-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aleph-alpha/lib-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@aleph-alpha/lib-mcp 可以商用吗?

@aleph-alpha/lib-mcp 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aleph-alpha/lib-mcp 的下载量有多少?

根据 npm 官方下载统计,@aleph-alpha/lib-mcp 在 2026/10/06 – 2026/11/04 这 30 天内被下载 14,549 次,日均约 485 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aleph-alpha/lib-mcp 还在维护吗?

最新版本 5.4.0 发布于 2026/10/06(1 个月前);至今共发布 21 个版本,其中过去 12 个月发布了 21 个;首次发布于 2026/02/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。