@cooperco/component-library-mcp-server

中文文档
0.1.154发布于 2026/11/06TypeScriptES Module近 30 天下载 2214

MCP server for the Cooper Component Library. Provides component documentation, prop inspection, color palette info, and scaffolding tools for AI assistants.

原始使用文档
文档目录7 节
  1. Install
  2. Configure Claude Code
  3. Explicit project path
  4. Local development (within this repo)
  5. Tools
  6. Examples
  7. How it works

@cooperco/component-library-mcp-server

MCP (Model Context Protocol) server for the Cooper Component Library. Gives AI assistants like Claude Code access to component documentation, prop types, color palettes, passthrough configs, and scaffolding tools.

Install

npm install -g @cooperco/component-library-mcp-server
# or use npx (no install needed)

Configure Claude Code

Add to your project's .claude/settings.json:

{
  "mcpServers": {
    "cooper-components": {
      "command": "npx",
      "args": ["-y", "@cooperco/component-library-mcp-server"]
    }
  }
}

The server auto-detects the project root by walking up from the working directory looking for src/components/components.ts.

Explicit project path

If auto-detection doesn't work (e.g., you're in a monorepo), pass the path explicitly:

{
  "mcpServers": {
    "cooper-components": {
      "command": "npx",
      "args": ["-y", "@cooperco/component-library-mcp-server", "/path/to/Cordblood-Component-Library"]
    }
  }
}

Or use an environment variable:

{
  "mcpServers": {
    "cooper-components": {
      "command": "npx",
      "args": ["-y", "@cooperco/component-library-mcp-server"],
      "env": {
        "COOPER_PROJECT_ROOT": "/path/to/Cordblood-Component-Library"
      }
    }
  }
}

Local development (within this repo)

When working in the component library repo itself, use the local build:

{
  "mcpServers": {
    "cooper-components": {
      "command": "node",
      "args": ["mcp/dist/index.js"]
    }
  }
}

Tools

ToolDescription
list-componentsList all components with categories, variants, and descriptions
get-componentFull docs for a component: props, events, slots, passthrough, and source code
get-component-propsFocused prop table with types, defaults, and required status
get-color-palettesColor palette system: available palettes, structure, and usage
get-passthrough-configPassthrough keys and default Tailwind classes for a component
search-componentsSearch components by name, category, or prop names
scaffold-componentGenerate a new component with .vue, .ts, and .stories.ts files

Examples

Once configured, Claude Code can use the tools automatically:

  • "What components are available?" → calls list-components
  • "Show me the props for ContainerModule" → calls get-component
  • "What color palettes can I use?" → calls get-color-palettes
  • "Create a new BannerModule component" → calls scaffold-component

How it works

The server reads your component library source files at runtime:

  • Parses TypeScript interfaces from ComponentName.ts files using the TypeScript Compiler API
  • Extracts withDefaults, defineEmits, and <slot> usage from .vue files
  • Reads passthrough configurations from src/config/defaultPassthrough/index.ts
  • Reads color palettes from src/config/colorPalettes.ts
  • Discovers components from src/components/components.ts barrel exports

Results are cached in memory and invalidated when source files change, so documentation is always current.

版本与发布记录

@cooperco/component-library-mcp-server 共发布 71 个版本,首次发布于 2026/03/14;过去 12 个月发布了 71 个版本。

版本发布日期距今
0.1.154latest2026/11/065 天前
0.1.1532026/11/047 天前
0.1.1522026/11/047 天前
0.1.1512026/10/3011 天前
0.1.1502026/10/3012 天前
0.1.1492026/10/2714 天前

关于 @cooperco/component-library-mcp-server 的常见问题

@cooperco/component-library-mcp-server 是什么?

MCP server for the Cooper Component Library. Provides component documentation, prop inspection, color palette info, and scaffolding tools for AI assistants.

如何安装 @cooperco/component-library-mcp-server?

在项目目录运行 npm install @cooperco/component-library-mcp-server,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 component-library-mcp-server,可以用 npx component-library-mcp-server 直接运行。

@cooperco/component-library-mcp-server 支持 TypeScript 吗?

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

@cooperco/component-library-mcp-server 支持 ESM 还是 CommonJS?

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

@cooperco/component-library-mcp-server 可以商用吗?

@cooperco/component-library-mcp-server 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@cooperco/component-library-mcp-server 的下载量有多少?

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

@cooperco/component-library-mcp-server 还在维护吗?

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