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

@yandy0725/pi-web-tools

v0.6.1

Published

pi package providing websearch and webfetch tools

Readme

pi-web-tools

为编程 agent 提供网页搜索和网页抓取工具的 pi 包。

工具

| 工具 | 描述 | 来源 | |------|------|------| | websearch | 纯网页搜索,返回原始结果(标题、URL、摘要) | Exa → 阿里云回退 | | webfetch | 抓取网页并转换为文本、Markdown 或原始 HTML | — |

快速开始

# 从 npm 安装
pi install npm:@yandy0725/pi-web-tools

# 或从本地仓库安装
pi install ./path/to/pi-web-tools

# 或直接运行
pi -e ./index.ts

前置条件

  • websearch:无需配置——Exa MCP 免费层(150次/天)。设置 EXA_API_KEY 可获得更高限额。可选:设置 ALIYUN_API_KEY 或在 pi 中配置 aliyun provider,启用百炼 WebSearch 回退(中文搜索效果更好)。

配置

API Key 通过环境变量配置。

API Key(仅环境变量)

| 变量 | 说明 | 默认值 | |------|------|--------| | EXA_API_KEY | Exa API key,不设则走 MCP 免费层(150次/天) | — | | ALIYUN_API_KEY | 阿里云百炼 API key,用于 websearch 回退。也支持通过 pi 的 aliyun provider 配置获取 | — |

工具参考

websearch

搜索网页,自动回退到可用源。

参数:

| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | query | string | 是 | — | 搜索查询 | | numResults | number | 否 | 10 | 结果数量(1-20) | | source | "exa" | "aliyun" | 否 | — | 搜索源 |

搜索源:

  • Exa(默认)— AI 原生搜索 API。有 EXA_API_KEY:完整 REST API。无 key:MCP 免费层(150次/天,3 QPS)。无需 key 即可使用。
  • 阿里云(回退)— 百炼 WebSearch MCP。需要配置 ALIYUN_API_KEY 环境变量或在 pi 的 models.json 中注册 aliyun provider。中文搜索效果更好。Exa 失败时自动回退到阿里云。

webfetch

抓取 URL 内容并返回文本、Markdown 或原始 HTML。

参数:

| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | url | string | 是 | — | 要抓取的 URL | | format | "text" | "markdown" | "html" | 否 | "markdown" | 输出格式 | | timeout | number | 否 | 30 | 超时秒数(1-120) |

开发

npm install              # 安装依赖
npm run typecheck        # tsc --noEmit
npm run lint             # biome lint
npm test                 # vitest run

许可证

MIT