npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dbui-usage-server

v1.0.0

Published

获取dbUI中组件和hooks用法

Readme

dbui-usage-server MCP Server

获取 dbUI 中组件和 hooks 用法,以及从 Coding 平台获取代码文件的 MCP 服务器。

这是一个基于 TypeScript 的 MCP 服务器,提供以下功能:

  • 获取 dbUI 组件、hooks 和工具函数的使用信息
  • 从 Coding 平台获取代码文件内容
  • 智能搜索和模糊匹配功能

功能特性

工具 (Tools)

dbUI 相关工具

  • get_component_usage - 获取 dbUI 组件的用法信息

    • 参数: componentName (必需) - 组件名称
    • 返回: 组件的 props、events、slots 和使用示例
  • get_hook_usage - 获取 dbUI hooks 的用法信息

    • 参数: hookName (必需) - Hook 名称
    • 返回: Hook 的参数、返回值和使用示例
  • get_util_usage - 获取 dbUI 工具函数的用法信息

    • 参数: utilName (必需) - 工具函数名称
    • 返回: 函数的参数、返回值和使用示例
  • search_usage - 搜索 dbUI 中的组件、hooks 或工具函数

    • 参数:
      • query (必需) - 搜索关键词
      • type (可选) - 搜索类型: "component", "hook", "util", "all" (默认)
    • 返回: 匹配的结果列表,按相关性排序

Coding 平台工具

  • get_coding_code - 从 Coding 平台获取指定文件的代码内容
    • 参数:
      • filePath (必需) - 要获取的文件路径
      • ref (可选) - 分支或提交引用,默认为 "draft"
    • 返回: 文件内容,包含语法高亮

环境变量配置

服务器需要以下环境变量:

dbUI 相关配置

  • DBUI_PATH - dbUI 项目的本地路径 (默认: "/Users/chenjingnan/work/dbUI/dbUI")

Coding 平台配置

  • CODING_ACCESS_TOKEN - Coding 平台的访问令牌 (必需)
  • CODING_PROJECT_ID - Coding 项目 ID (默认: "628949")
  • CODING_API_BASE - Coding API 基础 URL (默认: "https://coding.jd.com/api/v4")

开发

安装依赖:

npm install

构建服务器:

npm run build

开发模式 (自动重建):

npm run watch

运行测试:

npm test

测试 Coding 代码获取功能:

node test/test-coding-code.js

安装配置

使用 Claude Desktop

在配置文件中添加服务器配置:

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

{
  "mcpServers": {
    "dbui-usage-server": {
      "command": "npx",
      "args": ["dbui-usage-server"],
      "env": {
        "DBUI_PATH": "/path/to/your/dbUI/project",
        "CODING_ACCESS_TOKEN": "your-coding-access-token-here",
        "CODING_PROJECT_ID": "628949",
        "CODING_API_BASE": "https://coding.jd.com/api/v4"
      }
    }
  }
}

获取 Coding 访问令牌

  1. 登录到 Coding 平台
  2. 进入个人设置 -> 访问令牌
  3. 创建新的访问令牌,确保具有仓库读取权限
  4. 将令牌设置为 CODING_ACCESS_TOKEN 环境变量

使用示例

搜索 dbUI 组件

搜索关键词: "button"
类型: "component"

获取组件用法

组件名称: "AzButton"

获取 Coding 代码

文件路径: "src/components/Button.vue"
分支: "draft" (默认)

调试

由于 MCP 服务器通过 stdio 通信,调试可能比较困难。推荐使用 MCP Inspector:

npm run inspector

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

项目结构

├── src/
│   └── index.ts          # 主服务器实现
├── test/
│   ├── test-coding-code.js    # Coding功能测试
│   └── test-search.js         # 搜索功能测试
├── build/                # 编译输出
├── mcp-config-example.json    # 配置示例
└── README.md

许可证

MIT License