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.1.1.tar.gz (15.6 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.1.1-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for skysearch-1.1.1.tar.gz
Algorithm Hash digest
SHA256 426fe04ea494686a58727a8fa0ce42e8f19f8aaa7910cf8887672a41f1ff20c7
MD5 b479caf81f713edcdbe7ac4b740974d3
BLAKE2b-256 391ee8440b2cbf5b812110af104eeb129c42800112aabe592dd1f87bd0be8ef3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: skysearch-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cfac0b07fd4171071b3c70243d2065ca246f2381a2a49a34a987f76cf9f1cb3
MD5 aaf3f6c9420e7d2a8eb27d127d91d525
BLAKE2b-256 165c9ac62ae538cfd1511bee4f754ba3db40fc6b2964fdfb9f7fdd6cd4e4ed92

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