gsearch

io.github.RayenMlayeh由 GitHub 账号 RayenMlayeh 发布v0.1.0更新于 Oct 26, 2026

Real Google Search for AI agents: real URLs, AI Overview and People also ask as typed JSON.

概览

AI 生成的概览

自托管的 MCP 服务器,用真实 Firefox 浏览器抓取 Google 搜索结果并以结构化 JSON 返回,无需 API 密钥。

可以做什么
  • 执行 Google 搜索,返回自然结果及解析后的真实链接、标题、摘要、日期和子链接
  • 读取 Google 页面上的答案模块:AI 概览、其他人还问、相关搜索、广告和分页
  • 抓取公开网页,返回标题、可读正文和主要内容中的链接
  • 查询状态:代理数据用量与上限、已用和已被封的 IP、缓存情况
  • 按页码、语言、国家、时间范围和指定站点限定搜索
适用场景
当助手需要 Google 自有索引(含 AI 概览和“其他人还问”),而不是其他搜索服务商时适用;需要在本机运行浏览器。适合自用 IP 上的低频率个人或研究用途,或已有代理的环境。
运行要求
以 Python 包形式本地运行(uvx 或 pipx),通过 stdio 通信;首次需运行安装命令下载约 1 GB 的浏览器。无需 API 密钥或账号。可选 GSEARCH_PROXY 提升额度,可选 GSEARCH_DATA_LIMIT_MB 限制代理流量,可用 GSEARCH_ENV_FILE 指定配置文件。无图形界面的 Linux 服务器需安装 Xvfb 以运行可见浏览器窗口。
安装前请注意
README 明确指出自动访问 Google 搜索可能违反 Google 服务条款,法律风险由使用者承担,正式使用前应咨询法律意见。GSEARCH_PROXY 中的代理账号密码会以明文写入客户端配置。代理流量会产生费用,并受 GSEARCH_DATA_LIMIT_MB 计量限制。搜索结果是不可信的第三方网页文本,可能包含提示注入,只能当作数据处理。被拦截的页面和截图会保存在本地。

安装

在 SourceWeft 中

  1. 打开 控制台中的 gsearch,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[gsearch: Google Search for AI agents. Real results as clean JSON, over MCP.]

[Tests] [PyPI] [Python 3.12+] [MIT license] [MCP server]

Quick start · How it compares · What you get · How it works · Proxies · Performance · FAQ

Real Google Search for your AI agent. No API key. Self-hosted. Over MCP.

Your agent calls google_search and gets Google's actual results page as typed JSON: every link resolved to its real URL, plus Google's answer boxes (sports results, top stories, videos), the AI Overview, People also ask and related searches. A real Firefox (Camoufox) runs Google's page as it is, on your own IP or through any proxy you already have.

Why: plain HTTP gets a JavaScript wall, automated Chrome got a CAPTCHA 2 out of 2 times in our test, and Google's official Custom Search API closes on 1 January 2027. Other search MCP servers either aren't Google's index (Brave, Tavily, Exa, DuckDuckGo) or charge per query (SerpApi, Bright Data).

[A live google_search call over MCP: python 3.14 release notes, 9 results in 1.5 s, every link resolved to its real URL, plus People also ask]

A real, live call on a home IP with a warm session, rendered from the recorded result; the wait shown is the measured time. MP4

🚀 Quick start

bash
uv tool install gsearch-agent                         # or: pipx install gsearch-agentgsearch setup                                         # downloads the browser once (~1 GB), prints your MCP configclaude mcp add gsearch --scope user -- gsearch-mcp    # or any MCP client, below

Then just ask: "Search Google for what asyncio is and give me the top three links", "What do people also ask about asyncio?", "Find asyncio pages on python.org from the past year.", "Search for the asyncio docs and summarize the first result."

Without a proxy, gsearch uses your own IP, at most 20 searches an hour. For more, add a proxy in any format:

bash
claude mcp add gsearch --scope user -e GSEARCH_PROXY="gate.example.com:7000:user-sid-{sid}:password" -e GSEARCH_DATA_LIMIT_MB=1000 -- gsearch-mcp
Claude Desktop, Cursor and other MCP clients

gsearch setup prints this block with the full path of gsearch-mcp filled in. Use the full path if your client doesn't find the command.

json
{  "mcpServers": {    "gsearch": {      "command": "gsearch-mcp",      "env": { "GSEARCH_PROXY": "optional, any format", "GSEARCH_DATA_LIMIT_MB": "1000" }    }  }}

Claude Desktop: claude_desktop_config.json. Cursor: ~/.cursor/mcp.json, or .cursor/mcp.json in a project.

