1. Conduid
  2. AI
  3. Ahooks
MCP server · AI

Ahooks

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

37Low

Scored 6 months ago · breakdown

About Ahooks

Ahooks is an MCP server in the AI category: mCP server for ahooks - a high-quality and reliable React Hooks library.

Install

Claude Code
claude mcp add ahooks -- npx -y ahooks-mcp
npx
npx -y ahooks-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Ahooks

Powered by Claude · Grounded in docs

I know everything about Ahooks. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.

5 checks have not been run yet.

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

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About Ahooks

How do I install Ahooks?

Run claude mcp add ahooks -- npx -y ahooks-mcp, then add the server to your MCP client's configuration.

Is Ahooks safe to use with an AI agent?

Its trust score is 37 out of 100 (low). It passes 1 of the 1 static security checks run so far. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Ahooks still maintained?

Conduid hasn't recorded a commit date for this repository yet. Check the repository directly for recent activity.