Google Custom Search MCP

io.github.A1-x-Tech由 GitHub 帳號 A1-x-Tech 發布v1.1.1更新於 Nov 1, 2026

MCP server for Google Custom Search: web and image search via a Programmable Search Engine.

概覽

AI 產生的概覽

透過 Google 可程式化搜尋引擎執行網頁與圖片搜尋,支援分頁、篩選,並提供原始 API 請求入口。

可以做什麼
  • 在你的可程式化搜尋引擎中搜尋網頁,可依語言、國家、日期、網站與檔案類型縮小範圍,並用游標翻頁
  • 搜尋圖片,回傳圖片檔案及其尺寸、縮圖和所在頁面
  • 對 Custom Search JSON API 的任意路徑送出原始 GET 請求,以使用型別化工具未提供的參數
適用情境
適合讓助理透過你自己的 Google 引擎在開放網路或指定網站集合中查找資料,並依主題取得圖片。它為唯讀,無法回報你自己網站的收錄或排名狀況。
執行需求
本機 Node.js 20+ 程序,通常以 npx 啟動。需要已啟用 Custom Search API 的 Google Cloud API 金鑰(GOOGLE_CUSTOM_SEARCH_API_KEY)與可程式化搜尋引擎 ID(GOOGLE_CUSTOM_SEARCH_ENGINE_ID);全網搜尋須在引擎中啟用「搜尋整個網路」,圖片搜尋須啟用圖片搜尋。另有 API 位址、逾時與重試等選用設定。
安裝前請注意
API 金鑰屬於機密,建議限制為僅能用於 Custom Search API。每次呼叫(包含 raw_request)都會消耗專案每日配額一個單位(免費 100 次/天,付費可更高),過於寬泛或重複的查詢會耗用配額。請求會送往 Google,伺服器預設傳送匿名遙測,包含安裝 ID 與部分遮蔽的錯誤摘錄;設定 ASKADS_TELEMETRY=0 可關閉。所有工具皆為唯讀 GET。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Google Custom Search MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[A1] Google Custom Search MCP

English | Русский

[npm] [Glama] [CI] [License: MIT]

A1 Google Custom Search MCP lets an AI app search the web and images in plain language through your Programmable Search Engine. Ask for pages, narrow by language, country, date or site, page through results and pull image files with thumbnails.

It uses the Google Custom Search JSON API with your Google Cloud API key. You decide what the engine covers — a handful of sites or the entire web — and the server makes the limits of the JSON API explicit instead of implying that every search task is possible.

  • 3 tools. Web search, image search, and a raw GET escape hatch for parameters the typed tools don't expose.
  • Read-only end to end. The Custom Search JSON API has no write endpoint; every tool is marked read-only and nothing here can modify data.
  • You control the coverage. The engine's configuration decides what gets searched; results and ranking can differ from google.com.
  • The key stays in a header. API-key authentication — no OAuth, no scopes; the key travels in the X-Goog-Api-Key header and never appears in a URL.
  • Not Google Search Console. It cannot report how your own site is indexed or ranked.

Start with a read-only question:

Find recent articles about passkey adoption from the last month and summarize the top three results.

Connect the server · Explore use cases · Open technical documentation


See it work in a minute

You: Find recent articles about passkey adoption, English only, from the last month.

Assistant: Runs one search through your engine and shows each result's title, link and snippet. Nothing changes — every tool is read-only.

You: Show the next page.

Assistant: Continues from the next_start cursor and shows results 11–20 of the same query.

You: Now find large press photos on the same topic.

Assistant: Switches to image search and returns image files with their dimensions, thumbnails and the pages that host them.

Contents

Quick start

You need Node.js 20+, a Google Cloud API key with the Custom Search API enabled and a Programmable Search Engine id (cx).

  1. Get an API key and an engine id.
  2. Add the server to your AI app.
  3. Ask the read-only question above.
Codex

In the app: open Settings → MCP servers, select Add server, choose STDIO, enter the command npx -y mcp-google-custom-search@latest and environment variables GOOGLE_CUSTOM_SEARCH_API_KEY, GOOGLE_CUSTOM_SEARCH_ENGINE_ID, then select Save and Restart.

From the command line:

bash
codex mcp add google-custom-search \  --env GOOGLE_CUSTOM_SEARCH_API_KEY=your_api_key \  --env GOOGLE_CUSTOM_SEARCH_ENGINE_ID=your_engine_id \  -- npx -y mcp-google-custom-search@latest
bash
codex mcp list