No install, with uv: use "command": "uvx", "args": ["gsearch-agent"], after fetching the browser once with uvx --from gsearch-agent gsearch setup.

Settings in a file: put them in a .env (see .env.example) and set GSEARCH_ENV_FILE to its absolute path instead.

[!NOTE] Automated access to Google Search may breach Google's Terms of Service. Read Legal and responsible use before running live searches.

🆚 How it compares

[How gsearch compares with paid SERP APIs, other search indexes, free engine MCP servers and Playwright Chromium Google MCP servers]

The same comparison as text
gsearchSerpApi, Bright DataBrave, Tavily, ExaDuckDuckGo, SearXNG MCPsPlaywright + Chromium Google MCPs
Google's own results✅✅❌ their own index❌ / depends on the instance✅
API key or accountnonerequiredrequirednonenone
Costfree (+ your proxy, optional)per queryusage-based plansfreefree
Runs on your machine✅❌ hosted❌ hosted✅✅
AI Overview, People also ask✅✅ (SerpApi)❌❌varies
Google's redirect links resolved to real URLs✅✅n/an/avaries
Blocks reported as errors with a retry time✅n/an/avariesvaries
Terms-of-Service risk is yoursyes (Legal)the provider'snolowyes

"Varies": we did not test those projects. Our only Chromium measurement is F-0001: Playwright Chrome was sent to a CAPTCHA 2 of 2 times on an IP where gsearch was served. Read Legal before running live searches.

[Results: 24 of 24 searches served with 0 CAPTCHAs on a home IP, 1.2 s per search on a warm session, 0.6 MB per search on a clean proxy IP, every link resolved to its real URL]

Measured in October 2026: F-0014, F-0006, F-0011, F-0012, F-0001; 14 s and 0.6 MB on a clean proxy IP: F-0015. Flagged proxy pools are slower: see Performance.

✨ Why gsearch

[Same IP: plain HTTP gets 0 results, automated Chrome gets a CAPTCHA 2 of 2 times, gsearch is served 24 of 24]

Google's official search API is closed to new customers and shuts down on 1 January 2027 (F-0005). gsearch is built for AI agents instead:

  • 🦊 A real browser, not a scraper. Camoufox, a hardened Firefox, runs Google's page as it is, with a real-device fingerprint and a locale that matches its IP.
  • 🔗 Real URLs. Google hides result links behind /goto redirects. gsearch resolves every one to the page it points to, without loading that page.
  • 🤖 Built for agents. One MCP server: search, page reading and status, typed JSON. Blocks come back as clear errors with retry_after_s, never as empty results, and every string is flagged as untrusted web content.
  • 🌍 Any proxy, any format. Rotating residential, static VPS or datacenter lists, HTTP, HTTPS or SOCKS5, in any common layout. Every byte is counted, with a hard data limit.
  • 🎯 Nothing to tune. Two settings. Everything else is fixed to what worked best in testing.
  • 📊 Honest numbers. Every claim in this README links to a write-up of how it was measured.

📦 What your agent gets

[Each part of a Google results page and the JSON field it becomes]

Real output from a saved results page (offline demo mode, where url stays null; a live search fills it):

[gsearch search output]

A block is never an empty list. It comes back as an error that says what happened and how long to wait:

[A CAPTCHA returned as a structured error]

Every field explained
FieldWhat it holds
organic[].urlThe real destination of each result, resolved from Google's /goto redirect in the same session.
organic[].title, snippet, date, domain, display_urlWhat the result shows, as text. link keeps the exact link Google served.
organic[].sitelinks, source_metaA result's sub-links, and what Google shows instead of a URL on forum and video results (2 years ago).
ai_overviewThe AI Overview text and its sources, when Google shows one.
people_also_ask, related_searchesThe questions and related queries on the page.
adsText ads, when the market serves them.
paginationCurrent page and next page. Ask for more results with page.
meta.untrusted_contentAlways true: every string is third-party web text (see prompt injection).

Error codes: captcha, soft_block, hard_block, consent_wall, js_gate, rate_limited, parse_drift, network, proxy, backend_unavailable, invalid_request. The full JSON Schema is in serp.schema.json.

🔍 How it works

[One search: agent asks, fresh IP, real Firefox, clean JSON, all closed]

  • Like a person. A visible window, because headless sessions were challenged far more often on proxy IPs (F-0015). The query is typed into the address bar. WebRTC is off, so your own IP can't leak around the proxy.
  • Never forged. gsearch never generates or alters Google's tokens: the browser runs the page as it is.
  • Cheap links. Links are resolved on the same IP with the same cookies and a TLS fingerprint matching the browser's (F-0011, F-0013).
  • Runs on servers. On a Linux machine without a screen, the browser uses a virtual display automatically (sudo apt install xvfb).

