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

baidu-search-mcp

v1.0.1

Published

MCP 百度搜索服务器 - 为 AI 智能体提供中文网络搜索能力

Readme

baidu-search-mcp

npm version License: MIT

基于 Model Context Protocol (MCP) 的百度搜索服务器,为 AI 智能体提供中文网络搜索能力。

✨ 特性

  • 🔍 百度搜索: 直接使用百度搜索引擎,特别适合中文内容
  • 🆓 完全免费: 无需 API Key,无调用次数限制
  • 快速响应: 3-10 秒返回搜索结果
  • 📄 深度抓取: 可选抓取搜索结果页面的详细内容
  • 🎯 灵活配置: 支持自定义结果数量和内容长度
  • 🔧 即开即用: 无需复杂配置,安装即可使用

📦 安装

全局安装(推荐)

npm install -g baidu-search-mcp

本地安装

npm install baidu-search-mcp

🚀 使用方法

在 Claude Desktop 中使用

编辑 Claude Desktop 配置文件:

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

方式 1: 基础配置(使用默认参数)

{
  "mcpServers": {
    "baidu-search": {
      "command": "npx",
      "args": ["baidu-search-mcp"]
    }
  }
}

方式 2: 自定义参数配置(推荐)

{
  "mcpServers": {
    "baidu-search": {
      "command": "npx",
      "args": [
        "baidu-search-mcp",
        "--max-result=5",
        "--fetch-content-count=2",
        "--max-content-length=2000"
      ]
    }
  }
}

方式 3: 全局安装后使用

# 先全局安装
npm install -g baidu-search-mcp
{
  "mcpServers": {
    "baidu-search": {
      "command": "npx",
      "args": [
        "baidu-search-mcp",
        "--max-result=5",
        "--fetch-content-count=2",
        "--max-content-length=2000"
      ]
    }
  }
}

命令行参数说明

| 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | --max-result | number | 8 | 默认返回的搜索结果数量(1-50) | | --fetch-content-count | number | 1 | 抓取详细内容的结果数量(1-10) | | --max-content-length | number | 3000 | 默认每页最大抓取字符数(500-10000) |

示例:

# 快速搜索模式(仅摘要)
--max-result=5 --fetch-content-count=0

# 深度搜索模式(含详细内容)
--max-result=3 --fetch-content-count=3 --max-content-length=5000

# 大量快速搜索
--max-result=20 --fetch-content-count=0

在其他 MCP 客户端中使用

任何支持 MCP 协议的客户端都可以使用此服务器。通过 stdio 方式连接:

baidu-search-mcp

💡 使用建议

何时使用 fetch_content: true

适合使用:

  • 需要深入分析文章内容
  • 要对比多个来源的详细信息
  • 提取特定段落或数据

不建议使用:

  • 只需要概览信息
  • 对响应速度有严格要求
  • 搜索结果数量较多(>5条)

搜索技巧

  1. 使用关键词: "React Hooks 教程" 优于 "如何学习 React Hooks"
  2. 添加限定词: "2024 人工智能趋势" 获取最新信息
  3. 控制数量: 一般 5-8 条结果足够,过多会影响性能

📊 性能对比

| 场景 | 参数设置 | 响应时间 | 适用情况 | |------|----------|----------|----------| | 快速概览 | fetch_content: false | 1-2秒 | 日常对话、快速查询 | | 深度分析 | fetch_content: true, count: 3 | 3-5秒 | 需要详细内容 | | 全面研究 | fetch_content: true, count: 8 | 8-10秒 | 深度研究、内容对比 |

🔧 开发

克隆仓库

git clone https://github.com/caiyili/baidu-search-mcp.git
cd baidu-search-mcp

安装依赖

npm install

本地测试

npm start

开发模式(支持热重载)

npm run dev

🐛 故障排除

搜索结果很少或为空

原因:

  • 百度页面结构变化
  • 网络问题
  • 反爬限制

解决方案:

  1. 稍后重试
  2. 更换搜索关键词
  3. 检查网络连接

Claude Desktop 无法识别工具

检查清单:

  • ✅ 配置文件路径正确
  • ✅ JSON 格式正确(无多余逗号)
  • ✅ 已重启 Claude Desktop
  • ✅ 包已正确安装

抓取内容失败

部分网站可能有反爬机制,这是正常现象。建议:

  • 使用 fetch_content: false 仅获取摘要
  • 或使用 fetch_url 工具单独抓取特定 URL

🤝 贡献

欢迎提交 Issue 和 Pull Request!

开发指南

  1. Fork 本仓库
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

📝 更新日志

v1.0.0 (2025-11-14)

  • ✨ 初始版本发布
  • 🔍 支持百度搜索
  • 📄 支持页面内容抓取
  • ⚙️ 可配置结果数量和内容长度

📄 许可证

MIT License

🔗 相关链接

⭐ Star History

如果这个项目对你有帮助,请给它一个 Star!


注意: 本工具仅供学习和研究使用,请遵守百度搜索的使用条款和相关法律法规。