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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ahooks-mcp

v1.0.0

Published

MCP server for ahooks - a high-quality and reliable React Hooks library

Downloads

93

Readme

ahooks-mcp

English | 简体中文

一个为 ahooks 设计的 Model Context Protocol (MCP) 服务器 - 高质量可靠的 React Hooks 库。

特性

此 MCP 服务器提供 ahooks hooks 的全面信息,包括:

  • 📋 列出所有可用的 hook 名称
  • 🔍 按关键词搜索 hooks
  • 📚 获取详细的 hook 信息(描述、用法、参数、返回值)
  • 🗂️ 按分类浏览 hooks
  • 📖 获取任何 hook 的完整文档

安装

npm install -g ahooks-mcp

使用方法

配合 Claude Desktop 使用

将以下配置添加到 Claude Desktop 配置文件:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "ahooks": {
      "command": "ahooks-mcp"
    }
  }
}

配合 MCP 客户端使用

你也可以在任何兼容 MCP 的客户端中使用此服务器:

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

const transport = new StdioClientTransport({
  command: "node",
  args: ["/path/to/ahooks-mcp/dist/index.js"],
});

const client = new Client({
  name: "ahooks-client",
  version: "1.0.0",
}, {
  capabilities: {},
});

await client.connect(transport);

可用工具

1. get_all_hook_names

获取所有可用的 ahooks hook 名称列表。

示例:

get_all_hook_names()

2. get_hook_info

获取特定 hook 的详细信息。

参数:

  • name (string, 必需): Hook 名称(例如:"useBoolean", "useRequest")

示例:

get_hook_info({ name: "useBoolean" })

3. search_hooks

在名称、描述或分类中按关键词搜索 hooks。

参数:

  • keyword (string, 必需): 搜索关键词

示例:

search_hooks({ keyword: "state" })

4. get_hooks_by_category

获取特定分类下的所有 hooks。

参数:

  • category (string, 必需): 分类名称(例如:"State", "Effect", "DOM", "Request")

示例:

get_hooks_by_category({ category: "State" })

5. get_all_categories

获取所有可用的 hook 分类列表。

示例:

get_all_categories()

6. get_all_hooks

获取所有 ahooks hooks 的完整信息。

示例:

get_all_hooks()

分类

ahooks 库按以下分类组织:

  • State: 状态管理 hooks(useBoolean, useToggle, useSetState 等)
  • Effect: 副作用相关 hooks(useDebounce, useThrottle, useUpdateEffect 等)
  • DOM: DOM 操作 hooks(useEventListener, useClickAway, useHover 等)
  • Request: 异步请求 hooks(useRequest, useWebSocket)
  • Advanced: 高级工具 hooks(useMemoizedFn, useLatest)
  • LifeCycle: 组件生命周期 hooks(useMount, useUnmount)
  • UI: UI 相关 hooks(useVirtualList)

示例 Hooks

一些常用的 hooks:

  • useRequest - 强大的异步数据管理
  • useBoolean - 布尔状态管理
  • useDebounce - 防抖值
  • useThrottle - 节流值
  • useLocalStorageState - 与 localStorage 同步的状态
  • useEventListener - 优雅的 addEventListener 包装器
  • useClickAway - 检测元素外部点击
  • 更多...

开发

# 安装依赖
npm install

# 构建项目
npm run build

# 开发监听模式
npm run watch

发布到 npm

查看 PUBLISHING.md 了解详细的发布说明。

使用自动化脚本快速发布:

# 首次登录 npm
npm login

# 运行发布脚本(交互式)
./publish.sh

或手动发布:

# 更新版本
npm version patch  # 或 minor, major

# 发布到 npm
npm publish

链接

许可证

MIT