🌍 Proxies

[Rotating residential, static or VPS proxies, or no proxy; any format]

ini
# rotating residential: {sid}, or your provider's sid-…, session-…, sessid-… part, gives a new IP per searchGSEARCH_PROXY=gate.example.com:7000:user-country-us-sid-{sid}:password
# static proxies (VPS, datacenter, ISP): one or many, separated by commas, spaces or new linesGSEARCH_PROXY=socks5://user:[email protected]:1080, http://203.0.113.11:3128
# or a file with one proxy per lineGSEARCH_PROXY=/path/to/proxies.txt
  • Rotating: a new IP and a new browser for every search, up to 3 at once. A blocked IP is replaced, up to 4 IPs per search. country-xx or cc-xx in the login is checked, and exits elsewhere are dropped.
  • Static: each IP keeps one warm session, and the IPs take turns. Each IP has its own budget (20 searches an hour, 150 a day) and rests until midnight after a CAPTCHA, so ten IPs allow up to about 200 searches an hour.
  • Data: every byte goes through a local relay that counts it, and GSEARCH_DATA_LIMIT_MB stops everything at your limit, across restarts.

[!TIP] Check your proxy provider's acceptable-use policy. Many forbid using their network on sites whose terms prohibit automated access, and forbid solving CAPTCHAs.

📊 Performance

Proxy quality decides speed and cost. Many residential IPs are already flagged by Google. Each flagged IP costs a browser launch (about 0.7–1 MB and 20 s) before the next one is tried.

Expected with a high-quality rotating proxyMeasured on a low-quality pool (F-0015)
Fresh IPs served by Google~85% or more (assumed)1 in 3 to 1 in 5
Time per search~15–20 s (14 s measured on a clean IP)40–75 s
Proxy data per search~0.6–1 MB (0.6 MB measured on a clean IP)4.7–6.3 MB
Searches per hour (3 browsers)~500–600~72
1,000 searches~0.6–1 GB, under 2 hours~5–6.5 GB, ~14 hours

Without a proxy, a warm session on your own IP takes ~1.2 s per search, with every link resolved and 0 CAPTCHAs in testing (F-0014), capped at 20 searches an hour to protect your IP. Static proxies have not been benchmarked yet.

Measure your own proxy within your data limit:

bash
python tools/benchmark.py -n 10

🛠 Reference

Settings (five in total; most people need the first two)
SettingWhat it does
GSEARCH_PROXYYour proxies, in any format above, or a file listing them. Unset: your own IP.
GSEARCH_DATA_LIMIT_MBStop all proxy traffic at this many MB, counted across restarts. Unset: no limit.
GSEARCH_ENV_FILEAbsolute path of your .env. Needed in MCP client configs. If set, the file must exist.
GSEARCH_FIXTURES_DIRAnswer from saved pages instead of Google (demos and tests).
GSEARCH_STATE_DIRWhere budgets, the data meter and saved block pages live. Default: %LOCALAPPDATA%\gsearch or ~/.local/share/gsearch.

Everything else is fixed to what worked best in testing: a new IP per search with rotating proxies, a visible browser, address-bar search, real-device fingerprints, 4 attempts per search, always resolving URLs, and a 10-minute cache for repeated queries.

MCP tools, CLI and Python
MCP toolArgumentsReturns
google_searchquery, and optionally page (1–50), lang (en, fr, …), country (us, …), time_range (h, d, w, m, y), site (a domain)The JSON above plus a short text summary, or an error result on a block.
fetch_pageurl (a public http/https page)The page's title, readable text (up to 30,000 characters) and the links in its main content. Goes through your proxy and counts against the data limit. Refuses this machine and private networks.
google_search_statusnoneProxy data used against the limit, IPs used and blocked, and the cache. Never contacts Google.
text
gsearch search "query" [--page N] [--lang xx] [--country xx] [--time-range h|d|w|m|y] [--site domain]gsearch search "query" --fixtures fixtures/gecko     answer from saved pages (offline, from a clone of this repo)gsearch fetch URL                                    readable text and links of a web pagegsearch parse page.html                              parse any saved Google results pagegsearch schema                                       print the JSON Schemagsearch identity check                               home-IP browser's fingerprint matches its IP (no Google traffic)gsearch setup                                        download the browser once and print the MCP config

Exit codes: 0 results, 2 usage or settings error, 3 blocked or other error, 4 Google changed its layout.