Codex MCP documentation

Claude Code
bash
claude mcp add \  --env GOOGLE_CUSTOM_SEARCH_API_KEY=your_api_key \  --env GOOGLE_CUSTOM_SEARCH_ENGINE_ID=your_engine_id \  --transport stdio --scope user google-custom-search \  -- npx -y mcp-google-custom-search@latest
bash
claude mcp list

Claude Code MCP documentation

Claude Desktop

The current official path is Settings → Extensions. For a custom desktop extension, open Advanced settings → Extension Developer → Install Extension…, select a .mcpb file and follow the prompts.

This repository currently publishes an npm stdio package and does not contain a .mcpb bundle. For Claude Desktop builds that still support local configuration, use the following JSON stdio configuration as a fallback:

json
{  "mcpServers": {    "google-custom-search": {      "command": "npx",      "args": ["-y", "mcp-google-custom-search@latest"],      "env": {        "GOOGLE_CUSTOM_SEARCH_API_KEY": "your_api_key",        "GOOGLE_CUSTOM_SEARCH_ENGINE_ID": "your_engine_id"      }    }  }}

In those builds, save it to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows.

Claude Desktop MCP documentation

Cursor

Add this to ~/.cursor/mcp.json on macOS/Linux or %USERPROFILE%\.cursor\mcp.json on Windows:

json
{  "mcpServers": {    "google-custom-search": {      "type": "stdio",      "command": "npx",      "args": ["-y", "mcp-google-custom-search@latest"],      "env": {        "GOOGLE_CUSTOM_SEARCH_API_KEY": "your_api_key",        "GOOGLE_CUSTOM_SEARCH_ENGINE_ID": "your_engine_id"      }    }  }}

Cursor MCP documentation

VS Code

Run MCP: Open User Configuration and add:

json
{  "servers": {    "google-custom-search": {      "type": "stdio",      "command": "npx",      "args": ["-y", "mcp-google-custom-search@latest"],      "env": {        "GOOGLE_CUSTOM_SEARCH_API_KEY": "${input:custom_search_api_key}",        "GOOGLE_CUSTOM_SEARCH_ENGINE_ID": "${input:custom_search_engine_id}"      }    }  },  "inputs": [    { "type": "promptString", "id": "custom_search_api_key", "description": "Google Cloud API key", "password": true },    { "type": "promptString", "id": "custom_search_engine_id", "description": "Programmable Search Engine id (cx)" }  ]}

Check it with MCP: List Servers.

VS Code MCP documentation

What you can ask it to do

Search the web

  • Find recent tutorials on a topic and summarize the top results.
  • Search only within docs.python.org — or everywhere except a site you distrust.
  • Show the next page of results for the same query.

Narrow the results

  • Only English pages published in the last month.
  • Only PDF files; require an exact phrase or exclude a term.
  • Restrict to one country's content, or to material with specific usage rights.

Find images

  • Find large photos on a topic, with dimensions and thumbnails.
  • Only clipart or line drawings, black and white ones.
  • Show the page each image comes from.

Go beyond the typed tools

  • Call the API with parameters the typed tools don't expose — fields to trim the response, lowRange/highRange, hq.
  • Fetch the raw response envelope with promotions and the full pagemap.

How a search works

  1. Every query runs through a Programmable Search Engine, identified by its cx id — the configured default or a per-call engine_id. The engine's configuration decides coverage: a list of specific sites, or the entire web when "Search the entire web" is enabled.
  2. Results come back normalized — title, URL, snippet and metadata — with next_start/previous_start cursors for paging. total_results is Google's estimate and can shrink while paging.
  3. The API returns at most 10 results per call and 100 per query (start + num - 1 must stay ≤ 100). The server rejects a wider window before the request — the API would answer 400 after burning a quota unit.
  4. Image search requires Image search enabled in the engine's control panel; otherwise the API answers 400.

A corrected_query in the response is a spelling suggestion only — the results are still for the original query. And this is Programmable Search, not Google Search Console: the API cannot report how your own site is indexed or ranked.

What can change

OperationWhat happensConfirmation boundary
Web search (search)Reads search results from your engineNo change
Image search (search_images)Reads image results from your engineNo change
Raw API request (raw_request)GET against any Custom Search API pathNo change — the API has no write endpoint

