Skip to main content

Search the web, rank results, fetch any page content.

Project description

SkySearch

AI Agent 设计的搜索工具,解决"Agent 需要实时、准确获取互联网信息"的问题。


解决了什么问题

Agent(如 Claude Code)做深度研究时,需要:

  1. 搜索 — 从 Bing 获取最新结果
  2. 抓取 — 从结果 URL 提取完整内容(很多是 JS 动态渲染)
  3. 判断 — 人工或程序判断哪些 URL 值得抓

传统方案的问题:

  • requests / curl 抓不到 JS 渲染的页面(知乎、SPA、单页应用)
  • Selenium 太重、启动慢、资源占用大
  • Google Search API 要钱,Bing API 也要钱

SkySearch = Bing 搜索 + DrissionPage 动态渲染 + BM25 排序,轻量、免费、Agent 友好。


核心能力

能力 说明
搜索 Bing 分页搜索,支持中文分词
抓取 自动检测动态/静态页面,动态页面自动 JS 渲染
排序 BM25 对搜索结果按相关性排序(可选)
MCP MCP Server 协议,Claude Code 直接调用

安装

pip install skysearch

快速开始

Agent 工作流

# Step 1: 调用 search工具,获取 Bing搜索结果
search(query="浙江大学 录取 分数线", num=10)

# Step 2: Agent 人工/程序判断哪些 URL 值得抓

# Step 3: 对选中的 URL 调用 fetch 工具
fetch(url="https://example.com", output_mode="info")

MCP Server

Claude Code 等 MCP 客户端可直接调用 searchfetch 工具:

skysearch-mcp

API 设计理念

search + fetch 分离,而不是 search_and_fetch 自动完成:

  • Agent 可以先看搜索结果(快),再决定抓哪些
  • 抓取是按需的,不浪费资源在无关 URL 上
  • 适合深度研究场景,不适合"搜完就完事"的简单场景

命令行

# 搜索
skysearch "关键词" -n 10

# 抓取
skysearch --url https://example.com --mode info

# 强制动态渲染
skysearch --url https://example.com --mode info --headed

Claude Code 配置

CLAUDE.md 或项目根目录添加 MCP 服务器配置

{
  "mcpServers": {
    "skysearch": {
      "command": "python",
      "args": ["-m", "skysearch.mcp"],
      "description": "Bing 搜索 + 网页抓取"
    }
  }
}

配置后 Claude Code 会自动连接,Agent 可直接调用 searchfetch 工具。


项目结构

skysearch/
├── __init__.py         # 导出 search, fetch, utils
├── cli.py              # Click CLI
├── core/
│   ├── search.py       # Bing 搜索 + BM25
│   ├── fetcher/        # Fetcher 类
│   │   ├── fetcher.py  # 单次 fetch 封装
│   │   ├── static_fetch.py
│   │   ├── dynamic_fetch.py
│   │   └── parse.py
│   ├── utils/          # 解析工具
│   │   ├── utils.py    # parse_bing_results, extract_real_url
│   │   └── ranker.py   # rank_documents
│   └── service.py      # API 封装
└── mcp/
    ├── server.py        # FastMCP 入口
    └── tools.py         # @mcp.tool() search/fetch

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skysearch-1.0.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skysearch-1.0.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file skysearch-1.0.0.tar.gz.

File metadata

  • Download URL: skysearch-1.0.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for skysearch-1.0.0.tar.gz
Algorithm Hash digest
SHA256 69f87c8948b679a4189cca2bbabe19998108adbcb575b8b46e5093f25ce2862a
MD5 be6856b4ebfb4cbeda9f51931a871866
BLAKE2b-256 e65902a56fc0a9359997bdf0f47f9af47e05a9a83aaec3460d6a7e921bdcad37

See more details on using hashes here.

File details

Details for the file skysearch-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: skysearch-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for skysearch-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d56097e7c059bdc963890e27595c081fe7b5a5f70e0d3e1546e0a99bf9596bed
MD5 322b5c76e26b7fd53818ee1c4a02d57b
BLAKE2b-256 994f1d4c91b4e30a718802621f0df262a3c4dba32d37a6359b3347d1d697f166

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page