python
import asynciofrom gsearch_core.client import SearchClientfrom gsearch_core.config import fetcher_from_envfrom gsearch_parse.models import SearchRequest
async def main() -> None:    fetcher, _live = fetcher_from_env()      # reads the settings and .env    result = await SearchClient(fetcher).search(SearchRequest(query="what is asyncio in python"))    print(result.model_dump_json(indent=2))  # SearchResponse or SearchError    await fetcher.aclose()
asyncio.run(main())

To call it over MCP from your own code, the way an agent does, see examples/mcp_client.py.

Troubleshooting
You seeWhat it meansWhat to do
captcha on most searchesYour proxy's IPs are flagged by Google.Try another pool or country. Measure with tools/benchmark.py.
captcha with hours to wait, no proxyYour own IP was challenged and rests until midnight.Wait, or add a proxy.
rate_limitedEvery IP is at its hourly or daily budget (own IP or static proxies).Wait retry_after_s, or add proxies.
proxy: no usable exit in 4 drawsFour IPs in a row were dead or in the wrong country.Check the country part of the login, and the provider.
proxy: proxy data limit reachedGSEARCH_DATA_LIMIT_MB is used up.Raise it, or delete proxy_bytes.json in the state folder to count from zero.
parse_driftGoogle changed its page layout.Update gsearch, or see CONTRIBUTING.md.
GSEARCH_ENV_FILE=… does not existThe settings path is wrong.Use an absolute path. gsearch refuses to start rather than fall back to your own IP.
the Camoufox browser is not installedThe browser has not been downloaded yet.Run gsearch setup once.
Browser windows openExpected with a proxy: visible sessions are challenged far less.On a server without a screen, install Xvfb and they run on a virtual display.

When the browser hits a block or an error, the page is saved with a screenshot in the state folder's evidence/, and the error's evidence_ref points to it.

❓ FAQ

Do I need a proxy? No. Without one, gsearch uses your own IP with a warm session (~1.2 s per search), capped at 20 searches an hour and 150 a day to keep your IP clean. For volume, use a proxy.

Which proxy should I buy? A rotating residential proxy with sticky sessions (a session id in the username). Quality matters more than price: run tools/benchmark.py on a small plan before buying more.

How much proxy data does a search use? About 0.6 MB on a clean IP. Flagged IPs cost more, because each one is a wasted browser launch. Set GSEARCH_DATA_LIMIT_MB so you can never overspend.

Does it solve CAPTCHAs? No. A blocked IP is dropped and a fresh one is tried. gsearch ships no CAPTCHA solver and never forges Google's tokens.

Can it run on a server? Yes. On Linux without a screen, install Xvfb and the browser runs on a virtual display.

Which agents work with it? Any MCP client: Claude Code, Claude Desktop, Cursor and others. You can also use the CLI or call it from Python.

📜 Legal and responsible use

  • Google's Terms of Service restrict automated access to Google Search. Running this tool against Google may breach those terms, whatever this project's license says.
  • Litigation risk is real and current. In Google v. SerpApi (N.D. Cal., filed 2025-12-19), Google argues that solving its SearchGuard JavaScript challenge by automated means is circumvention under DMCA §1201. gsearch runs that challenge in a real browser and does not forge or alter tokens, but the complaint also targets automated browsers. See docs/DESIGN.md (D-004).
  • No CAPTCHA solver is shipped, wired in or recommended. A CAPTCHA rests the identity and is reported as an error.
  • Get legal advice for your jurisdiction and use case before running live searches. The parser (gsearch_parse) only reads HTML you already have.
  • Limits are on by default and cannot be bypassed from the CLI or MCP. Don't use proxies to hammer Google.
  • No personal-data harvesting. Don't profile people, scrape people-search results or collect personal data at scale. Keep caches short-lived and don't republish raw results.
  • On a block, back off. CAPTCHAs and rate limits come back as errors with retry_after_s. gsearch never tries to defeat the challenge.

Prompt injection

Every title, snippet, URL and question in a result is untrusted third-party text from the open web, and may contain instructions aimed at your agent. The tool descriptions say so, every response carries meta.untrusted_content: true and an MCP untrusted_content flag, and the text summary ends with a warning. Treat results strictly as data.

🤝 Contributing

Tests never contact Google: the parser is tested against saved pages, and the browser against a local fake Google. Pull requests are welcome: pick a good first issue, see the roadmap, and start with CONTRIBUTING.md and docs/DESIGN.md.

If gsearch saves you time, a ⭐ helps other people find it.

License

MIT. Camoufox (MPL-2.0) is installed from PyPI as a dependency and is never vendored.

来源:README.md,提交 d28d2e0

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Oct 18, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分