Every tool carries the read-only annotation, the escape hatch included. The Custom Search JSON API is a single GET endpoint with no writes, so the only thing a call spends is a unit of your daily quota.

Getting access

Google Custom Search authenticates with an API key; no OAuth and no scopes are involved.

  1. Create or select a Google Cloud project and enable the Custom Search API.
  2. Create an API key under APIs & Services → Credentials. Restricting the key to the Custom Search API is a good habit.
  3. Create a Programmable Search Engine in the control panel and copy its Search engine ID (cx). Enable Search the entire web for open-web search and Image search for the image tool.

Treat the API key as a password. The server sends it in the X-Goog-Api-Key header, never in a URL, so logged or echoed URLs cannot leak it.

Configuration

VariableRequiredDescription
GOOGLE_CUSTOM_SEARCH_API_KEYYesGoogle Cloud API key with the Custom Search API enabled. Secret.
GOOGLE_CUSTOM_SEARCH_ENGINE_IDRecommendedDefault Programmable Search Engine id (cx); tools accept a per-call engine_id override.
GOOGLE_CUSTOM_SEARCH_API_BASENoCustom Search API base URL override.
GOOGLE_CUSTOM_SEARCH_TIMEOUT_MSNoPer-request timeout; default 30000 ms.
GOOGLE_CUSTOM_SEARCH_MAX_RETRIESNoTransient-error retries (429/5xx/network); default 3.

Without credentials the server still starts and completes the MCP handshake; the first tool call explains exactly which variables to set. The one malformed setup is an engine id without an API key — the key cannot be supplied per call, so both must be set together.

Data, limits and background work

  • Requests go to Google. The local server calls the Custom Search JSON API. Its anonymous telemetry contains an installation ID, package version, AI client and platform versions, and tool names — never the API key, search queries, results or tool arguments. For each tool call it also sends the outcome and, on failure, an excerpt of the error text with e-mails, addresses, tokens, numbers of 4+ digits and quoted text replaced by #; a value from your request can appear in it if the error text contains it. Set ASKADS_TELEMETRY=0 to opt out.
  • Google applies a daily quota. Every call from any of the three tools costs one unit of the per-project quota — 100 queries per day free, up to 10,000 per day with billing. On 429, the server backs off honoring Retry-After; because the whole API is idempotent GETs, 5xx and network errors are retried too, while 400/403 fail fast.
  • There is no background polling. The server runs only when called. If your AI app supports scheduled tasks, it can rerun a search periodically — each run still spends quota units.

Technical documentation

Support

Found a bug or need a scenario? Create an issue or write in Telegram.


[Две Моны дают пять]

You made it to the end!

來源:README.md,提交 24b9d71

工具

3

search_images

Image search

Image search through your Google Programmable Search Engine (searchType=image). Works only when the engine has "Image search" enabled in its control panel — otherwise the API answers 400. Each item's url is the image file itself; image.context_url is the page hosting it, with width/height/byte_size and a thumbnail_url (plus its dimensions) for previews. Everything else matches the search tool: same filters (language/country, safe search, site include/exclude, date_restrict, file_type, rights — use rights for reusable images), same pagination (max 10 per call, 100 per query, paginate via next_start), same quota (one unit per call). Image-only filters: size (icon..huge), type (clipart/face/lineart/stock/photo/animated), color_type (mono/gray/color/trans) and dominant_color.

輸入參數numsafesizesorttypequery必填startrightscountrylanguageor_termsengine_id另有 12 個

raw_request

Raw Custom Search API call

Escape hatch: performs a GET against any Custom Search JSON API path and returns the raw, unnormalized response envelope (queries.request/nextPage, searchInformation, promotions, context, items[] with htmlSnippet/htmlTitle/formattedUrl and the full pagemap). Use it for parameters the typed tools don't expose (lowRange/highRange, c2coff, hq, fields) — e.g. path "customsearch/v1?q=test&num=3&fields=items(title,link)". The API key is added automatically (in a header, never the URL) and the configured engine id is filled in when the path has no cx parameter. The API has GET endpoints only, so nothing here can modify data.

輸入參數path必填

版本歷史

4
  1. v1.1.1最新Oct 31, 2026
  2. v1.1.0Oct 31, 2026
  3. v1.0.0Sep 23, 2026
  4. v0.1.0Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分