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

tokenhub-websearch

v1.0.6

Published

TokenHub WebSearch MCP Server - 使用 TokenHub 额度调用网络搜索

Readme

TokenHub WebSearch MCP Server

用于将 TokenHub 网络搜索接口封装为 MCP 工具,供 Claude Desktop、Cursor、Windsurf 等支持 MCP 的客户端使用。

功能

  • 工具名:websearch
  • 参数:
    • q(必填):搜索关键词
    • key(可选):TokenHub API Key,以 sk- 开头
  • 每次调用消耗 5000 TokenHub 额度

安装方式

通过 npx 直接使用(无需本地安装)

npx tokenhub-websearch

在 MCP 客户端配置中:

{
  "mcpServers": {
    "tokenhub-websearch": {
      "command": "npx",
      "args": ["-y", "tokenhub-websearch"],
      "env": {
        "TOKENHUB_USER_KEY": "sk-你的TokenHubKey"
      }
    }
  }
}

全局安装

npm install -g tokenhub-websearch
{
  "mcpServers": {
    "tokenhub-websearch": {
      "command": "tokenhub-websearch",
      "env": {
        "TOKENHUB_USER_KEY": "sk-你的TokenHubKey"
      }
    }
  }
}

环境变量

| 变量名 | 必填 | 说明 | |--------|------|------| | TOKENHUB_USER_KEY | 是* | TokenHub API Key,以 sk- 开头 | | WEBSEARCH_BASE_URL | 否 | 后端接口地址,默认 https://cardcdn.jwbpro.com |

*如果环境变量未设置,每次调用时必须通过 key 参数传入。

各客户端安装方法

Claude Desktop

  1. 确保已安装 Node.js 18+。
  2. 打开配置文件:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%/Claude/claude_desktop_config.json
  3. 添加:
{
  "mcpServers": {
    "tokenhub-websearch": {
      "command": "npx",
      "args": ["-y", "tokenhub-websearch"],
      "env": {
        "TOKENHUB_USER_KEY": "sk-你的TokenHubKey"
      }
    }
  }
}
  1. 重启 Claude Desktop。
  2. 在对话里说"搜索人工智能最新进展"即可自动调用 websearch 工具。

Cursor

  1. 打开 Cursor Settings → MCP。
  2. 点击 "Add MCP Server",选择 Type 为 command。
  3. 填入:
    • Name: tokenhub-websearch
    • Command: npx -y tokenhub-websearch
  4. 在 Environment Variables 中设置:
    • TOKENHUB_USER_KEY=sk-你的TokenHubKey
  5. 保存后即可在 Composer/Chat 中使用。

Windsurf

  1. 打开 ~/.windsurf/mcp_config.json 或项目级 .windsurf/mcp_config.json。
  2. 添加:
{
  "mcpServers": {
    "tokenhub-websearch": {
      "command": "npx",
      "args": ["-y", "tokenhub-websearch"],
      "env": {
        "TOKENHUB_USER_KEY": "sk-你的TokenHubKey"
      }
    }
  }
}
  1. 重启 Windsurf。

工具说明

当用户或 agent 请求搜索时,MCP server 会调用:

POST {WEBSEARCH_BASE_URL}/user/noCheck/tokenhub/websearch
Content-Type: application/json

{"key": "sk-xxx", "q": "搜索关键词"}

并返回搜索结果。

注意事项

  • 默认后端地址为 https://cardcdn.jwbpro.com,如需换线可设置 WEBSEARCH_BASE_URL 环境变量。
  • 如果 key 参数和 TOKENHUB_USER_KEY 同时存在,优先使用参数传入的 key。
  • 关键词最长 200 字符,超出会被接口拒绝。
  • 余额不足时接口返回 429,server 会将错误信息返回给客户端。可以在 https://tokenhub.scjwb.com/ 进行充值。

License

MIT